From aa680dadc2ec404683e0b8fee44c62ff0039fe04 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Fri, 7 Apr 2023 14:16:11 -0400 Subject: [PATCH] Lint and add length+genre to song info in search --- c3dbdl/c3dbdl.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/c3dbdl/c3dbdl.py b/c3dbdl/c3dbdl.py index 8bbd27d..1993b7b 100755 --- a/c3dbdl/c3dbdl.py +++ b/c3dbdl/c3dbdl.py @@ -595,7 +595,7 @@ def download(_filters, _id, _desc, _limit, _file_structure): filter_field = information_filter[0].lower() filter_value = information_filter[1].lower() if re.match("^~", filter_value): - filter_value = filter_value.replace('~', '') + filter_value = filter_value.replace("~", "") if filter_value in song[filter_field].lower(): pending_information_filters.append(True) else: @@ -618,7 +618,7 @@ def download(_filters, _id, _desc, _limit, _file_structure): pending_instrument_filters = list() for instrument_filter in song_instrument_filters: 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: pending_instrument_filters.append(True) else: @@ -635,7 +635,9 @@ def download(_filters, _id, _desc, _limit, _file_structure): else: 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: pending_songs.append(song) @@ -749,7 +751,7 @@ def search(_filters): filter_field = information_filter[0].lower() filter_value = information_filter[1].lower() if re.match("^~", filter_value): - filter_value = filter_value.replace('~', '') + filter_value = filter_value.replace("~", "") if filter_value in song[filter_field].lower(): pending_information_filters.append(True) else: @@ -772,7 +774,7 @@ def search(_filters): pending_instrument_filters = list() for instrument_filter in song_instrument_filters: 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: pending_instrument_filters.append(True) else: @@ -789,7 +791,9 @@ def search(_filters): else: 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: pending_songs.append(song) @@ -798,7 +802,7 @@ def search(_filters): click.echo() for entry in pending_songs: 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() @@ -807,10 +811,8 @@ def search(_filters): click.echo( f""" Instruments: {', '.join(instrument_list)}""", ) - - click.echo( - f""" Available downloads:""" - ) + + click.echo(""" Available downloads:""") for link in entry["dl_links"]: click.echo(f""" * {link['description']}""") click.echo()