Jump to content

Setting PlaybackPositionTicks via API


Go to solution Solved by brampower,

Recommended Posts

brampower
Posted

Hi,

I am working on a script that will take Episode ID and PlaybackPositionTicks as a parameter, which will then send this data to other users (meaning I can keep the playback progress in sync between users).

It appears that I should use the following to POST:
/Users/{UserId}/Items/{ItemId}/UserData

 

However, this 404s for me. Is this still an active endpoint? If not, is there any other way to set PlaybackPositionTicks for a specific media ID through the API?

 

Thank you!

PlaybackPositionTicks/Users/{UserId}/Items/{ItemId}/User
Data
  • Solution
brampower
Posted (edited)

 I will admit that I have no idea what changed, but after tinkering with it a little while longer today, the following appears to work:

headers = {
    "X-Emby-Token": API_KEY,
    "Content-Type": "application/json"
}

user_data = {
        "PlaybackPositionTicks": playback_ticks
    }

 for user_id in USER_IDS:
        url = f"{SERVER_URL}/Users/{user_id}/Items/{item_id}/UserData"
        try:
            response = requests.post(url, headers=headers, json=user_data)
        except Exception as e:
            any_failures = True
            log(f"[ERROR] Exception for user {user_id}: {e}")

Sorry to waste your time, all looks good now and it's working correctly!

Edited by brampower
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...