Skip to content

Commit

Permalink
Merge pull request #2120 from glensc/PlexGuidProviderYoutube
Browse files Browse the repository at this point in the history
Feature: Add PlexGuidProviderYoutube provider
  • Loading branch information
glensc authored Dec 30, 2024
2 parents a1c133a + b57d78b commit dc01ea4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plextraktsync/plex/PlexGuidProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
23 changes: 23 additions & 0 deletions plextraktsync/plex/PlexGuidProviderYoutube.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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 id(self):
return self.guid.id.split("|")[1]

@property
def link(self):
return f"https://www.youtube.com/watch?v={self.id}"

@property
def title(self):
return f"{self.guid.provider}:{self.guid.type}:{self.id}"

0 comments on commit dc01ea4

Please sign in to comment.