diff --git a/documentation/shell.md b/documentation/shell.md index de72743..31da1a3 100644 --- a/documentation/shell.md +++ b/documentation/shell.md @@ -10,7 +10,7 @@ > s: r: #a an Artist #r some random Release ``` -Searches for an url, or an query +Searches for an url, or a query ### Query Syntax @@ -33,6 +33,10 @@ To download something, you either need a direct link, or you need to have alread > d: https://musify.club/release/some-random-release-183028492 ``` +## Results + +If options are printed in **bold** they can be downloaded. Else they may or maybe can't be downloaded + ## Misc ### Exit diff --git a/src/music_kraken/cli/main_downloader.py b/src/music_kraken/cli/main_downloader.py index c18aa8f..a7bf5a4 100644 --- a/src/music_kraken/cli/main_downloader.py +++ b/src/music_kraken/cli/main_downloader.py @@ -173,7 +173,8 @@ class Downloader: page_count = 0 for option in self.current_results.formated_generator(max_items_per_page=self.max_displayed_options): if isinstance(option, Option): - print(f"{option.index:0{self.option_digits}} {option.music_object.option_string}") + color = BColors.BOLD if self.pages.is_downloadable(option.music_object) else BColors.ENDC + print(f"{color}{option.index:0{self.option_digits}} {option.music_object.option_string}{BColors.ENDC}") else: prefix = ALPHABET[page_count % len(ALPHABET)] print( diff --git a/src/music_kraken/download/page_attributes.py b/src/music_kraken/download/page_attributes.py index 27ae19c..e3881f6 100644 --- a/src/music_kraken/download/page_attributes.py +++ b/src/music_kraken/download/page_attributes.py @@ -94,6 +94,15 @@ class Pages: music_object.merge(self._page_instances[page_type].fetch_details(music_object=music_object, stop_at_level=stop_at_level)) return music_object + + def is_downloadable(self, music_object: DatabaseObject) -> bool: + _page_types = set(self._source_to_page) + for src in music_object.source_collection.source_pages: + if src in self._source_to_page: + _page_types.add(self._source_to_page[src]) + + audio_pages = self._audio_pages_set.intersection(_page_types) + return len(audio_pages) > 0 def download(self, music_object: DatabaseObject, genre: str, download_all: bool = False, process_metadata_anyway: bool = False) -> DownloadResult: if not isinstance(music_object, INDEPENDENT_DB_OBJECTS): diff --git a/src/music_kraken/utils/enums/colors.py b/src/music_kraken/utils/enums/colors.py index 61fe1e4..6c23cc1 100644 --- a/src/music_kraken/utils/enums/colors.py +++ b/src/music_kraken/utils/enums/colors.py @@ -11,4 +11,4 @@ class BColors: FAIL = "\033[91m" ENDC = "\033[0m" BOLD = "\033[1m" - UNDERLINE = "\033[4m" \ No newline at end of file + UNDERLINE = "\033[4m"