#!/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}-{month}-{day}", 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("""