fixed pandas df issue
This commit is contained in:
@@ -56,13 +56,13 @@ def write_file(path, data):
|
|||||||
|
|
||||||
def create_25_recent_feed(df):
|
def create_25_recent_feed(df):
|
||||||
most_recent_25 = df.sort_values("timestamp", ascending=False).head(25)
|
most_recent_25 = df.sort_values("timestamp", ascending=False).head(25)
|
||||||
latest_25_xml = "\n".join([make_torrent_entry(i["name"], i["timestamp"], i["filehash"], i["is_repack"]) for i in most_recent_25])
|
latest_25_xml = "\n".join(make_torrent_entry(row.name, row.timestamp, row.filehash, row.is_repack) for row in most_recent_25.itertuples())
|
||||||
write_file("RSS/recent_25.xml", XML_BEGIN_RECENT+latest_25_xml+XML_END)
|
write_file("RSS/recent_25.xml", XML_BEGIN_RECENT+latest_25_xml+XML_END)
|
||||||
|
|
||||||
def create_48h_latest(df):
|
def create_48h_latest(df):
|
||||||
last_48_hours = df[df['timestamp'] > datetime.now() - pd.Timedelta(days=2)]
|
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_hours = last_48_hours.sort_values("timestamp", ascending=False)
|
||||||
last_48_xml = "\n".join([make_torrent_entry(i["name"], i["timestamp"], i["filehash"], i["is_repack"]) for i in last_48_hours])
|
last_48_xml = "\n".join(make_torrent_entry(row.name, row.timestamp, row.filehash, row.is_repack) for row in last_48_hours.itertuples())
|
||||||
write_file("RSS/latest_48h.xml", XML_BEGIN_LAST+last_48_xml+XML_END)
|
write_file("RSS/latest_48h.xml", XML_BEGIN_LAST+last_48_xml+XML_END)
|
||||||
|
|
||||||
def create_df():
|
def create_df():
|
||||||
|
|||||||
Reference in New Issue
Block a user