diff --git a/mov_cli/cli/__main__.py b/mov_cli/cli/__main__.py index 2d8a2ad1..c4629517 100644 --- a/mov_cli/cli/__main__.py +++ b/mov_cli/cli/__main__.py @@ -51,7 +51,8 @@ def mov_cli( debug = debug, player = player, scraper = (scraper, ["scrapers", "default"]), - fzf = (fzf, ["ui", "fzf"]) + fzf = (fzf, ["ui", "fzf"]), + limit = limit ) if config.debug: @@ -101,7 +102,7 @@ def mov_cli( chosen_scraper = use_scraper(selected_scraper, config, http_client) - choice = search(query, auto_select, chosen_scraper, config.fzf_enabled, limit) + choice = search(query, auto_select, chosen_scraper, config.fzf_enabled, config.limit) if choice is None: mov_cli_logger.error("There was no results or you didn't select anything.") diff --git a/mov_cli/cli/play.py b/mov_cli/cli/play.py index edb412a1..c39f038e 100644 --- a/mov_cli/cli/play.py +++ b/mov_cli/cli/play.py @@ -33,9 +33,11 @@ def play(media: Media, metadata: Metadata, scraper: Scraper, episode: EpisodeSel episode_details_string = f"episode {episode_string} in season {season_string} of " if episode.season > 1 else f"episode {episode_string} of " + media_quality = Colours.GREEN.apply(f"{media.quality.name}") + mov_cli_logger.info( - f"Playing {episode_details_string}'{Colours.BLUE.apply(media.title)}' " \ - f"with {chosen_player.display_name}..." + f"Playing {episode_details_string}'{Colours.BLUE.apply(media.title)}' in {Colours.GREEN.apply(media.quality.name)} quality " \ + f"with {chosen_player.display_name}..." ) mov_cli_logger.debug(f"Streaming with this url -> '{hide_ip(media.url, config)}'") diff --git a/mov_cli/config.py b/mov_cli/config.py index 6dc383a7..9492f67a 100644 --- a/mov_cli/config.py +++ b/mov_cli/config.py @@ -266,6 +266,10 @@ def resolution(self) -> Quality: def watch_options(self) -> bool: return self.data.get("ui", {}).get("watch_options", True) + @property + def limit(self) -> int | None: + return self.data.get("ui", {}).get("limit") + @property def language(self) -> Lang: language = self.data.get("subtitle", {}).get("language", "en") diff --git a/mov_cli/config.template.toml b/mov_cli/config.template.toml index 0e4dfdcb..20a09212 100644 --- a/mov_cli/config.template.toml +++ b/mov_cli/config.template.toml @@ -16,6 +16,7 @@ hide_ip = true # [mov-cli.ui] # fzf = true # watch_options = true +# limit = 20 [mov-cli.plugins] # E.g: namespace = "package-name" test = "mov-cli-test" diff --git a/mov_cli/media/media.py b/mov_cli/media/media.py index 40af404f..8068e5a4 100644 --- a/mov_cli/media/media.py +++ b/mov_cli/media/media.py @@ -7,12 +7,12 @@ from abc import abstractmethod +from .quality import Quality + __all__ = ( "Media", "Multi", - "Single", - "Movie", - "Series" + "Single" ) class Media(): @@ -23,7 +23,8 @@ def __init__( title: str, audio_url: Optional[str], referrer: Optional[str], - subtitles: Optional[str] + subtitles: Optional[str], + quality: Quality ) -> None: self.url = url """The stream-able url of the media.""" @@ -35,6 +36,8 @@ def __init__( """The required referrer for streaming the media content.""" self.subtitles = subtitles """The url or file path to the subtitles.""" + self.quality = quality + """The selected quality of media.""" @property @abstractmethod @@ -45,13 +48,14 @@ def display_name(self) -> str: class Multi(Media): """Represents a media that has multiple episodes like a TV Series, Anime or Cartoon.""" def __init__( - self, - url: str, - title: str, - episode: EpisodeSelector, - audio_url: Optional[str] = None, - referrer: Optional[str] = None, - subtitles: Optional[str] = None + self, + url: str, + title: str, + episode: EpisodeSelector, + audio_url: Optional[str] = None, + referrer: Optional[str] = None, + subtitles: Optional[str] = None, + quality: Quality = Quality.AUTO ) -> None: self.episode = episode """The episode and season of this series.""" @@ -61,7 +65,8 @@ def __init__( title = title, audio_url = audio_url, referrer = referrer, - subtitles = subtitles + subtitles = subtitles, + quality = quality ) @property @@ -77,7 +82,8 @@ def __init__( audio_url: Optional[str] = None, referrer: Optional[str] = None, year: Optional[str] = None, - subtitles: Optional[str] = None + subtitles: Optional[str] = None, + quality: Quality = Quality.AUTO ) -> None: self.year = year """The year this film was released.""" @@ -87,15 +93,10 @@ def __init__( title = title, audio_url = audio_url, referrer = referrer, - subtitles = subtitles + subtitles = subtitles, + quality = quality ) @property def display_name(self) -> str: - return f"{self.title} ({self.year})" if self.year is not None else self.title - -# Backwards compatibility for post v4.3 extensions. -Series = Multi -"""DEPRECATED!!! USE 'Multi' INSTEAD! This will be removed after v4.4 and WILL cause hard crashes.""" -Movie = Single -"""DEPRECATED!!! USE 'Single' INSTEAD! This will be removed after v4.4 and WILL cause hard crashes.""" \ No newline at end of file + return f"{self.title} ({self.year})" if self.year is not None else self.title \ No newline at end of file