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
|
> 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
|
### 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
|
> 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
|
## Misc
|
||||||
|
|
||||||
### Exit
|
### Exit
|
||||||
|
@ -173,7 +173,8 @@ class Downloader:
|
|||||||
page_count = 0
|
page_count = 0
|
||||||
for option in self.current_results.formated_generator(max_items_per_page=self.max_displayed_options):
|
for option in self.current_results.formated_generator(max_items_per_page=self.max_displayed_options):
|
||||||
if isinstance(option, Option):
|
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:
|
else:
|
||||||
prefix = ALPHABET[page_count % len(ALPHABET)]
|
prefix = ALPHABET[page_count % len(ALPHABET)]
|
||||||
print(
|
print(
|
||||||
|
@ -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))
|
music_object.merge(self._page_instances[page_type].fetch_details(music_object=music_object, stop_at_level=stop_at_level))
|
||||||
|
|
||||||
return music_object
|
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:
|
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):
|
if not isinstance(music_object, INDEPENDENT_DB_OBJECTS):
|
||||||
|
@ -11,4 +11,4 @@ class BColors:
|
|||||||
FAIL = "\033[91m"
|
FAIL = "\033[91m"
|
||||||
ENDC = "\033[0m"
|
ENDC = "\033[0m"
|
||||||
BOLD = "\033[1m"
|
BOLD = "\033[1m"
|
||||||
UNDERLINE = "\033[4m"
|
UNDERLINE = "\033[4m"
|
||||||
|
Loading…
Reference in New Issue
Block a user