-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
62 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +0,0 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from sachi.sources.tvdb import TVDBSource | ||
|
||
if TYPE_CHECKING: | ||
from sachi.sources.base import SachiSource | ||
|
||
|
||
SOURCE_CLASSES: list[type["SachiSource"]] = [ | ||
TVDBSource, | ||
] | ||
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import re | ||
|
||
from sachi.sources.base import ( | ||
MediaType, | ||
SachiEpisodeModel, | ||
SachiParentModel, | ||
SachiSource, | ||
) | ||
|
||
INPUT_RE = re.compile(r"(?P<title>.+?)(?: \((?P<year>\d+)\))?$") | ||
|
||
|
||
class CustomMovieSource( | ||
SachiSource[None], media_type=MediaType.MOVIE, service="Custom" | ||
): | ||
async def search(self, query: str) -> list[SachiParentModel[None]]: | ||
qmatch = INPUT_RE.match(query) | ||
if qmatch is None: | ||
return [] | ||
groups = qmatch.groupdict() | ||
return [ | ||
SachiParentModel( | ||
media_type=MediaType.MOVIE, | ||
ref_id=None, | ||
title=groups["title"], | ||
year=int(groups["year"]) if groups["year"] else None, | ||
) | ||
] | ||
|
||
async def get_episodes( | ||
self, parent: SachiParentModel[None] | ||
) -> list[SachiEpisodeModel[None]]: | ||
return [SachiEpisodeModel(ref_id=None, season=0, episode=0)] |
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