From: LeonardoBizzoni Date: Sun, 8 Aug 2021 12:36:09 +0000 (+0200) Subject: Final commit X-Git-Url: http://git.leonardobizzoni.com/?a=commitdiff_plain;h=8f2d274593d80e616127ede8c28d83959a5f1b6f;p=holonotify Final commit --- 8f2d274593d80e616127ede8c28d83959a5f1b6f diff --git a/Icons/airani.jpg b/Icons/airani.jpg new file mode 100644 index 0000000..cc9d788 Binary files /dev/null and b/Icons/airani.jpg differ diff --git a/Icons/akirose.jpg b/Icons/akirose.jpg new file mode 100644 index 0000000..642dfd1 Binary files /dev/null and b/Icons/akirose.jpg differ diff --git a/Icons/amelia.jpg b/Icons/amelia.jpg new file mode 100644 index 0000000..251eb98 Binary files /dev/null and b/Icons/amelia.jpg differ diff --git a/Icons/anya.jpg b/Icons/anya.jpg new file mode 100644 index 0000000..205ded5 Binary files /dev/null and b/Icons/anya.jpg differ diff --git a/Icons/aqua.jpg b/Icons/aqua.jpg new file mode 100644 index 0000000..28530f2 Binary files /dev/null and b/Icons/aqua.jpg differ diff --git a/Icons/aruran.jpg b/Icons/aruran.jpg new file mode 100644 index 0000000..57aad05 Binary files /dev/null and b/Icons/aruran.jpg differ diff --git a/Icons/astel.jpg b/Icons/astel.jpg new file mode 100644 index 0000000..bae2550 Binary files /dev/null and b/Icons/astel.jpg differ diff --git a/Icons/ayame.jpg b/Icons/ayame.jpg new file mode 100644 index 0000000..d659c2c Binary files /dev/null and b/Icons/ayame.jpg differ diff --git a/Icons/azki.jpg b/Icons/azki.jpg new file mode 100644 index 0000000..54836c9 Binary files /dev/null and b/Icons/azki.jpg differ diff --git a/Icons/botan.jpg b/Icons/botan.jpg new file mode 100644 index 0000000..f3377fe Binary files /dev/null and b/Icons/botan.jpg differ diff --git a/Icons/calliope.jpg b/Icons/calliope.jpg new file mode 100644 index 0000000..3a69dbc Binary files /dev/null and b/Icons/calliope.jpg differ diff --git a/Icons/choco.jpg b/Icons/choco.jpg new file mode 100644 index 0000000..1505bec Binary files /dev/null and b/Icons/choco.jpg differ diff --git a/Icons/flare.jpg b/Icons/flare.jpg new file mode 100644 index 0000000..c6b6295 Binary files /dev/null and b/Icons/flare.jpg differ diff --git a/Icons/fubuki.jpg b/Icons/fubuki.jpg new file mode 100644 index 0000000..a25cfd6 Binary files /dev/null and b/Icons/fubuki.jpg differ diff --git a/Icons/gura.jpg b/Icons/gura.jpg new file mode 100644 index 0000000..bba00fc Binary files /dev/null and b/Icons/gura.jpg differ diff --git a/Icons/haachama.jpg b/Icons/haachama.jpg new file mode 100644 index 0000000..d88638e Binary files /dev/null and b/Icons/haachama.jpg differ diff --git a/Icons/holostars.jpg b/Icons/holostars.jpg new file mode 100644 index 0000000..22bff97 Binary files /dev/null and b/Icons/holostars.jpg differ diff --git a/Icons/ina.jpg b/Icons/ina.jpg new file mode 100644 index 0000000..d3e150b Binary files /dev/null and b/Icons/ina.jpg differ diff --git a/Icons/indonesia.jpg b/Icons/indonesia.jpg new file mode 100644 index 0000000..d19ff33 Binary files /dev/null and b/Icons/indonesia.jpg differ diff --git a/Icons/irys.jpg b/Icons/irys.jpg new file mode 100644 index 0000000..a51d209 Binary files /dev/null and b/Icons/irys.jpg differ diff --git a/Icons/izuru.jpg b/Icons/izuru.jpg new file mode 100644 index 0000000..5a68f17 Binary files /dev/null and b/Icons/izuru.jpg differ diff --git a/Icons/kanata.jpg b/Icons/kanata.jpg new file mode 100644 index 0000000..9376e83 Binary files /dev/null and b/Icons/kanata.jpg differ diff --git a/Icons/kiara.jpg b/Icons/kiara.jpg new file mode 100644 index 0000000..8dcb099 Binary files /dev/null and b/Icons/kiara.jpg differ diff --git a/Icons/kira.jpg b/Icons/kira.jpg new file mode 100644 index 0000000..61283cf Binary files /dev/null and b/Icons/kira.jpg differ diff --git a/Icons/korone.jpg b/Icons/korone.jpg new file mode 100644 index 0000000..5ab1268 Binary files /dev/null and b/Icons/korone.jpg differ diff --git a/Icons/lamy.jpg b/Icons/lamy.jpg new file mode 100644 index 0000000..fdea942 Binary files /dev/null and b/Icons/lamy.jpg differ diff --git a/Icons/luna.jpg b/Icons/luna.jpg new file mode 100644 index 0000000..ca8366a Binary files /dev/null and b/Icons/luna.jpg differ diff --git a/Icons/marine.jpg b/Icons/marine.jpg new file mode 100644 index 0000000..b73a273 Binary files /dev/null and b/Icons/marine.jpg differ diff --git a/Icons/matsuri.jpg b/Icons/matsuri.jpg new file mode 100644 index 0000000..2b70cff Binary files /dev/null and b/Icons/matsuri.jpg differ diff --git a/Icons/mel.jpg b/Icons/mel.jpg new file mode 100644 index 0000000..2a01af7 Binary files /dev/null and b/Icons/mel.jpg differ diff --git a/Icons/miko.jpg b/Icons/miko.jpg new file mode 100644 index 0000000..d7ec6ce Binary files /dev/null and b/Icons/miko.jpg differ diff --git a/Icons/mio.jpg b/Icons/mio.jpg new file mode 100644 index 0000000..207c799 Binary files /dev/null and b/Icons/mio.jpg differ diff --git a/Icons/miyabi.jpg b/Icons/miyabi.jpg new file mode 100644 index 0000000..d34fedb Binary files /dev/null and b/Icons/miyabi.jpg differ diff --git a/Icons/moona.jpg b/Icons/moona.jpg new file mode 100644 index 0000000..f731115 Binary files /dev/null and b/Icons/moona.jpg differ diff --git a/Icons/nene.jpg b/Icons/nene.jpg new file mode 100644 index 0000000..d73ba1a Binary files /dev/null and b/Icons/nene.jpg differ diff --git a/Icons/noel.jpg b/Icons/noel.jpg new file mode 100644 index 0000000..9c6012e Binary files /dev/null and b/Icons/noel.jpg differ diff --git a/Icons/oga.jpg b/Icons/oga.jpg new file mode 100644 index 0000000..57f509b Binary files /dev/null and b/Icons/oga.jpg differ diff --git a/Icons/okayu.jpg b/Icons/okayu.jpg new file mode 100644 index 0000000..3945d35 Binary files /dev/null and b/Icons/okayu.jpg differ diff --git a/Icons/ollie.jpg b/Icons/ollie.jpg new file mode 100644 index 0000000..bdcbe50 Binary files /dev/null and b/Icons/ollie.jpg differ diff --git a/Icons/pavolia.jpg b/Icons/pavolia.jpg new file mode 100644 index 0000000..0a9d6db Binary files /dev/null and b/Icons/pavolia.jpg differ diff --git a/Icons/pekora.jpg b/Icons/pekora.jpg new file mode 100644 index 0000000..47f5f2e Binary files /dev/null and b/Icons/pekora.jpg differ diff --git a/Icons/polka.jpg b/Icons/polka.jpg new file mode 100644 index 0000000..5d126d7 Binary files /dev/null and b/Icons/polka.jpg differ diff --git a/Icons/rikka.jpg b/Icons/rikka.jpg new file mode 100644 index 0000000..78b67a4 Binary files /dev/null and b/Icons/rikka.jpg differ diff --git a/Icons/risu.jpg b/Icons/risu.jpg new file mode 100644 index 0000000..053ef90 Binary files /dev/null and b/Icons/risu.jpg differ diff --git a/Icons/roberu.jpg b/Icons/roberu.jpg new file mode 100644 index 0000000..b6701b4 Binary files /dev/null and b/Icons/roberu.jpg differ diff --git a/Icons/roboco.jpg b/Icons/roboco.jpg new file mode 100644 index 0000000..eb33131 Binary files /dev/null and b/Icons/roboco.jpg differ diff --git a/Icons/rushia.jpg b/Icons/rushia.jpg new file mode 100644 index 0000000..8d28c0e Binary files /dev/null and b/Icons/rushia.jpg differ diff --git a/Icons/shien.jpg b/Icons/shien.jpg new file mode 100644 index 0000000..541795a Binary files /dev/null and b/Icons/shien.jpg differ diff --git a/Icons/shion.jpg b/Icons/shion.jpg new file mode 100644 index 0000000..240fec0 Binary files /dev/null and b/Icons/shion.jpg differ diff --git a/Icons/sora.jpg b/Icons/sora.jpg new file mode 100644 index 0000000..9230152 Binary files /dev/null and b/Icons/sora.jpg differ diff --git a/Icons/subaru.jpg b/Icons/subaru.jpg new file mode 100644 index 0000000..65e184a Binary files /dev/null and b/Icons/subaru.jpg differ diff --git a/Icons/suisei.jpg b/Icons/suisei.jpg new file mode 100644 index 0000000..c3aad17 Binary files /dev/null and b/Icons/suisei.jpg differ diff --git a/Icons/temma.jpg b/Icons/temma.jpg new file mode 100644 index 0000000..99ddc2d Binary files /dev/null and b/Icons/temma.jpg differ diff --git a/Icons/towa.jpg b/Icons/towa.jpg new file mode 100644 index 0000000..a0cdc96 Binary files /dev/null and b/Icons/towa.jpg differ diff --git a/Icons/watame.jpg b/Icons/watame.jpg new file mode 100644 index 0000000..577fde6 Binary files /dev/null and b/Icons/watame.jpg differ diff --git a/holonotify.py b/holonotify.py new file mode 100755 index 0000000..955f265 --- /dev/null +++ b/holonotify.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +import os +import threading +import time + +import urllib.request +import json + +import utils + +liveAnnouced = list() +live = list() +ended = list() +blacklist = list() + +def updateValues(): + global live, ended + with urllib.request.urlopen("https://api.holotools.app/v1/live") as url: + holoapi = json.loads(url.read().decode()) + live = holoapi["live"] + ended = holoapi["ended"] + + time.sleep(60*5) + updateValues() + + +def main(): + for ch in live: + notBlacklist = True + chName = ch["channel"]["name"].lower() + + for name in blacklist: + if (name in chName): + notBlacklist = False + break + + if(chName not in liveAnnouced and notBlacklist): + chIcon = utils.getIcon(chName) + os.system(f'''notify-send -i {chIcon} "{chName} is live!" "{ch["title"]}"''') + liveAnnouced.append(chName) + + if(ch["yt_video_key"] in ended): + liveAnnouced.remove(ch["channel"]["name"]) + + time.sleep(60*5) + +if __name__ == "__main__": + thread = threading.Thread(target=updateValues) + thread.start() + + time.sleep(5) + while True: + blacklist = utils.getBlacklist() + main() diff --git a/utils.py b/utils.py new file mode 100644 index 0000000..59da3c8 --- /dev/null +++ b/utils.py @@ -0,0 +1,133 @@ +import os + +def getBlacklist(): + blacklist = list() + blacklistFile = os.path.expanduser("~") + "/.config/holoBlacklist" + + if (os.path.isfile(blacklistFile)): + with open(blacklistFile, "r") as f: + for x in f.read().splitlines(): + blacklist.append(x) + + return blacklist + +def getIcon(name): + abspath = os.path.dirname(os.path.abspath(__file__)) + "/Icons/" + + # JP + if ("フブキCh。白上フブキ" in name): + return abspath + "fubuki.jpg" + elif ("pekora" in name): + return abspath + "pekora.jpg" + elif ("polka" in name): + return abspath + "polka.jpg" + elif ("rushia" in name): + return abspath + "rushia.jpg" + elif ("kanata" in name): + return abspath + "kanata.jpg" + elif ("sora" in name): + return abspath + "sora.jpg" + elif ("roboco" in name): + return abspath + "roboco.jpg" + elif ("miko" in name): + return abspath + "miko.jpg" + elif ("mel" in name): + return abspath + "mel.jpg" + elif ("アキロゼCh。Vtuber/ホロライブ所属" in name): + return abspath + "akirose.jpg" + elif ("haachama" in name): + return abspath + "haachama.jpg" + elif ("matsuri" in name): + return abspath + "matsuri.jpg" + elif ("aqua" in name): + return abspath + "aqua.jpg" + elif ("shion" in name): + return abspath + "shion.jpg" + elif ("ayame" in name): + return abspath + "ayame.jpg" + elif ("choco" in name): + return abspath + "choco.jpg" + elif ("subaru" in name): + return abspath + "subaru.jpg" + elif ("mio" in name): + return abspath + "mio.jpg" + elif ("okayu" in name): + return abspath + "okayu.jpg" + elif ("korone" in name): + return abspath + "korone.jpg" + elif ("azki" in name): + return abspath + "azki.jpg" + elif ("suisei" in name): + return abspath + "suisei.jpg" + elif ("flare" in name): + return abspath + "flare.jpg" + elif ("marine" in name): + return abspath + "marine.jpg" + elif ("noel" in name): + return abspath + "noel.jpg" + elif ("watame" in name): + return abspath + "watame.jpg" + elif ("towa" in name): + return abspath + "towa.jpg" + elif ("luna" in name): + return abspath + "luna.jpg" + elif ("lamy" in name): + return abspath + "lamy.jpg" + elif ("nene" in name): + return abspath + "nene.jpg" + elif ("botan" in name): + return abspath + "botan.jpg" + + # JP col cazzo + elif ("shien" in name): + return abspath + "shien.jpg" + elif ("oga" in name): + return abspath + "oga.jpg" + elif ("holostars" in name): + return abspath + "holostars.jpg" + elif ("miyabi" in name): + return abspath + "miyabi.jpg" + elif ("izuru" in name): + return abspath + "izuru.jpg" + elif ("kira" in name): + return abspath + "kira.jpg" + elif ("aruran" in name): + return abspath + "aruran.jpg" + elif ("rikka" in name): + return abspath + "rikka.jpg" + elif ("temma" in name): + return abspath + "temma.jpg" + elif ("astel" in name): + return abspath + "astel.jpg" + elif ("roberu" in name): + return abspath + "roberu.jpg" + + # EN + elif ("gura" in name): + return abspath + "gura.jpg" + elif ("kiara" in name): + return abspath + "kiara.jpg" + elif ("calliope" in name): + return abspath + "calliope.jpg" + elif ("ina'nis" in name): + return abspath + "ina.jpg" + elif ("amelia" in name): + return abspath + "amelia.jpg" + elif ("irys" in name): + return abspath + "irys.jpg" + + # ID + elif ("ollie" in name): + return abspath + "ollie.jpg" + elif ("risu" in name): + return abspath + "risu.jpg" + elif ("moona" in name): + return abspath + "moona.jpg" + elif ("airani" in name): + return abspath + "airani.jpg" + elif ("hololive indonesia" in name): + return abspath + "indonesia.jpg" + elif ("pavolia" in name): + return abspath + "pavolia.jpg" + elif ("anya" in name): + return abspath + "anya.jpg"