Update gts-federator.py

This commit is contained in:
2026-04-19 20:32:37 +02:00
parent a8a710223a
commit 001ba6adb6
+4 -4
View File
@@ -68,7 +68,7 @@ class GTSFederator:
if not os.path.exists(self.config["rss_urls_file"]): if not os.path.exists(self.config["rss_urls_file"]):
self.logger.error("RSS_URLS_FILE missing!") self.logger.error("RSS_URLS_FILE missing!")
return 0, 0 return 0, 0, 0
with open(self.config["rss_urls_file"], 'r', encoding='utf-8') as f: with open(self.config["rss_urls_file"], 'r', encoding='utf-8') as f:
rss_urls = [l.split('#')[0].strip() for l in f if l.strip() and not l.strip().startswith('#')] rss_urls = [l.split('#')[0].strip() for l in f if l.strip() and not l.strip().startswith('#')]
@@ -123,16 +123,16 @@ class GTSFederator:
print(f"\n✅ Run Completed | Time: {runtime} | New Posts: {total_new} | Instances: {curr} (+{diff})") print(f"\n✅ Run Completed | Time: {runtime} | New Posts: {total_new} | Instances: {curr} (+{diff})")
self.save_state(curr) self.save_state(curr)
return total_new, num_feeds return total_new, num_feeds, curr
def run_forever(self): def run_forever(self):
wait_seconds = self.parse_interval(self.config["fetch_interval"]) wait_seconds = self.parse_interval(self.config["fetch_interval"])
self.logger.info(f"GTS-Federator Active. Interval: {self.config['fetch_interval']}") self.logger.info(f"GTS-Federator Active. Interval: {self.config['fetch_interval']}")
while True: while True:
posts, feeds = self.process_feeds() posts, feeds, instances = self.process_feeds()
self.logger.info(f"💤 Run completed. Pausing for {self.config['fetch_interval']}.") self.logger.info(f"💤 Run completed. Pausing for {self.config['fetch_interval']}.")
self.logger.info(f"📊 Fetched {posts} Posts from {feeds} RSS-Feeds") self.logger.info(f"📊 Fetched {posts} Posts from {feeds} RSS-Feeds. Known Instances: {instances}")
next_run = datetime.now() + timedelta(seconds=wait_seconds) next_run = datetime.now() + timedelta(seconds=wait_seconds)
self.logger.info(f"⏰ Next scheduled run: {next_run.strftime('%H:%M:%S')}") self.logger.info(f"⏰ Next scheduled run: {next_run.strftime('%H:%M:%S')}")