Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dotrcbot committed Nov 29, 2020
1 parent bb224d6 commit d5b2b78
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions podcast.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from mutagen.mp4 import MP4

os.chdir("audio/")

xmlfile = '''<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
Expand Down Expand Up @@ -32,8 +34,6 @@
<itunes:explicit>no</itunes:explicit>
'''

os.chdir("audio/")

for file in sorted(os.listdir()):
if file.endswith('.m4a'):
statinfo = os.stat(file)
Expand All @@ -42,12 +42,14 @@
length = str(audio.info.length)

xmlfile += "<item>\n"
xmlfile += "<link>https://dotrcbot.github.io/</link>\n"
# xmlfile += "<link>https://dotrcbot.github.io/</link>\n"
xmlfile += "<title>{}</title>\n".format(file.split('.m4a')[0])
xmlfile += "<enclosure url='https://dotrcbot.github.io/audio/{}' length='{}' type='audio/mpeg'/>\n".format(file,size)
xmlfile += "<description>{}</description>\n".format(file.split('.')[1].split('.')[0])
xmlfile += "<pubDate>Sun, 29 Nov 2020 20:00:01</pubDate>\n"
xmlfile += '<itunes:image href="https://dotrcbot.github.io/cover.webp"/>\n'
xmlfile += "<itunes:duration>{}</itunes:duration>\n".format(length)
xmlfile += "<guid isPermaLink='false'>https://dotrcbot.github.io/audio/{}</guid>\n".format(file)
xmlfile += "<enclosure url='https://dotrcbot.github.io/audio/{}' length='{}' type='audio/mpeg'/>\n".format(file,size)
xmlfile += "</item>\n"

xmlfile += '''</channel>
Expand All @@ -57,6 +59,5 @@
with open('../feed.xml', 'w') as feed:
feed.write(xmlfile)


print(xmlfile)
# print(xmlfile)

0 comments on commit d5b2b78

Please sign in to comment.