mirror of
https://github.com/shadoll/moma.git
synced 2026-08-28 11:33:25 +00:00
Add TMDBExtractor class for movie information extraction
- Implement TMDBExtractor to fetch movie details from The Movie Database (TMDB) API. - Include caching mechanism for API responses to reduce redundant requests. - Extract movie database ID from filenames using regex patterns. - Add methods to extract TMDB ID, title, original title, release year, and TMDB URL. - Create secrets.py to store TMDB API key and access token. - Add a sample MKV file for testing purposes.
This commit is contained in:
@@ -100,4 +100,19 @@ class TextFormatter:
|
||||
|
||||
@staticmethod
|
||||
def dim(text: str) -> str:
|
||||
return f"[dim]{text}[/dim]"
|
||||
return f"[dim]{text}[/dim]"
|
||||
|
||||
@staticmethod
|
||||
def link(url: str, text: str | None = None) -> str:
|
||||
"""Create a clickable link. If text is None, uses the URL as text."""
|
||||
if text is None:
|
||||
text = url
|
||||
return f"[link={url}]{text}[/link]"
|
||||
|
||||
@staticmethod
|
||||
def format_url(url: str) -> str:
|
||||
"""Format a URL as a clickable link using OSC 8 if it's a valid URL, otherwise return as-is."""
|
||||
if url and url != "<None>" and url.startswith("http"):
|
||||
# Use OSC 8 hyperlink escape sequence for clickable links
|
||||
return f"\x1b]8;;{url}\x1b\\Open in TMDB\x1b]8;;\x1b\\"
|
||||
return url
|
||||
Reference in New Issue
Block a user