Control the Art Mode of a Samsung TV using the TV's API by using your own images based on whatever prompt you want.
In this case, it renders an image of the top news of the day.
The script uses the Samsung TV's API to retrieve the list of available art, select the latest art based on the highest content_id, and upload new images to the TV.
- Python 3.x
- Samsung Frame TV with Art Mode enabled
- Network connection to the TV
- Uses the
samsungtvwslibrary to communicate with the TV - Uses the
openailibrary to generate images based on prompts - Uses the
perplexitylibrary to get text completion based on prompts
- Install the required libraries by running
pip install samsungtvws - Create a new file called
config.pywith the following contents:
from news import get_prompt
from constants import PPX # Import the PPX API key from a file called constants.py
TV_IP = '192.168.1.100' # Replace with your TV's IP address
# Set your OpenAI API key.
OPENAI_API_KEY = # Your OpenAI API key
PPX = # Your perplexity API key
# Modify the prompt to your liking
PROMPT = f"Generate an photrealistic image consolidating the various items in {get_prompt('Enter your prompt here')}"- Run the script by executing
python main.py
upload_image(image_name: str) -> None: Uploads a new image to the TVdelete_art(content_id: str) -> None: Deletes the image from the TVget_content_id() -> Optional[str]: Gets the current art info
main.py: The main scriptconfig.py: Configuration file with TV IP address
- Make sure to replace the
TV_IPvariable inconfig.pywith your TV's actual IP address. - TV's Art Mode needs to be enabled and configured correctly.
