+1

Script to load random photo into a Media Tile

Thyamine 2 years ago in Media Tiles / Images updated 1 month ago 5

For anyone else who is interested, I wanted a way to have photos load directly into a Media Tile, but I wanted it to change or randomize based on my own intervals.  I put together a script that I run every 10 minutes on my local Synology which looks at my photo folder, randomly selects a picture, saves it to a local folder with a set filename, and I can then point the Media Tile at. 

The Media Tile can be pointed at a static URL, and in the background the script does all the heavy lifting.  The tile just needs to know how often to reload which is dependent on how often you run the script to change the photo.

Explanation: https://www.sleepyweim.com/2019/06/08/actiontiles-picture-tiles-that-change/

Script: https://www.sleepyweim.com/2019/06/08/python-picture-tiles-that-change/

Let me know if you have any comments or questions.

- Thy

Do you think it would be possible to use WebCoRE to update/change an individual Media tile image on a Raspberry Pi to reflect a radio station logo?

I'm not familiar with WebCoRE, but if the Raspberry Pi is hosting the URL/website that you are using for the media image, it shouldn't matter how you get the file to the right location.  You can use any set of libraries to move/transfer the file to the right location.

Hey thyamine, thanks for sharing this.... I have a idea for a tile, and ran into your "random photo into a media tile" post...and thought maybe the work you have already done could help...

This is what I'd like to accomplish... In the area I live, electricity rates are different at different times of the day... different on weekends or holidays... and even different in summer or winter...

The graph below would summarize the electricity bands... so, On Peak, Mid Peak, Off Peak depending on the time of the day, day of week and winter/summer...

I am trying find a way to create a tile that would change its color (Red/Yellow/Green) based on this time of day schedule...and display a message like "On Peak" when the color is Red, "Mid Peak" when the color is yellow, and "Off Peak" when the color is green.

Thoughts on how to potentially adapt the work you have already done, to achieve this ?

Thanks !

 

That would be easy, I worked out how to change media tile images on command, I use it for when I change radio stations personally, but you can use any image you like...

https://community.webcore.co/t/automate-changing-an-actiontiles-media-image-with-a-get-request-from-webcore/16910

Yes, you certainly could.  The script could be set to run once an hour, and then it does a simple check on the date and time.  Based on your chart, you could then have some rules that simply tell it what image to upload to the web server.