Created
April 21, 2022 02:27
-
-
Save maud3l/0bea310947e71d6dd9d359febb2a511b to your computer and use it in GitHub Desktop.
Get all unplayed movies from Emby Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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