1
0

Add ID to Feed and use ANSI escape sequences to color output

Signed-off-by: MK13 <marius@kleberonline.de>
This commit is contained in:
2021-01-15 21:04:26 +01:00
parent ed950df649
commit 7008509cf9
2 changed files with 15 additions and 3 deletions

View File

@@ -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"]])