A Python utility that automatically uploads photos from your local directory (recursively) to Nixplay digital photo frames. The tool supports batch processing, image resizing, and text overlay with date and location information.
-
Prerequisites
- Python 3.8 or higher
- A Nixplay account
- Local directory containing photos to upload
-
Set Up Project Directory
- Create a new directory for the project
- Copy the following files into it:
nix-upload.py
requirements.txt
sample_config.json
- Make a copy of
sample_config.json
and name itconfig.json
:# Windows copy sample_config.json config.json # macOS/Linux cp sample_config.json config.json
-
Install Dependencies
pip install -r requirements.txt
-
Configure the Application
- Edit
config.json
with your credentials and preferences - Required parameters:
username
: Your Nixplay account emailpassword
: Your Nixplay account passwordphotos_directory
: Path to your photos directory
- Edit
-
Verify Installation
python nix-upload.py --help
The script uses a config.json
file for configuration. Here are all available parameters:
username
: Your Nixplay account usernamepassword
: Your Nixplay account passwordphotos_directory
: Path to the directory containing your photos
base_url
: Nixplay website URL (default: "https://app.nixplay.com")playlist_name
: Name of the Nixplay playlist to upload to (default: "nix-upload")max_photos
: Maximum number of photos to upload (default: 500)max_file_size_mb
: Maximum file size for each photo in MB (default: 3)batch_size
: Number of photos to upload in each batch (default: 100)image_width
: Target width for resized images (default: 1280)image_height
: Target height for resized images (default: 800)log_level
: Logging level (default: "INFO")headless
: Run browser in headless mode (default: true)caption
: Whether to add text overlay with date and location (default: true)date_format
: Format for date display on photos (default: "%Y-%m-%d %H:%M")caption_position
: Position of text overlay ("top" or "bottom", default: "bottom")font_size
: Font size for text overlay in points (default: 40)font_path
: Path to custom font file (default: null, uses system font)- Windows examples:
"C:/Windows/Fonts/arial.ttf"
"C:/Windows/Fonts/calibri.ttf"
"C:/Windows/Fonts/helvetica.ttf"
- macOS examples:
"/Library/Fonts/Arial.ttf"
"/Library/Fonts/Helvetica.ttc"
"/System/Library/Fonts/Helvetica.ttc"
- Linux examples:
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
"/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf"
- Windows examples:
Common date format options for the date_format
parameter:
"%b %Y"
- Month and year (Jan 2024)"%B %Y"
- Full month name and year (January 2024)"%b %d, %Y"
- Month, day, and year (Jan 15, 2024)"%Y-%m"
- Year and month (2024-01)"%m/%Y"
- Month and year (01/2024)
{
"username": "USERNAME",
"password": "PASSWORD",
"photos_directory": "PATH/TO/ROOT/OF/YOUR/PHOTOS/DIR",
"base_url": "https://app.nixplay.com",
"playlist_name": "nix-upload",
"max_photos": 500,
"max_file_size_mb": 3,
"batch_size": 100,
"image_width": 1280,
"image_height": 800,
"log_level": "INFO",
"headless": false,
"caption": true,
"caption_position": "bottom",
"date_format": "%b %Y",
"font_size": 50,
"font_path": "C:/Windows/Fonts/arial.ttf"
}
- open a command shell in the "nix-upload" directory on your computer
- Run "python nix-upload.py"
The script will first DELETE ALL PHOTOS from the specified playlist. Then it will upload all the new photos to the same playlist.
- I dont know why this warning shows, but it seems to be a benign message "Attempting to use a delegate that only supports static-sized tensors with a graph that has dynamic-sized tensors (tensor#-1 is a dynamic-sized tensor)."
- In your config.json file, set "max_photos" to not more than 1900, and "batch_size" to not more than 100, for best performance
Apache License 2.0
Use at your own Risk