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:
parent
5976c3fe3d
commit
e1729fed05
1 changed files with 6 additions and 1 deletions
|
@ -121,9 +121,14 @@ def get_audio_from_item(item):
|
||||||
duration_parts = item.findtext("duration").split(":")
|
duration_parts = item.findtext("duration").split(":")
|
||||||
total_seconds = 0
|
total_seconds = 0
|
||||||
for i, num in enumerate(reversed(duration_parts)):
|
for i, num in enumerate(reversed(duration_parts)):
|
||||||
total_seconds += int(num) * (60 ** i)
|
total_seconds += int(float(num)) * (60 ** i)
|
||||||
if total_seconds:
|
if total_seconds:
|
||||||
audio_args["duration"] = 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)
|
return Audio(url, **audio_args)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue