From 45ed08f0a3dbe05fb480854afff0353ffa88f7b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 24 Jul 2024 00:22:45 +0300 Subject: [PATCH 1/5] Add PlexGuidProviderYoutube provider --- plextraktsync/plex/PlexGuidProviderYoutube.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plextraktsync/plex/PlexGuidProviderYoutube.py diff --git a/plextraktsync/plex/PlexGuidProviderYoutube.py b/plextraktsync/plex/PlexGuidProviderYoutube.py new file mode 100644 index 0000000000..cbfe0e3f0d --- /dev/null +++ b/plextraktsync/plex/PlexGuidProviderYoutube.py @@ -0,0 +1,19 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from plextraktsync.plex.PlexGuid import PlexGuid + + +class PlexGuidProviderYoutube: + def __init__(self, guid: PlexGuid): + self.guid = guid + + @property + def link(self): + return None + + @property + def title(self): + return f"{self.guid.provider}:{self.guid.type}:{self.guid.id}" From 4433851524341e71e54d029642d7d604c56b98db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 24 Jul 2024 00:23:40 +0300 Subject: [PATCH 2/5] Register youtube provider --- plextraktsync/plex/PlexGuidProvider.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plextraktsync/plex/PlexGuidProvider.py b/plextraktsync/plex/PlexGuidProvider.py index c36db38f21..a6e2bbb9a6 100644 --- a/plextraktsync/plex/PlexGuidProvider.py +++ b/plextraktsync/plex/PlexGuidProvider.py @@ -7,6 +7,7 @@ from plextraktsync.plex.PlexGuidProviderMbid import PlexGuidProviderMbid from plextraktsync.plex.PlexGuidProviderTMDB import PlexGuidProviderTMDB from plextraktsync.plex.PlexGuidProviderTVDB import PlexGuidProviderTVDB +from plextraktsync.plex.PlexGuidProviderYoutube import PlexGuidProviderYoutube if TYPE_CHECKING: from plextraktsync.plex.PlexGuid import PlexGuid @@ -23,6 +24,8 @@ def create(cls, guid: PlexGuid): return PlexGuidProviderTVDB(guid) if guid.provider == "mbid": return PlexGuidProviderMbid(guid) + if guid.provider == "youtube": + return PlexGuidProviderYoutube(guid) if guid.provider in ["local", "none"]: return PlexGuidProviderLocal(guid) From dae90c8b778cebc1e2c7cdeebb9856eeef108fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 30 Dec 2024 20:24:32 +0200 Subject: [PATCH 3/5] Add id property to PlexGuidProviderYoutube --- plextraktsync/plex/PlexGuidProviderYoutube.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plextraktsync/plex/PlexGuidProviderYoutube.py b/plextraktsync/plex/PlexGuidProviderYoutube.py index cbfe0e3f0d..13c3a922be 100644 --- a/plextraktsync/plex/PlexGuidProviderYoutube.py +++ b/plextraktsync/plex/PlexGuidProviderYoutube.py @@ -10,6 +10,10 @@ class PlexGuidProviderYoutube: def __init__(self, guid: PlexGuid): self.guid = guid + @property + def id(self): + return self.guid.id.split("|")[1] + @property def link(self): return None From f9cac55f9b366eeea4805058d7b7c619c51048c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 30 Dec 2024 20:26:21 +0200 Subject: [PATCH 4/5] Implement youtube link property --- plextraktsync/plex/PlexGuidProviderYoutube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plextraktsync/plex/PlexGuidProviderYoutube.py b/plextraktsync/plex/PlexGuidProviderYoutube.py index 13c3a922be..199d85eed6 100644 --- a/plextraktsync/plex/PlexGuidProviderYoutube.py +++ b/plextraktsync/plex/PlexGuidProviderYoutube.py @@ -16,7 +16,7 @@ def id(self): @property def link(self): - return None + return f"https://www.youtube.com/watch?v={self.id}" @property def title(self): From b57d78b393196c8e3097d4b1085cd72960e2b5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 30 Dec 2024 20:26:32 +0200 Subject: [PATCH 5/5] Implement youtube title property --- plextraktsync/plex/PlexGuidProviderYoutube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plextraktsync/plex/PlexGuidProviderYoutube.py b/plextraktsync/plex/PlexGuidProviderYoutube.py index 199d85eed6..1ed1e94907 100644 --- a/plextraktsync/plex/PlexGuidProviderYoutube.py +++ b/plextraktsync/plex/PlexGuidProviderYoutube.py @@ -20,4 +20,4 @@ def link(self): @property def title(self): - return f"{self.guid.provider}:{self.guid.type}:{self.guid.id}" + return f"{self.guid.provider}:{self.guid.type}:{self.id}"