#!/usr/bin/env python
import os
-import threading
import time
-import psutil
+import platform
import urllib.request
import json
live = list()
ended = list()
blacklist = list()
+running = True
+checkedPs = False
+psCount = 0
def updateValues():
global live, ended, blacklist
notBlacklist = True
chName = ch["channel"]["name"].lower()
+ # check if the vtuber is in the blacklist
for name in blacklist:
if (name in chName):
notBlacklist = False
break
-
+ # check if the live has already been announces and its not blacklisted
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(platform.system() == "Windows"):
+ from plyer import notification
+ notification.notify(title=chName + " is live!", message=ch["title"])
+ else:
+ os.system(f'''notify-send -i {chIcon} "{chName} is live!" "{ch["title"]}"''')
+
+ liveAnnouced.append(chName)
+ # check if the live has ended and remove it from the live already announced
if(ch["yt_video_key"] in ended):
liveAnnouced.remove(ch["channel"]["name"])
-if __name__ == "__main__":
- running = True
- checkedPs = False
- psCount = 0
+def linuxCheckProc():
+ global checkedPs, psCount, running
+ if checkedPs == False and platform.system() == "Linux":
+ import psutil
+ for pid in psutil.pids():
+ try:
+ p = psutil.Process(pid)
+ if p.name() == "python":
+ if psCount >= 1:
+ running = False
+ break
+ if "holonotify" in p.cmdline()[1]:
+ psCount += 1
+ except:
+ continue
+ checkedPs = True
+
+def windowsCheckProc():
+ # TODO
+ pass
+
+if __name__ == "__main__":
while running:
main()
# If there's another instance running, show who's live and quit
- if checkedPs == False:
- for pid in psutil.pids():
- try:
- p = psutil.Process(pid)
- if p.name() == "python":
- if psCount >= 1:
- running = False
- break
- if "holonotify" in p.cmdline()[1]:
- psCount += 1
- except:
- continue
- checkedPs = True
-
+ linuxCheckProc()
+ windowsCheckProc()
+
if running:
time.sleep(60*5)
import os
+import platform
def getBlacklist():
blacklist = list()
+ # TODO: path to blacklist on windows
blacklistFile = os.path.expanduser("~") + "/.config/holoBlacklist"
if (os.path.isfile(blacklistFile)):
for x in f.read().splitlines():
if(x == "fubuki" or x == "shirakami"):
blacklist.append("フブキ")
- elif(x == "mel"):
- blacklist.append("夜空メルチャンネル")
elif (x == "akirose" or x == "aki" or x == "rosenthal"):
blacklist.append("アキロゼ")
else:
blacklist.append(x)
-
return blacklist
def getIcon(name):
- abspath = os.path.dirname(os.path.abspath(__file__)) + "/Icons/"
+ if(platform.system() == "Windows"):
+ abspath = os.path.dirname(os.path.abspath(__file__)) + "\\Icons\\"
+ else:
+ abspath = os.path.dirname(os.path.abspath(__file__)) + "/Icons/"
# JP
if ("フブキ" in name):
elif ("botan" in name):
return abspath + "botan.jpg"
- # JP col cazzo
+ # JP males
elif ("shien" in name):
return abspath + "shien.jpg"
elif ("oga" in name):
return abspath + "amelia.jpg"
elif ("irys" in name):
return abspath + "irys.jpg"
- elif ("sana" in name):
+ elif ("tsukumoto" in name):
return abspath + "sana.jpg"
elif ("fauna" in name):
return abspath + "fauna.jpg"