예제 #1
0
파일: coding.py 프로젝트: pk16/notify
def getEvents(site):

	if site == "Hackerearth":
		lis = net.getHackerEvents()
	else:
		lis = net.getOtherEvents(site)

	if len(lis) == 0:
		op.popUp(site,"No Upcoming Challenges",0)
	options = ["Upcoming challenges on {}".format(site)]
	for elem in lis:
		options.append("{:<50} {:<40} {:>20}".format(elem["Title"],"StartTime : "+elem["Start"],"EndTime : "+elem["End"]))
	options.append("Back")
	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		exitApp()
	if optionChosen == len(options)-1 :
		main()
	else:
		minutes = ip.getMinutes(30)
		if minutes == "":
			getEvents(site)
			return
		pb = ip.getPB()
		app.DICTIONARY["Coding"].append({"Title":"{} Challenge".format(site),"Message":options[optionChosen],"Interval":minutes*10,"Counter":minutes*10,"PB":pb})
		op.popUp("Notification Set","For {} every {} minute(s)".format(lis[optionChosen-1]["Title"],minutes),0)
예제 #2
0
파일: cricket.py 프로젝트: pk16/notify
def main():
	matchIds,matches = net.getLiveMatches()
	if matches[0] == "No Match in progress":
		op.popUp("Cricket","No match in progress or scheduled soon",0)
		return
	options = ["Matches:"]
	for elem in matches:
		options.append(elem)
	options.append("Back")

	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		exitApp()

	if optionChosen == len(options)-1 :
		return

	minutes = ip.getMinutes(1)
	if minutes == "":
		main()
		return
	pb = ip.getPB()
	op.popUp("Notification Set","{} every {} minute(s)".format(options[optionChosen],minutes),0)
	app.DICTIONARY["Cricket"].append({"matchId":matchIds[optionChosen-1] , "Teams":options[optionChosen], "Interval":minutes*10 , "Counter":minutes*10 ,"PB":pb})
예제 #3
0
파일: app.py 프로젝트: pk16/notify
def main():
	global PBon
	global PBobj
	PB=""
	thread = Thread(target = op.thread_func, args = (t_stop,))
	thread.start()
	while True:
		options = ["Choose one of the following"]
		options.append("Cricket Scores")
		options.append("Coding Contest Updates")
		options.append("Tweets")
		options.append("Custom Notification with user defined frequency")
		options.append("Remove any set notification")
		if(PB == ""):
			options.append("Want Notifications on Your PushBullet Devices? Enter Access Token here.")
			PBon = 0
		else:
			options.append("PushBullet Device Set Up Successfully. Want to remove the Access Token?")
			PBon = 1
		options.append("Quit")
		try:
			optionChosen = ip.getUserInput(options)
		except KeyboardInterrupt:
			exitApp()
		if optionChosen == len(options)-1:
			exitApp()
		if(optionChosen == len(options) -2):
			if(PB == ""):
				PB=ip.inputData("PushBullet","Enter Valid Access Token")
				if PB != "":
					try:
						PBobj=Pushbullet(PB) 
						PBon = 1
						op.popUp("Notify","Successfull Setup",1)
					except Exception as e:
						op.popUp("PushBullet","Wrong Access Token or Network Error\nTry Again",0)
						PB=""
			else:
				op.success()
				PB=""
			continue
		if(optionChosen == 1):
			cricket.main()

		if(optionChosen == 2):
			coding.main()

		if(optionChosen == 3):
			tweet.main()

		if(optionChosen == 4):
			custom.getData()
		
		if(optionChosen == 5):
			remove.main()
예제 #4
0
파일: coding.py 프로젝트: pk16/notify
def main():
	options=["Choose one of the following sites"]
	options.append("Codechef")
	options.append("Codeforces")
	options.append("Hackerrank")
	options.append("Hackerearth")
	options.append("Topcoder")
	options.append("Back")
	optionChosen = ip.getUserInput(options)
	if optionChosen == len(options)-1 :
		return

	else:
		site = options[optionChosen]
		getEvents(site)
