Skip to content

Instantly share code, notes, and snippets.

@maud3l
Created April 21, 2022 02:27
Show Gist options
  • Save maud3l/0bea310947e71d6dd9d359febb2a511b to your computer and use it in GitHub Desktop.
Save maud3l/0bea310947e71d6dd9d359febb2a511b to your computer and use it in GitHub Desktop.
Get all unplayed movies from Emby Server
import requests
EMBY_API_KEY=""
EMBY_USER=""
EMBY_URL=""
auth_header = {"X-Emby-Token": EMBY_API_KEY}
users = requests.get(f"{EMBY_URL}/Users", headers=auth_header).json()
for user in users:
if user.get('Name') == EMBY_USER:
user_id = user.get('Id')
movies = requests.get(f"{EMBY_URL}/Users/{user_id}/Items?Recursive=true&IncludeItemTypes=Movie", headers=auth_header).json()
for movie in movies.get('Items'):
if movie.get('UserData').get('Played') == False:
print(movie.get('Name'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment