diff --git a/rss_gen.py b/rss_gen.py index cfed11c..16055bf 100644 --- a/rss_gen.py +++ b/rss_gen.py @@ -33,7 +33,7 @@ XML_END = """""" load_dotenv() copyparty_token = os.getenv('COPYPARTY_TOKEN') -def make_torrent_entry(name, timestamp, hash, category): +def make_torrent_entry(name, timestamp, filehash, category): if category: category = "DODI_Repack" else: @@ -42,7 +42,7 @@ def make_torrent_entry(name, timestamp, hash, category): <![CDATA[{name}]]> {timestamp} +0000 {category} - {name} + {filehash} """ @@ -56,13 +56,13 @@ def write_file(path, data): def create_25_recent_feed(df): most_recent_25 = df.sort_values("timestamp", ascending=False).head(25) - latest_25_xml = "\n".join([make_torrent_entry(i[0], i[2], i[3], i[4]) for i in most_recent_25.values]) + latest_25_xml = "\n".join([make_torrent_entry(i["name"], i["timestamp"], i["filehash"], i["is_repack"]) for i in most_recent_25]) write_file("RSS/recent_25.xml", XML_BEGIN_RECENT+latest_25_xml+XML_END) def create_48h_latest(df): last_48_hours = df[df['timestamp'] > datetime.now() - pd.Timedelta(days=2)] last_48_hours = last_48_hours.sort_values("timestamp", ascending=False) - last_48_xml = "\n".join([make_torrent_entry(i[0], i[2], i[3], i[4]) for i in last_48_hours.values]) + last_48_xml = "\n".join([make_torrent_entry(i["name"], i["timestamp"], i["filehash"], i["is_repack"]) for i in last_48_hours]) write_file("RSS/latest_48h.xml", XML_BEGIN_LAST+last_48_xml+XML_END) def create_df(): @@ -71,7 +71,7 @@ def create_df(): rows = [i.find_all("td") for i in soup.tbody.find_all("tr")] filtered_rows = [[i[1].text, i[6].text, i[4].text, datetime.strptime(i[9].text, "%Y-%m-%d %H:%M:%S")] for i in rows] df = pd.DataFrame( - data=filtered_rows, columns=["name", "upload_ip", "hash", "timestamp"] + data=filtered_rows, columns=["name", "upload_ip", "filehash", "timestamp"] ) df['is_repack'] = df['name'].str.contains('DODI', case=False)