Replace 'show' with 'anime' as this is a... anime downloader. Also introduce dirPerAnime config directive
Signed-off-by: MK13 <marius@kleberonline.de>
This commit is contained in:
28
anime-rss.py
28
anime-rss.py
@@ -17,7 +17,15 @@ BOLD_GREEN = BOLD + GREEN
|
||||
feeds = []
|
||||
config = []
|
||||
|
||||
with open("shows.json", "r") as feeds:
|
||||
|
||||
def build_target_folder():
|
||||
if config["dirPerAnime"]:
|
||||
return config["animeDownloadDir"] + "/" + anime["Title"].replace(" ", "_");
|
||||
else:
|
||||
return config["animeDownloadDir"]
|
||||
|
||||
|
||||
with open("animes.json", "r") as feeds:
|
||||
feeds = json.load(feeds)
|
||||
|
||||
with open("config.json", "r") as config:
|
||||
@@ -27,23 +35,23 @@ for feed in feeds["Feeds"]:
|
||||
print(BOLD + "Checking feed: " + feed["ID"] + RESET)
|
||||
NewsFeed = feedparser.parse(feed["URL"])
|
||||
|
||||
for show in feed["Shows"]:
|
||||
print("Checking show: " + BOLD_RED + show["Title"] + RESET)
|
||||
for anime in feed["Animes"]:
|
||||
print("Checking anime: " + BOLD_RED + anime["Title"] + RESET)
|
||||
|
||||
for entry in NewsFeed.entries:
|
||||
if show["Title"] in entry.title:
|
||||
regex = feed["Episode-Regex"].replace("$SHOWS$", show["Title"])
|
||||
if anime["Title"] in entry.title:
|
||||
regex = feed["Episode-Regex"].replace("$SHOWS$", anime["Title"])
|
||||
match = re.match(regex, entry.title)
|
||||
|
||||
if match:
|
||||
episodeNumber = match.groups()
|
||||
|
||||
if int(episodeNumber[0]) > int(show["Local"]):
|
||||
print(BOLD_GREEN + "NEW NEW NEW " + show["Title"] + " " + episodeNumber[0] + RESET)
|
||||
if int(episodeNumber[0]) > int(anime["Local"]):
|
||||
print(BOLD_GREEN + "NEW NEW NEW " + anime["Title"] + " " + episodeNumber[0] + RESET)
|
||||
|
||||
subprocess.run(["transmission-remote", "-a", entry.link, "-w", config["showDownloadDir"]])
|
||||
subprocess.run(["transmission-remote", "-a", entry.link, "-w", build_target_folder()])
|
||||
|
||||
show["Local"] = str(int(show["Local"]) + 1).zfill(2)
|
||||
anime["Local"] = str(int(anime["Local"]) + 1).zfill(2)
|
||||
|
||||
with open("shows.json", "w") as new_feeds:
|
||||
with open("animes.json", "w") as new_feeds:
|
||||
new_feeds.write(json.dumps(feeds, indent=3))
|
||||
|
||||
Reference in New Issue
Block a user