Open dakeryas opened 1 year ago
The get_group_title function fails when the performers or albums are empty.
get_group_title
writing log to /Users/me/Downloads/dr.txt Traceback (most recent call last): File "/Users/me/Software/simple_dr_meter/./main.py", line 268, in <module> main() File "/Users/me/Software/simple_dr_meter/./main.py", line 145, in main write_log(f.write, dr_log_items, dr_mean) File "/Users/me/Software/simple_dr_meter/./main.py", line 54, in write_log group_name = get_group_title(group) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/me/Software/simple_dr_meter/./main.py", line 35, in get_group_title return f'{", ".join(group.performers)} — {", ".join(group.albums)}' ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: sequence item 0: expected str instance, NoneType found
Perhaps a patch like the following one would be good enough:
def get_group_title(group: LogGroup): - return f'{", ".join(group.performers)} — {", ".join(group.albums)}' + if not (group.performers is None or group.albums is None): + return f'{", ".join(group.performers)} — {", ".join(group.albums)}' + return ""
The
get_group_title
function fails when the performers or albums are empty.Perhaps a patch like the following one would be good enough: