1
0

Initial commit

Signed-off-by: MK13 <marius@kleberonline.de>
This commit is contained in:
2021-01-15 01:20:59 +01:00
commit 6bde560fcb
5 changed files with 199 additions and 0 deletions

38
anime-rss.py Normal file
View File

@@ -0,0 +1,38 @@
import feedparser
import json
import re
import subprocess
feeds = []
config = []
with open("shows.json", "r") as feeds:
feeds = json.load(feeds)
with open("config.json", "r") as config:
config = json.load(config)
for feed in feeds["Feeds"]:
print("Checking feed: " + feed["URL"])
NewsFeed = feedparser.parse(feed["URL"])
for show in feed["Shows"]:
print("Checking show: " + show["Title"])
for entry in NewsFeed.entries:
if show["Title"] in entry.title:
regex = feed["Episode-Regex"].replace("$SHOWS$", show["Title"])
match = re.match(regex, entry.title)
if match:
episodeNumber = match.groups()
if int(episodeNumber[0]) > int(show["Local"]):
print("NEW NEW NEW " + show["Title"] + episodeNumber[0])
subprocess.run(["transmission-remote", "-a", entry.link, "-w", config["showDownloadDir"]])
show["Local"] = str(int(show["Local"]) + 1).zfill(2)
with open("shows.json", "w") as new_feeds:
new_feeds.write(json.dumps(feeds, indent=3))