update xl serialzer

This commit is contained in:
stubbfel
2014-08-28 21:29:47 +02:00
parent 3eeeeffdd8
commit 56c128dc6d
3 changed files with 133 additions and 67 deletions

View File

@@ -24,14 +24,21 @@ class PodcastSerializer(Serializer):
for episode in dict_object["entries"]:
filelink = ""
file_length = ""
for links in episode["links"]:
if links["type"] == self.episode_file_type:
if links["type"] == self.episode_file_type and links["rel"] == "enclosure":
filelink = links["href"]
file_length = links["length"]
if filelink == "":
continue
tempepisode = {
"title": episode["title"],
"subtitle": episode["subtitle"],
"filelink": filelink
"filelink": filelink,
"pubdate": episode["published"],
"length": file_length
}
episodeList.append(tempepisode)
@@ -54,8 +61,9 @@ class PodcastSerializer(Serializer):
episodes_list += "<item>"
episodes_list += "<title>" + episode["title"] + "</title>"
episodes_list += "<description>" + episode["subtitle"] + "</description>"
episodes_list += "<enclosure url=\"" + episode["filelink"] + "\" type=\"" + self.episode_file_type + "\" length=\"26770243\"/>"
episodes_list += "<pubDate>" + episode["pubdate"] + "</pubDate>"
episodes_list += "<enclosure url=\"" + episode["filelink"] + "\" type=\"" + self.episode_file_type + "\" length=\"" + episode["length"] + "\"/>"
episodes_list += "</item>"
return RSS_Prefix + rss_channel_info + episodes_list + RSS_Suffix
return RSS_Prefix + rss_channel_info + episodes_list + RSS_Suffix