fix podcast serialser and cgi server start
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
__author__ = 'dev'
|
||||
|
||||
Config = {
|
||||
"FeedLinkTypes" : {"audio/mpeg","application/x-bittorrent", "audio/opus"},
|
||||
"FeedLinkTypes" : {"audio/mpeg","application/x-bittorrent", "audio/opus", "audio/x-mp3", "audio/x-opus"},
|
||||
"FeedTypes" : {"podcast","rss"},
|
||||
"FeedStorageFolder" : "testfeeds",
|
||||
"FeedStorageFolder" : "feeds",
|
||||
"FeedStoragePrefix" : { "0" : "FeedType", "1" : "FeedName"},
|
||||
"ConfigFileSuffix" : "-config",
|
||||
"ConfigFileExtension" : ".json",
|
||||
"TorrentStorageFolder": "testtorrents",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ def runServer(workingDir, serverAddress=('',8080)):
|
||||
for file in glob.glob('*.py'):
|
||||
os.chmod(file, stat.S_IXUSR | stat.S_IWUSR | stat.S_IRUSR)
|
||||
|
||||
os.chdir('..')
|
||||
os.chdir(workingDir)
|
||||
server = HTTPServer(serverAddress, CGIHTTPRequestHandler)
|
||||
server.serve_forever()
|
||||
server.serve_forever()
|
||||
|
||||
@@ -42,7 +42,8 @@ page = '''Content-Type: text/html
|
||||
<li><audio src="../{MyLinkUrl}" controls preload="auto"></audio></li>
|
||||
<li>MyLink: <a href="../{MyLinkUrl}" target="_blank">{MyLinkUrl}</a></li>
|
||||
<li>OriginLink: <a href="{OriginEpisodeUrl}" target="_blank">{OriginEpisodeUrl}</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>'''.format(FeedName=feedName, EpisodeTitle=episodeTitle, OriginEpisodeUrl=originLink, MyLinkUrl=mylink)
|
||||
|
||||
print(page)
|
||||
print(page)
|
||||
|
||||
@@ -33,15 +33,19 @@ class PodcastSerializer(Serializer):
|
||||
|
||||
if file_link == "":
|
||||
continue
|
||||
|
||||
temp_episode = {
|
||||
"title": episode["title"],
|
||||
"subtitle": episode["subtitle"],
|
||||
"file_link": file_link,
|
||||
"pubdate": episode["published"],
|
||||
"length": file_length
|
||||
}
|
||||
episode_list.append(temp_episode)
|
||||
try :
|
||||
temp_episode = {
|
||||
"title": episode["title"],
|
||||
"subtitle": "",
|
||||
"file_link": file_link,
|
||||
"pubdate": episode["published"],
|
||||
"length": file_length
|
||||
}
|
||||
if episode.has_key('subtitle'):
|
||||
temp_episode["subtitle"] = episode["subtitle"]
|
||||
episode_list.append(temp_episode)
|
||||
except:
|
||||
pass
|
||||
|
||||
temp_dict = {
|
||||
"title": dict_object["feed"]["title"],
|
||||
@@ -67,4 +71,3 @@ class PodcastSerializer(Serializer):
|
||||
episodes_list += "</item>"
|
||||
|
||||
return RSS_Prefix + rss_channel_info + episodes_list + RSS_Suffix
|
||||
|
||||
|
||||
Reference in New Issue
Block a user