rough implementation of start of cli

This commit is contained in:
Hellow2 2023-02-09 15:05:49 +01:00
parent bf5d0458ca
commit c3db4df70b
2 changed files with 17 additions and 7 deletions

View File

@ -59,7 +59,6 @@ def get_options_from_query(query: str) -> List[MusicObject]:
return options
def get_options_from_option(option: MusicObject) -> List[MusicObject]:
print("fetching", option)
for MetadataPage in pages.MetadataPages:
option = MetadataPage.fetch_details(option, flat=False)
return option.get_options()
@ -71,7 +70,7 @@ def cli():
options = []
while True:
command: str = input(">> ")
command: str = input(">> ").strip()
if command.isdigit():
option_index = int(command)

View File

@ -275,6 +275,9 @@ class EncyclopaediaMetallum(Page):
soup = BeautifulSoup(r.text, 'html.parser')
if soup.find("span",{"id": "noLinks"}) is not None:
return artist
artist_source = soup.find("div", {"id": "band_links_Official"})
"""
TODO
@ -333,6 +336,8 @@ class EncyclopaediaMetallum(Page):
"""
if "Formed in:" == title_text:
if not data.text.isnumeric():
continue
formed_in_year = int(data.text)
artist.formed_in = ID3Timestamp(year=formed_in_year)
continue
@ -346,7 +351,10 @@ class EncyclopaediaMetallum(Page):
continue
if "Current label:" == title_text:
label_name = data.text
label_url = data.find("a").get("href")
label_anchor = data.find("a")
label_url = None
if label_anchor is not None:
label_url = label_anchor.get("href")
for album in artist.main_albums:
if album.label is not None:
@ -449,7 +457,10 @@ class EncyclopaediaMetallum(Page):
title = row_list[1].text.strip()
length = None
duration_stamp = row_list[2].text
if ":" in duration_stamp:
minutes, seconds = duration_stamp.split(":")
length = (int(minutes) * 60 + int(seconds))*1000 # in milliseconds
@ -457,6 +468,7 @@ class EncyclopaediaMetallum(Page):
if track is not None:
track.add_source(Source(cls.SOURCE_TYPE, track_id))
if length is not None:
track.length = length
track.tracksort = track_sort
continue
@ -472,7 +484,6 @@ class EncyclopaediaMetallum(Page):
]
)
print(track)
album.tracklist.append(track)
return album