feat: highlight downloadebel options
This commit is contained in:
parent
fd0d22b751
commit
b3ac152220
@ -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
|
||||
|
@ -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(
|
||||
|
@ -95,6 +95,15 @@ class Pages:
|
||||
|
||||
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):
|
||||
return DownloadResult(error_message=f"{type(music_object).__name__} can't be downloaded.")
|
||||
|
Loading…
Reference in New Issue
Block a user