reformat
This commit is contained in:
parent
6e17758826
commit
8b10b4e4ca
@ -6,12 +6,13 @@ from ...objects import Song, Album, Artist, Label, Source
|
|||||||
|
|
||||||
MusicObject = Union[Song, Album, Artist, Label]
|
MusicObject = Union[Song, Album, Artist, Label]
|
||||||
|
|
||||||
|
|
||||||
class Download:
|
class Download:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
pages: Tuple[Type[Page]] = page_attributes.ALL_PAGES,
|
pages: Tuple[Type[Page]] = page_attributes.ALL_PAGES,
|
||||||
exclude_pages: Set[Type[Page]] = set(),
|
exclude_pages: Set[Type[Page]] = set(),
|
||||||
exclude_shady: bool = False,
|
exclude_shady: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
_page_list: List[Type[Page]] = []
|
_page_list: List[Type[Page]] = []
|
||||||
_audio_page_list: List[Type[Page]] = []
|
_audio_page_list: List[Type[Page]] = []
|
||||||
@ -29,7 +30,7 @@ class Download:
|
|||||||
|
|
||||||
self.pages: Tuple[Type[Page]] = tuple(_page_list)
|
self.pages: Tuple[Type[Page]] = tuple(_page_list)
|
||||||
self.audio_pages: Tuple[Type[Page]] = tuple(_audio_page_list)
|
self.audio_pages: Tuple[Type[Page]] = tuple(_audio_page_list)
|
||||||
|
|
||||||
def fetch_details(self, music_object: MusicObject) -> MusicObject:
|
def fetch_details(self, music_object: MusicObject) -> MusicObject:
|
||||||
for page in self.pages:
|
for page in self.pages:
|
||||||
page.fetch_details(music_object=music_object)
|
page.fetch_details(music_object=music_object)
|
||||||
@ -37,10 +38,8 @@ class Download:
|
|||||||
|
|
||||||
def fetch_source(self, source: Source) -> Optional[MusicObject]:
|
def fetch_source(self, source: Source) -> Optional[MusicObject]:
|
||||||
source_page = page_attributes.SOURCE_PAGE_MAP[source.page_enum]
|
source_page = page_attributes.SOURCE_PAGE_MAP[source.page_enum]
|
||||||
|
|
||||||
if source_page not in self.pages:
|
if source_page not in self.pages:
|
||||||
return
|
return
|
||||||
|
|
||||||
return source_page.fetch_object_from_source(source)
|
return source_page.fetch_object_from_source(source)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user