artcom-net / mp3-tagger

ID3 data editor
MIT License
35 stars 16 forks source link

AttributeError: 'NoneType' object has no attribute 'group' #12

Open wodim opened 4 years ago

wodim commented 4 years ago

When using get_tags on this mp3 file.

GB89-128 Voodoo Ray - A Guy Called Gerald.zip

Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\id3.py", line 178, in _unpack_bytes
    val = int(val)
ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sorter.py", line 41, in <module>
    mp3s[file] = mp3.get_tags()
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\mp3.py", line 141, in get_tags
    tmp_dict[tag.title] = tag.value
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\id3.py", line 40, in value
    val = self._unpack_bytes()
  File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\mp3_tagger\id3.py", line 183, in _unpack_bytes
    val = int(re.search(r'\d+', val).group(0))
AttributeError: 'NoneType' object has no attribute 'group'
ohnekopf commented 3 years ago

i have pretty much the same issue on ubuntu. thanfully i can still edit tags, it's just get_tags that doesn't work

TheBengineer commented 3 years ago

Change line 176 in id3.py from

    if self.title == 'genre':

to

    if self.title == 'genre' and len(val):

It's crashing when val is empty.

TheBengineer commented 3 years ago

Added a pull here: https://github.com/artcom-net/mp3-tagger/pull/13

kk-hiraskar commented 3 years ago

Change line 176 in id3.py from

    if self.title == 'genre':

to

    if self.title == 'genre' and len(val):

It's crashing when val is empty.

This will handle only if genre is empty.. what about if it is having string instead of integer?

I am having many mp3 files, where genre is with some other strings.

kk-hiraskar commented 3 years ago

Already issue is fixed and committed: fix diff

please release it on https://pypi.org/project/mp3-tagger/