Lint and add length+genre to song info in search
This commit is contained in:
parent
61b4d0e429
commit
aa680dadc2
|
@ -595,7 +595,7 @@ def download(_filters, _id, _desc, _limit, _file_structure):
|
||||||
filter_field = information_filter[0].lower()
|
filter_field = information_filter[0].lower()
|
||||||
filter_value = information_filter[1].lower()
|
filter_value = information_filter[1].lower()
|
||||||
if re.match("^~", filter_value):
|
if re.match("^~", filter_value):
|
||||||
filter_value = filter_value.replace('~', '')
|
filter_value = filter_value.replace("~", "")
|
||||||
if filter_value in song[filter_field].lower():
|
if filter_value in song[filter_field].lower():
|
||||||
pending_information_filters.append(True)
|
pending_information_filters.append(True)
|
||||||
else:
|
else:
|
||||||
|
@ -618,7 +618,7 @@ def download(_filters, _id, _desc, _limit, _file_structure):
|
||||||
pending_instrument_filters = list()
|
pending_instrument_filters = list()
|
||||||
for instrument_filter in song_instrument_filters:
|
for instrument_filter in song_instrument_filters:
|
||||||
if re.match("^no-", instrument_filter):
|
if re.match("^no-", instrument_filter):
|
||||||
instrument_filter = instrument_filter.replace('no-', '')
|
instrument_filter = instrument_filter.replace("no-", "")
|
||||||
if song["instruments"][instrument_filter] is None:
|
if song["instruments"][instrument_filter] is None:
|
||||||
pending_instrument_filters.append(True)
|
pending_instrument_filters.append(True)
|
||||||
else:
|
else:
|
||||||
|
@ -635,7 +635,9 @@ def download(_filters, _id, _desc, _limit, _file_structure):
|
||||||
else:
|
else:
|
||||||
instrument_add_to_pending = True
|
instrument_add_to_pending = True
|
||||||
|
|
||||||
add_to_pending = all([information_add_to_pending, instrument_add_to_pending])
|
add_to_pending = all(
|
||||||
|
[information_add_to_pending, instrument_add_to_pending]
|
||||||
|
)
|
||||||
|
|
||||||
if add_to_pending:
|
if add_to_pending:
|
||||||
pending_songs.append(song)
|
pending_songs.append(song)
|
||||||
|
@ -749,7 +751,7 @@ def search(_filters):
|
||||||
filter_field = information_filter[0].lower()
|
filter_field = information_filter[0].lower()
|
||||||
filter_value = information_filter[1].lower()
|
filter_value = information_filter[1].lower()
|
||||||
if re.match("^~", filter_value):
|
if re.match("^~", filter_value):
|
||||||
filter_value = filter_value.replace('~', '')
|
filter_value = filter_value.replace("~", "")
|
||||||
if filter_value in song[filter_field].lower():
|
if filter_value in song[filter_field].lower():
|
||||||
pending_information_filters.append(True)
|
pending_information_filters.append(True)
|
||||||
else:
|
else:
|
||||||
|
@ -772,7 +774,7 @@ def search(_filters):
|
||||||
pending_instrument_filters = list()
|
pending_instrument_filters = list()
|
||||||
for instrument_filter in song_instrument_filters:
|
for instrument_filter in song_instrument_filters:
|
||||||
if re.match("^no-", instrument_filter):
|
if re.match("^no-", instrument_filter):
|
||||||
instrument_filter = instrument_filter.replace('no-', '')
|
instrument_filter = instrument_filter.replace("no-", "")
|
||||||
if song["instruments"][instrument_filter] is None:
|
if song["instruments"][instrument_filter] is None:
|
||||||
pending_instrument_filters.append(True)
|
pending_instrument_filters.append(True)
|
||||||
else:
|
else:
|
||||||
|
@ -789,7 +791,9 @@ def search(_filters):
|
||||||
else:
|
else:
|
||||||
instrument_add_to_pending = True
|
instrument_add_to_pending = True
|
||||||
|
|
||||||
add_to_pending = all([information_add_to_pending, instrument_add_to_pending])
|
add_to_pending = all(
|
||||||
|
[information_add_to_pending, instrument_add_to_pending]
|
||||||
|
)
|
||||||
|
|
||||||
if add_to_pending:
|
if add_to_pending:
|
||||||
pending_songs.append(song)
|
pending_songs.append(song)
|
||||||
|
@ -798,7 +802,7 @@ def search(_filters):
|
||||||
click.echo()
|
click.echo()
|
||||||
for entry in pending_songs:
|
for entry in pending_songs:
|
||||||
click.echo(
|
click.echo(
|
||||||
f"""> Song: "{entry['artist']} - {entry['title']}" from "{entry['album']} ({entry['year']})" by {entry['author']}"""
|
f"""> Song: "{entry['artist']} - {entry['title']}" ({entry['length']}, {entry['genre']}) from "{entry['album']} ({entry['year']})" by {entry['author']}"""
|
||||||
)
|
)
|
||||||
|
|
||||||
instrument_list = list()
|
instrument_list = list()
|
||||||
|
@ -807,10 +811,8 @@ def search(_filters):
|
||||||
click.echo(
|
click.echo(
|
||||||
f""" Instruments: {', '.join(instrument_list)}""",
|
f""" Instruments: {', '.join(instrument_list)}""",
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo(
|
click.echo(""" Available downloads:""")
|
||||||
f""" Available downloads:"""
|
|
||||||
)
|
|
||||||
for link in entry["dl_links"]:
|
for link in entry["dl_links"]:
|
||||||
click.echo(f""" * {link['description']}""")
|
click.echo(f""" * {link['description']}""")
|
||||||
click.echo()
|
click.echo()
|
||||||
|
|
Loading…
Reference in New Issue