Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plextraktsync/media/MediaFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from plextraktsync.media.Media import Media

if TYPE_CHECKING:
from plextraktsync.plex.guid.PlexGuid import PlexGuid
from plextraktsync.plex.PlexApi import PlexApi
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.PlexLibraryItem import PlexLibraryItem
from plextraktsync.trakt.TraktApi import TraktApi
from plextraktsync.trakt.TraktItem import TraktItem
Expand Down
2 changes: 1 addition & 1 deletion plextraktsync/plan/Walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from plextraktsync.decorators.measure_time import measure_time
from plextraktsync.factory import logging
from plextraktsync.mixin.SetWindowTitle import SetWindowTitle
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid
from plextraktsync.plex.PlexLibraryItem import PlexLibraryItem
from plextraktsync.trakt.TraktApi import TraktApi
from plextraktsync.trakt.TraktItem import TraktItem
Expand Down
2 changes: 1 addition & 1 deletion plextraktsync/plex/PlexApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def search_by_guid(self, guids: dict, libtype: str):
fetchItem(ekey, guid__id__regex=r"(imdb|tmdb|tvdb)://")
"""

from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid

# Build regex of possible matches
keys = "|".join(guids.keys())
Expand Down
32 changes: 0 additions & 32 deletions plextraktsync/plex/PlexGuidProvider.py

This file was deleted.

2 changes: 1 addition & 1 deletion plextraktsync/plex/PlexLibraryItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from plextraktsync.decorators.retry import retry
from plextraktsync.factory import factory
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid
from plextraktsync.rich.RichMarkup import RichMarkup
from plextraktsync.util.Rating import Rating

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
from typing import TYPE_CHECKING

from plextraktsync.factory import factory
from plextraktsync.plex.PlexGuidProvider import PlexGuidProvider
from plextraktsync.rich.RichMarkup import RichMarkup

from .provider.Factory import Factory as GuidProviderFactory

if TYPE_CHECKING:
from plextraktsync.plex.PlexLibraryItem import PlexLibraryItem

Expand Down Expand Up @@ -108,7 +109,7 @@ def title_link(self):

@property
def provider_link(self):
provider = PlexGuidProvider().create(self)
provider = GuidProviderFactory().create(self)
link = provider.link

if not link:
Expand Down
32 changes: 32 additions & 0 deletions plextraktsync/plex/guid/provider/Factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from __future__ import annotations

from typing import TYPE_CHECKING

from .IMDB import IMDB
from .Local import Local
from .Mbid import Mbid
from .TMDB import TMDB
from .TVDB import TVDB
from .Youtube import Youtube

if TYPE_CHECKING:
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class Factory:
@classmethod
def create(cls, guid: PlexGuid):
if guid.provider == "imdb":
return IMDB(guid)
if guid.provider == "tmdb":
return TMDB(guid)
if guid.provider == "tvdb":
return TVDB(guid)
if guid.provider == "mbid":
return Mbid(guid)
if guid.provider == "youtube":
return Youtube(guid)
if guid.provider in ["local", "none"]:
return Local(guid)

raise RuntimeError(f"Unsupported provider: {guid.provider}")
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class PlexGuidProviderIMDB:
class IMDB:
def __init__(self, guid: PlexGuid):
self.guid = guid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class PlexGuidProviderLocal:
class Local:
def __init__(self, guid: PlexGuid):
self.guid = guid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class PlexGuidProviderMbid:
class Mbid:
def __init__(self, guid: PlexGuid):
self.guid = guid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class PlexGuidProviderTMDB:
class TMDB:
url = "https://www.themoviedb.org"

def __init__(self, guid: PlexGuid):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class PlexGuidProviderTVDB:
class TVDB:
def __init__(self, guid: PlexGuid):
self.guid = guid

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class PlexGuidProviderYoutube:
class Youtube:
def __init__(self, guid: PlexGuid):
self.guid = guid

Expand Down
2 changes: 1 addition & 1 deletion plextraktsync/trakt/TraktApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from trakt.movies import Movie
from trakt.tv import TVEpisode, TVShow

from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid
from plextraktsync.plex.PlexLibraryItem import PlexLibraryItem
from plextraktsync.trakt.types import TraktLikedList, TraktMedia

Expand Down
2 changes: 1 addition & 1 deletion plextraktsync/trakt/TraktLookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if TYPE_CHECKING:
from trakt.tv import TVEpisode, TVShow

from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid


class TraktLookup:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ packages = [
"plextraktsync.factory",
"plextraktsync.plan",
"plextraktsync.plex",
"plextraktsync.plex.guid",
"plextraktsync.plex.guid.provider",
"plextraktsync.plugin",
"plextraktsync.queue",
"plextraktsync.rich",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tv_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
from trakt.tv import TVShow

from plextraktsync.plex.PlexGuid import PlexGuid
from plextraktsync.plex.guid.PlexGuid import PlexGuid
from plextraktsync.plex.PlexLibraryItem import PlexLibraryItem
from plextraktsync.trakt.TraktLookup import TraktLookup
from tests.conftest import factory, make
Expand Down