From 61219817fbb775e0fa506e3cf900956215a3cf93 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 8 Jan 2024 01:19:53 -0500 Subject: [PATCH 1/4] Add identify method --- jellyfin_apiclient_python/api.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/jellyfin_apiclient_python/api.py b/jellyfin_apiclient_python/api.py index a0a06e8..e512171 100644 --- a/jellyfin_apiclient_python/api.py +++ b/jellyfin_apiclient_python/api.py @@ -1,4 +1,8 @@ # -*- coding: utf-8 -*- +""" +For API info see: + https://api.jellyfin.org/ +""" from typing import List from datetime import datetime import requests @@ -796,6 +800,30 @@ def new_sync_play_v2(self, group_name): }) +class ExperimentalAPIMixin: + """ + This is a location for testing proposed additions to the API Client. + """ + + def identify(client, item_id, provider_ids): + """ + Remote search for item metadata given one or more provider id. + + This method requires the user have appropriate permissions + + Args: + item_id (str): item uuid to identify + + provider_ids (Dict): + maps providers to the content id. (E.g. {"Imdb": "tt1254207"}) + + References: + https://api.jellyfin.org/#tag/ItemLookup/operation/ApplySearchCriteria + """ + body = {'ProviderIds': provider_ids} + return client.jellyfin.items('/RemoteSearch/Apply/' + item_id, action='POST', params=None, json=body) + + class API(InternalAPIMixin, BiggerAPIMixin, GranularAPIMixin, SyncPlayAPIMixin): """ From 50b43e3ae3cfa66fe4dce7abd8df2a012b4ce432 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 8 Jan 2024 13:20:42 -0500 Subject: [PATCH 2/4] identify doc --- jellyfin_apiclient_python/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jellyfin_apiclient_python/api.py b/jellyfin_apiclient_python/api.py index e512171..c3c5e3b 100644 --- a/jellyfin_apiclient_python/api.py +++ b/jellyfin_apiclient_python/api.py @@ -816,6 +816,8 @@ def identify(client, item_id, provider_ids): provider_ids (Dict): maps providers to the content id. (E.g. {"Imdb": "tt1254207"}) + Valid keys will depend on available providers. Common ones are: + "Tvdb", "Imdb", "Tvdb". References: https://api.jellyfin.org/#tag/ItemLookup/operation/ApplySearchCriteria From fe5fe1534cde33d85b56f8760082d779c2a4111a Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 21 Jan 2024 14:44:59 -0500 Subject: [PATCH 3/4] Expose identify method --- jellyfin_apiclient_python/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jellyfin_apiclient_python/api.py b/jellyfin_apiclient_python/api.py index c3c5e3b..429a692 100644 --- a/jellyfin_apiclient_python/api.py +++ b/jellyfin_apiclient_python/api.py @@ -827,7 +827,7 @@ def identify(client, item_id, provider_ids): class API(InternalAPIMixin, BiggerAPIMixin, GranularAPIMixin, - SyncPlayAPIMixin): + SyncPlayAPIMixin, ExperimentalAPIMixin): """ The Jellyfin Python API client containing all api calls to the server. From e20d175768390317a2a657847db918c7a92be0c4 Mon Sep 17 00:00:00 2001 From: joncrall Date: Sun, 21 Jan 2024 14:50:53 -0500 Subject: [PATCH 4/4] doc tweaks --- jellyfin_apiclient_python/api.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jellyfin_apiclient_python/api.py b/jellyfin_apiclient_python/api.py index 429a692..eb7bc26 100644 --- a/jellyfin_apiclient_python/api.py +++ b/jellyfin_apiclient_python/api.py @@ -809,18 +809,19 @@ def identify(client, item_id, provider_ids): """ Remote search for item metadata given one or more provider id. - This method requires the user have appropriate permissions + This method requires an authenticated user with elevated permissions + [RemoveProviderSearch]_. Args: - item_id (str): item uuid to identify + item_id (str): item uuid to identify and update metadata for. provider_ids (Dict): maps providers to the content id. (E.g. {"Imdb": "tt1254207"}) Valid keys will depend on available providers. Common ones are: - "Tvdb", "Imdb", "Tvdb". + "Tvdb" and "Imdb". References: - https://api.jellyfin.org/#tag/ItemLookup/operation/ApplySearchCriteria + .. [RemoveProviderSearch] https://api.jellyfin.org/#tag/ItemLookup/operation/ApplySearchCriteria """ body = {'ProviderIds': provider_ids} return client.jellyfin.items('/RemoteSearch/Apply/' + item_id, action='POST', params=None, json=body)