예제 #5
0
파일: tweet.py 프로젝트: pk16/notify
def trending(name,woeid):
	options = ["Top 10 {}".format(name)]
	op.popUp("Notify","Fetching Data",0)
	trend = net.getTrending(woeid)
	options = options + trend
	options.append("Back")
	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		exitApp()
	if optionChosen == len(options)-1 :
		main()
	else:
		minutes = ip.getMinutes(1)
		if minutes == "":
			trending(name,woeid)
		app.DICTIONARY["Tweets"].append({"HashTag":options[optionChosen] , "Interval":minutes*10 , "Counter":minutes*10 })
		op.popUp("Notification Set","Tweets for \"{}\" every {} minute(s)".format(options[optionChosen],minutes),0)
예제 #6
0
파일: tweet.py 프로젝트: pk16/notify
def main():
	options=["Choose an option"]
	options.append("Global Trending")
	options.append("Indian Trending")
	options.append("Custom HashTag")
	options.append("Back")
	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		exitApp()
	if optionChosen == 1:
		trending(options[1],1)
	if optionChosen == 2:
		trending(options[2],yweather.Client().fetch_woeid("India"))
	if optionChosen == 3:
		getData()
	if optionChosen == 4:
		return
예제 #7
0
파일: remove.py 프로젝트: pk16/notify
def main():
	options = ["Choose an option"]
	for elem in lis:
		if len(app.DICTIONARY[elem]) != 0 :
			options.append(elem)

	if len(options) == 1:
		op.popUp("Error","No notifications set up",0)
		return

	options.append("Remove all notifications")
	options.append("Back")

	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		t_stop.set()
		exitApp()

	if(optionChosen == len(options)-2):
		for elem in lis:
			del app.DICTIONARY[elem][:]
		op.popUp("Successfull","Removed all notifications",0)

	if(optionChosen == len(options)-1):
		return

	elem = options[optionChosen]

	if elem == lis[0]:
		cricket()

	if elem == lis[1]:
		coding()

	if elem == lis[2]:
		tweet()

	if elem == lis[3]:
		custom()
예제 #8
0
파일: remove.py 프로젝트: pk16/notify
def tweet():
	options = ["Following tweets are set"]
	for elem in app.DICTIONARY[lis[2]]:
		options.append("Hashtag \"{}\" with interval of {} minutes".format(elem["HashTag"],elem["Interval"]/10))
	options.append("Remove All")
	options.append("Back")
	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		t_stop.set()
		exitApp()
	if optionChosen == len(options)-1 :
		main()

	elif optionChosen == len(options)-2 :
		del app.DICTIONARY["Tweets"]
		op.popUp("Successfull","Removed all tweet notifications",0)
		return 

	else:
		del app.DICTIONARY["Tweets"][optionChosen-1]
		op.popUp("Successfull","Removed the notification",0)
예제 #9
0
파일: remove.py 프로젝트: pk16/notify
def coding():
	options = ["notification for following contests is set"]
	for elem in app.DICTIONARY[lis[1]]:
		options.append(elem["Message"])
	options.append("Remove All")
	options.append("Back")
	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		t_stop.set()
		exitApp()
	if optionChosen == len(options)-1 :
		main()

	elif optionChosen == len(options)-2 :
		del app.DICTIONARY["Coding"]
		op.popUp("Successfull","Removed all coding notifications",0)
		return 

	else:
		del app.DICTIONARY["Coding"][optionChosen-1]
		op.popUp("Successfull","Removed the notification",0)
예제 #10
0
파일: remove.py 프로젝트: pk16/notify
def custom():
	options = ["Following custom notifications are set"]
	for elem in app.DICTIONARY[lis[3]]:
		options.append("Title \"{}\", message \"{}\" with interval of {} minutes".format(elem["Title"],elem["Message"],elem["Interval"]/10))
	options.append("Remove All")
	options.append("Back")
	try:
		optionChosen = ip.getUserInput(options)
	except KeyboardInterrupt:
		t_stop.set()
		exitApp()
	if optionChosen == len(options)-1 :
		main()

	elif optionChosen == len(options)-2 :
		del app.DICTIONARY["Custom"]
		op.popUp("Successfull","Removed all custom notifications",0)
		return 

	else:
		del app.DICTIONARY["Custom"][optionChosen-1]
		op.popUp("Successfull","Removed the notification",0)
예제 #11
0
파일: main.py 프로젝트: NOTOC/xtraktor
 def getInput(self):
     self.websiteurl = getUserInput() #from input
예제 #12
0
파일: main.py 프로젝트: NOTOC/xtraktor
 def getInput(self):
     self.websiteurl = getUserInput()  #from input