10-26-2016 03:54 AM - edited 03-18-2019 06:31 AM
Hello,
we have more then 300 devices and i need to change wallpaper on all device.
i know following command ;
xConfiguration Video Wallpaper: custom
however, i need upload wallpaper to all device. i guess very long time upload file via web interface.
i tried root login enable however, i give following error message ;
Root access no longer available on TC release builds. Please use the remotesupport account for uses which previously required root access.
so, how can i push wallpaper to all device via API or anything ?
seems not login to device via scp and sftp because root login disabled with new versions of TC firmware.
10-26-2016 06:44 AM
You can upload custom wallpapers via the endpoint's web interface, depending on the software version of the endpoint, the option to upgrade custom wallpapers is located here:
You could use the Remote Support user account under Maintenance > System Recovery, and will require TAC support to activate the account. However, I'm not sure if the Remote Support account has permissions to the needed directory where the wallpaper is uploaded to. Once active, use WinSCP to upload the wallpaper to the /user/posters folder. Then via SSH, you'll need to enable the custom wallpaper after uploading:
xConfiguration Video Wallpaper: none
xConfiguration Video Wallpaper: custom
10-26-2016 10:52 AM
thanks... i resolved this issue. i wrote a code to manipulate the web interface. i can upload wallpaper and set with script.
07-12-2018 08:08 PM
Can you explain the script you wrote to do this? Our organization would like to use our endpoints as digital signage and change the wallpaper periodically but we have hundreds of endpoints and this is not possible doing it one at a time via the web interface.
07-12-2018 11:22 PM
09-13-2018 03:19 AM
Hi Wayne,
Have you used this PHP script? I am trying to understand what it does. If I do, I might be able to re-write it using python or at least use it like that. Is the body the png image? How do you convert the image file to this?
09-13-2018 06:34 PM - edited 09-13-2018 07:09 PM
Yes, I have used the script. The Body is the PNG image, Base-64 encoded.
You can use any of the many on-line encoders/decoders to create or decode the image from/to the Base64 string.
The way it works is quite simple and you should be able to easily replicate it in python or any other language. It essentially just goes through the list of endpoints/codecs you define in the $codecs array one at a time and POSTs the XML $payload to it via https using the putxml API.
Please remember to mark helpful responses and to set your question as answered if appropriate.
09-22-2018 07:34 AM
Thanks Wayne,
I was able to re-write the code in python and it works brilliantly
Regards
04-17-2019 08:52 PM
Would you be able to share your python code? I'm interested to see how it work in Python
04-17-2019 08:52 PM
04-18-2019 08:25 AM
04-18-2019 06:56 PM
04-24-2019 01:45 AM - edited 04-24-2019 03:10 AM
Here is the python code I used for uploading images for branding.
+++ Python code ++
# This code worked with python 3.6
# This code is used to upload branding images on TP endpoints.
# It reads the IP addresses of the endpoint from a CSV file and
# The image file to be uploaded needs to be base 64 encoded. ( there are many online tools that can do this)
# The credentials module is used to get the username/password for the endpoint.
# When using an IDE like pycharm you need to run the code in debug mode
# for you to get the username/password input
import httplib2
import credentials
import csv
import socket
from multiprocessing.pool import ThreadPool
import datetime
#CSV file which contains the IP addresses of all TP codecs
filename = 'TP_List.csv'
#log path. configure complete path along with filename
Logfile = "TP_codec_config_update_report.txt"
with open(Logfile, "a+") as text_file:
text_file.write('\n' + datetime.datetime.now().strftime("%A, %d. %B %Y %I:%M%p") + '\n')
text_file.write("==========================" + '\n')
rows = []
try:
with open(filename, 'r') as csvfile:
# creating a csv reader object
csvreader = csv.reader(csvfile)
# extracting field names through first row
fields = next(csvreader) # python3
# extracting each data row one by one
for row in csvreader:
rows.append(row)
# get total number of rows
print("Total no. of rows: %d" % (csvreader.line_num))
lines = int(csvreader.line_num)
except FileNotFoundError:
print(filename + " Input file not found in current directory")
fieldindex = fields.index('IP Address')
codecIPs = []
for row in rows:
codecIPs.append(row[fieldindex])
print("codecIPs are {}".format(codecIPs))
username, password = credentials.get_credentials()
httpexception = httplib2.HttpLib2Error
# xml_file: contains the xml code to use to upload the image on the TP endpoints. As stated earlier
# The image needs to be base 64 encoded
xml_file = 'brandinglogo.xml'
# This function is where the magic happens. I am using request to open the xml file and then posting the content
# to the url of each TP endpoint based on the IP address obtained from the CSV file
# NB that http needs to be enabled on the TP endpoint otherwise you will get a 302 error.
def do_upload(ip):
try:
request = open(xml_file, "r").read()
h = httplib2.Http(".cache")
h.add_credentials(username, password)
url = "http://{}/putxml".format(ip)
print('-'*40)
print('Enabling Macros on {}'.format(ip))
resp, content = h.request(url, "POST", body=request,
headers={'content-type': 'text/xml; charset=UTF-8'})
with open(Logfile, "a+") as text_file:
text_file.write("The Status of Macros enabling on codec IP {} |---->>>".format(ip) + '\n')
text_file.write(str(content.decode('utf-8') +'\n'))
except (socket.timeout, socket.error, httpexception) as e:
with open(Logfile, "a+") as text_file:
text_file.write('failed to connect to {} : {}'.format(ip, str(e)))
def main():
''' This Section uses multi-threading to send config to ten TP endpoint at a time'''
pool = ThreadPool(10)
results = pool.map(do_upload, codecIPs)
pool.close()
pool.join()
return results
main()
+++ xml file +++
Attached.
04-24-2019 07:23 PM
07-16-2019 02:43 PM - edited 07-16-2019 02:44 PM
Thanks.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide