Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not handle files with empty tags #10

Open
dakeryas opened this issue Mar 11, 2023 · 0 comments
Open

Does not handle files with empty tags #10

dakeryas opened this issue Mar 11, 2023 · 0 comments

Comments

@dakeryas
Copy link

The get_group_title function fails when the performers or albums are empty.

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 ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant