filter duration: workaround on mutagen bugs
sometimes mutagen cannot determine audio file length. This doesn't lead to exceptions, but to eventuduration being estimated as 0. This is now considered an error. In that case, the audio file is played.
This commit is contained in:
parent
db8b555233
commit
76ffb69dbf
1 changed files with 3 additions and 0 deletions
|
@ -64,6 +64,9 @@ def percentwait(songs, context, conf, getdur=get_duration):
|
||||||
continue
|
continue
|
||||||
eventduration += songduration
|
eventduration += songduration
|
||||||
|
|
||||||
|
if eventduration == 0:
|
||||||
|
# must be an error! mutagen support is not always perfect
|
||||||
|
return True, 'mutagen could not calculate length of %s' % uri
|
||||||
wait = eventduration * (percentwait / 100.0)
|
wait = eventduration * (percentwait / 100.0)
|
||||||
if remaining > wait:
|
if remaining > wait:
|
||||||
return False, "remaining %d max allowed %d" % (remaining, wait)
|
return False, "remaining %d max allowed %d" % (remaining, wait)
|
||||||
|
|
Loading…
Reference in a new issue