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 = []
|
feeds = []
|
||||||
config = []
|
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)
|
feeds = json.load(feeds)
|
||||||
|
|
||||||
with open("config.json", "r") as config:
|
with open("config.json", "r") as config:
|
||||||
@@ -27,23 +35,23 @@ for feed in feeds["Feeds"]:
|
|||||||
print(BOLD + "Checking feed: " + feed["ID"] + RESET)
|
print(BOLD + "Checking feed: " + feed["ID"] + RESET)
|
||||||
NewsFeed = feedparser.parse(feed["URL"])
|
NewsFeed = feedparser.parse(feed["URL"])
|
||||||
|
|
||||||
for show in feed["Shows"]:
|
for anime in feed["Animes"]:
|
||||||
print("Checking show: " + BOLD_RED + show["Title"] + RESET)
|
print("Checking anime: " + BOLD_RED + anime["Title"] + RESET)
|
||||||
|
|
||||||
for entry in NewsFeed.entries:
|
for entry in NewsFeed.entries:
|
||||||
if show["Title"] in entry.title:
|
if anime["Title"] in entry.title:
|
||||||
regex = feed["Episode-Regex"].replace("$SHOWS$", show["Title"])
|
regex = feed["Episode-Regex"].replace("$SHOWS$", anime["Title"])
|
||||||
match = re.match(regex, entry.title)
|
match = re.match(regex, entry.title)
|
||||||
|
|
||||||
if match:
|
if match:
|
||||||
episodeNumber = match.groups()
|
episodeNumber = match.groups()
|
||||||
|
|
||||||
if int(episodeNumber[0]) > int(show["Local"]):
|
if int(episodeNumber[0]) > int(anime["Local"]):
|
||||||
print(BOLD_GREEN + "NEW NEW NEW " + show["Title"] + " " + episodeNumber[0] + RESET)
|
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))
|
new_feeds.write(json.dumps(feeds, indent=3))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"ID": "SubsPlease",
|
"ID": "SubsPlease",
|
||||||
"URL": "https://subsplease.org/rss/?t&r=1080",
|
"URL": "https://subsplease.org/rss/?t&r=1080",
|
||||||
"Shows": [
|
"Animes": [
|
||||||
{
|
{
|
||||||
"Title": "Go-toubun no Hanayome S2",
|
"Title": "Go-toubun no Hanayome S2",
|
||||||
"Local": "02"
|
"Local": "02"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Title": "Ore dake Haireru Kakushi Dungeon",
|
"Title": "Ore dake Haireru Kakushi Dungeon",
|
||||||
"Local": "02"
|
"Local": "01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Title": "Tensei Shitara Slime Datta Ken",
|
"Title": "Tensei Shitara Slime Datta Ken",
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
{
|
{
|
||||||
"ID": "Nyaa Kaifuku Jutsushi no Yarinaoshi",
|
"ID": "Nyaa Kaifuku Jutsushi no Yarinaoshi",
|
||||||
"URL": "https://nyaa.si/?page=rss&q=%5Bjackie%5D+Kaifuku+Jutsushi+no+Yarinaoshi+-&c=0_0&f=0",
|
"URL": "https://nyaa.si/?page=rss&q=%5Bjackie%5D+Kaifuku+Jutsushi+no+Yarinaoshi+-&c=0_0&f=0",
|
||||||
"Shows": [
|
"Animes": [
|
||||||
{
|
{
|
||||||
"Title": "Kaifuku Jutsushi no Yarinaoshi",
|
"Title": "Kaifuku Jutsushi no Yarinaoshi",
|
||||||
"Local": "01"
|
"Local": "01"
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
{
|
{
|
||||||
"ID": "Nyaa Shingeki no Kyojin",
|
"ID": "Nyaa Shingeki no Kyojin",
|
||||||
"URL": "https://nyaa.si/?page=rss&q=%5BDameDesuYo%5D+Shingeki+no+Kyojin+%28The+Final+Season%29+-+&c=0_0&f=0",
|
"URL": "https://nyaa.si/?page=rss&q=%5BDameDesuYo%5D+Shingeki+no+Kyojin+%28The+Final+Season%29+-+&c=0_0&f=0",
|
||||||
"Shows": [
|
"Animes": [
|
||||||
{
|
{
|
||||||
"Title": "Shingeki no Kyojin",
|
"Title": "Shingeki no Kyojin",
|
||||||
"Local": "64"
|
"Local": "64"
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"showDownloadDir": "/media/ssd/temp/"
|
"animeDownloadDir": "/media/ssd/temp",
|
||||||
|
"dirPerAnime": true
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user