feat: commented the download function
This commit is contained in:
parent
f839cdf906
commit
097211b3cd
@ -226,6 +226,14 @@ class Downloader:
|
|||||||
return self.fetch_from_source(source=source)
|
return self.fetch_from_source(source=source)
|
||||||
|
|
||||||
def _skip_object(self, data_object: DataObject) -> bool:
|
def _skip_object(self, data_object: DataObject) -> bool:
|
||||||
|
"""Determine if the given data object should be downloaded or not.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
data_object (DataObject): The data object in question.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: Returns True if the given data object should be skipped.
|
||||||
|
"""
|
||||||
if isinstance(data_object, Album):
|
if isinstance(data_object, Album):
|
||||||
if not self.download_options.download_all and data_object.album_type in self.download_options.album_type_blacklist:
|
if not self.download_options.download_all and data_object.album_type in self.download_options.album_type_blacklist:
|
||||||
return True
|
return True
|
||||||
@ -233,6 +241,18 @@ class Downloader:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def download(self, data_object: DataObject, genre: str, **kwargs) -> DownloadResult:
|
def download(self, data_object: DataObject, genre: str, **kwargs) -> DownloadResult:
|
||||||
|
"""Downloads the given data object.
|
||||||
|
It will recursively fetch all available details for this and every related object.
|
||||||
|
Then it will create the folder structure and download the audio file.
|
||||||
|
In the end the metadata will be written to the file.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
data_object (DataObject): The data object to download. If it is a artist, it will download the whole discography, if it is an Album it will download the whole Tracklist.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
DownloadResult: Relevant information about the download success.
|
||||||
|
"""
|
||||||
|
|
||||||
# fetch the given object
|
# fetch the given object
|
||||||
self.fetch_details(data_object)
|
self.fetch_details(data_object)
|
||||||
output(f"\nDownloading {data_object.option_string}...", color=BColors.BOLD)
|
output(f"\nDownloading {data_object.option_string}...", color=BColors.BOLD)
|
||||||
|
Loading…
Reference in New Issue
Block a user