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

tag_data.get('TALB').text[0] --> 'NoneType' object has no attribute 'text' (Books without ID3 "Album") #10

Closed
balthisar opened this issue Aug 1, 2024 · 1 comment

Comments

@balthisar
Copy link

Sonus doesn't handle Overdrive audiobooks that are missing the ID3 TALB ("album") attribute:

  File "/Users/jderry/Development/sonus/sonus/chapterizer.py", line 153, in merge_chapter_parts
    title = tag_data.get('TALB').text[0]
            ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'text'

I'm not sure if this is related to #7 or not, but the error is the same. The workaround is to use sonus to download (only) the book, and then add the Album attribute with a tagger such as Kid3, and then point sonus at the downloaded files for chapterization.

As an alternative, you can modify your rlocal copy of chapterizer.py line 153 with the following:

            if title_raw := tag_data.get('TALB'):
                title = title_raw.text[0]
            else:
                title = 'Album Missing'

Sorry for not posting this as a PR, but this is a stopgap solution, and @digitalec might want to handle it somewhere in code or with a more Pythonesque style.

A book that demonstrates the failure mode is Wastelands by John Joseph Adams (editor), title number 1580350 on Overdrive.

@digitalec
Copy link
Owner

Thanks for the info. I haven't had much time to get around to fixing this relatively minor bug but it has been patched! Closing this as a duplicate of #7.

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

2 participants