Skip to main content

Synology PhotoStation Python API

A Python API to communicate with Photo Station running on Synology NAS. Photos and videos are uploaded directly to PhotoStation through its Web API with various metadata including ratings, title, description, and GPS coordinates.

This module uploads original files and lets Synology to process the required thumbnail versions. This works fine with Synology DS916+ but might be too slow with models having slower processors.

Supported features:

  • Login to your shared or personal Photo Station

  • List album contents

  • Create missing albums automatically

  • Add new photos

  • Update metadata of existing photos

  • Update photo binaries based if either timestamp or filesize differs

  • Delete photos

Tested with Synology DS916+ running DSM 6.1 and Photo Station 6.7.1. Should work with older versions too but you mileage may vary.

Installation

pip install photostation

Usage

from photostation import PhotoStationService, SynologyException
import requests

try:
    # login to Photo Station and set up root album
    service = PhotoStationService('https://USERNAME:PASSWORD@xyz.synology.me/photo/webapi/', 'root-album')

    # get reference to album and create it if missing
    album = service.album('2017/05/13', create=True)

    # list album content (subalbums, photos, videos)
    print(album.items)

    # add photo reference inside album
    photo = album.create_item(
        filename = 'testimage.jpg', # original filename
        filetype = 'photo',         # photo or video
        created = 1494603121336,    # timestamp of photo capture
        modified = 1494603121336    # optional timestamp to compare if existing binary has changed
        filesize = 1000,            # optional filesize to compare if existing binary has changed
        title = '',                 # optional title
        description = '',           # optional description
        rating = 0,                 # optional starts from 0 to 5
        latitude = 60,              # optional coordinates for videos
        longitude = 20)             # optional coordinates for videos

    # update metadata of existing photos
    merged = photo.merge()

    if merged:
        print('metadata was updated or already up to date, deleting photo')

        photo.delete()
    else:
        # upload new file
        stream = requests.get('https://dummyimage.com/600x400/000/fff', stream=True)
        photo.save_content(stream)

except SynologyException as se:
    print se.value

Metadata

Release files for photostation 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for photostation 0.1.5
File Size Uploaded Provenance Actions
photostation-0.1.5.tar.gz 7.9 kB Without provenance Details for photostation-0.1.5.tar.gz

Release files / photostation-0.1.5.tar.gz

Download URL photostation-0.1.5.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3653f272f63488321c0310d0a290f59d4468a98d117c521e174ce801fe5947dc
BLAKE2b-256 checksum
How to use checksums
65e7c619e2e79371ddf1cde348e8fef7cc49ed252efe3e93d5f04d1484625213
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for photostation 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page