cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8975
Views
49
Helpful
20
Replies

change wallpaper via API for all device

orcunulutas
Level 1
Level 1

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.

20 Replies 20

Patrick Sparkman
VIP Alumni
VIP Alumni

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:

  • TC software: Configuration > Personalization
  • CE software: Setup > Personalization

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

orcunulutas
Level 1
Level 1

thanks... i resolved this issue. i wrote a code to manipulate the web interface. i can upload wallpaper and set with script.

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.

If you're using the branding option with CE9, there is a branding upload script available (see attached php script in ZIP file).

Wayne

Please remember to mark helpful responses and to set your question as answered if appropriate.

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?

Please rate all useful posts

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.

Wayne

Please remember to mark helpful responses and to set your question as answered if appropriate.

Thanks Wayne,

I was able to re-write the code in python and it works brilliantly

Regards

Please rate all useful posts

Would you be able to share your python code? I'm interested to see how it work in Python

Would you be able to share your python code? I'm interested to see how it work in Python

Yes I plan to share the code. I need to tidy it up a bit. I will do that
next week after the Easter break
Please rate all useful posts

thank you very much

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.

 

Please rate all useful posts

Thank you very much

Thanks.