From 097211b3cda5ae18ced5a91603f70e2d8acf621f Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 12 Jun 2024 14:42:08 +0200 Subject: [PATCH] feat: commented the download function --- music_kraken/download/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/music_kraken/download/__init__.py b/music_kraken/download/__init__.py index 0eadffc..99ff41d 100644 --- a/music_kraken/download/__init__.py +++ b/music_kraken/download/__init__.py @@ -226,6 +226,14 @@ class Downloader: return self.fetch_from_source(source=source) 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 not self.download_options.download_all and data_object.album_type in self.download_options.album_type_blacklist: return True @@ -233,6 +241,18 @@ class Downloader: return False 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 self.fetch_details(data_object) output(f"\nDownloading {data_object.option_string}...", color=BColors.BOLD)