Add ID to Feed and use ANSI escape sequences to color output
Signed-off-by: MK13 <marius@kleberonline.de>
This commit is contained in:
15
anime-rss.py
15
anime-rss.py
@@ -3,6 +3,15 @@ import json
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
# ANSI escape sequence coloring
|
||||
CSI = "\x1B["
|
||||
BOLD = CSI + "1;49m"
|
||||
RESET = CSI + "0;0m"
|
||||
RED = CSI + "91;49m"
|
||||
GREEN = CSI + "92;49m"
|
||||
BOLD_RED = BOLD + RED
|
||||
BOLD_GREEN = BOLD + GREEN
|
||||
|
||||
feeds = []
|
||||
config = []
|
||||
|
||||
@@ -13,11 +22,11 @@ with open("config.json", "r") as config:
|
||||
config = json.load(config)
|
||||
|
||||
for feed in feeds["Feeds"]:
|
||||
print("Checking feed: " + feed["URL"])
|
||||
print(BOLD + "Checking feed: " + feed["ID"] + RESET)
|
||||
NewsFeed = feedparser.parse(feed["URL"])
|
||||
|
||||
for show in feed["Shows"]:
|
||||
print("Checking show: " + show["Title"])
|
||||
print("Checking show: " + BOLD_RED + show["Title"] + RESET)
|
||||
|
||||
for entry in NewsFeed.entries:
|
||||
if show["Title"] in entry.title:
|
||||
@@ -28,7 +37,7 @@ for feed in feeds["Feeds"]:
|
||||
episodeNumber = match.groups()
|
||||
|
||||
if int(episodeNumber[0]) > int(show["Local"]):
|
||||
print("NEW NEW NEW " + show["Title"] + " " + episodeNumber[0])
|
||||
print(BOLD_GREEN + "NEW NEW NEW " + show["Title"] + " " + episodeNumber[0] + RESET)
|
||||
|
||||
subprocess.run(["transmission-remote", "-a", entry.link, "-w", config["showDownloadDir"]])
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"Feeds": [
|
||||
{
|
||||
"ID": "SubsPlease",
|
||||
"URL": "https://subsplease.org/rss/?t&r=1080",
|
||||
"Shows": [
|
||||
{
|
||||
@@ -31,6 +32,7 @@
|
||||
"Episode-Regex": "\\[SubsPlease\\] $SHOWS$ - (\\d{2,2}) \\(1080p\\) \\[[A-Z0-9]{8,8}\\].mkv"
|
||||
},
|
||||
{
|
||||
"ID": "Nyaa Kaifuku Jutsushi no Yarinaoshi",
|
||||
"URL": "https://nyaa.si/?page=rss&q=%5Bjackie%5D+Kaifuku+Jutsushi+no+Yarinaoshi+-&c=0_0&f=0",
|
||||
"Shows": [
|
||||
{
|
||||
@@ -41,6 +43,7 @@
|
||||
"Episode-Regex": "\\[jackie\\] $SHOWS$ - (\\d{2,2}) \\[720p x264 AAC\\]\\[[A-Z0-9]{8,8}\\].mkv \\(Uncensored\\)"
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"Shows": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user