podcast: better support for mRSS

they were already supported, but the duration tag was missed.
Now we look inside media:group, if available.
This commit is contained in:
boyska 2021-04-21 00:39:24 +02:00
parent 5976c3fe3d
commit e1729fed05

View file

@ -121,9 +121,14 @@ def get_audio_from_item(item):
duration_parts = item.findtext("duration").split(":")
total_seconds = 0
for i, num in enumerate(reversed(duration_parts)):
total_seconds += int(num) * (60 ** i)
total_seconds += int(float(num)) * (60 ** i)
if total_seconds:
audio_args["duration"] = total_seconds
else:
for child in item.xpath("group/content"):
if child.get("url") == url:
audio_args["duration"] = int(float(child.get("duration")))
break
return Audio(url, **audio_args)