#!/usr/bin/python import rfeed import datetime import os import pathlib items = [] weblist = [] for file in os.listdir("files"): try: day, month, year = list(map(int, file.split("_")[-1][:-4].split("."))) except ValueError: print(f"{file}: name malformed?") continue date = datetime.datetime(year, month, day) items.append(rfeed.Item( title=f"Podcast {file}", link = "", description = "", author = "", guid = rfeed.Guid(file), enclosure = rfeed.Enclosure(url=f"https://dukun.de/xox/mycast/files/{file}", length=os.path.getsize(f"files/{file}"), type="audio/mpeg"), pubDate = date )) weblist.append([f"{year:0>4d}-{month:0>2d}-{day:0>2d}", file]) feed = rfeed.Feed( title = "My podcast collection from anywhere", link = "", description = "", language = "de-DE", lastBuildDate = datetime.datetime.now(), items = items) with open("feed.xml", "w") as f: f.write(feed.rss()) # generate web listener weblist.sort() with open("index.html", "w") as f: # site header f.write("""

 

Podcastsammlung Webplayer


""") # sort list weblist.sort(reverse=True, key=lambda x: x[0]) # site entries for entry in weblist: date, filename = entry f.write(f"{filename}


") # site footer f.write("""
dukun.de
""")