eonpatapon / mpDris2

MPRIS V2.1 support for mpd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mpDris2 crashes if mutagen can't read the file

Azenet opened this issue · comments

Hi,

mpDris2 crashes if mutagen is present but cannot read the file and does not throw a MutagenError exception:

Traceback (most recent call last):
  File "/usr/bin/mpDris2", line 1480, in <module>
    mpd_wrapper.run()
  File "/usr/bin/mpDris2", line 291, in run
    if self.my_connect():
  File "/usr/bin/mpDris2", line 366, in my_connect
    self.timer_callback()
  File "/usr/bin/mpDris2", line 454, in timer_callback
    self._update_properties(force=False)
  File "/usr/bin/mpDris2", line 758, in _update_properties
    self.update_metadata()
  File "/usr/bin/mpDris2", line 580, in update_metadata
    cover = self.find_cover(song_url)
  File "/usr/bin/mpDris2", line 643, in find_cover
    if song.tags:
AttributeError: 'NoneType' object has no attribute 'tags'

#107 is similar but the fix in e3bdb9e only catches explicit mutagen errors, I assume. I'm using mutagen 1.43.0.

Sigh, I thought mutagen.File was a class constructor but it's a function?

Please test master.

It works, thank you.