Esempio n. 1
0
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})
Esempio n. 2
0
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)
Esempio n. 3
0
File: app.py Progetto: 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()
Esempio n. 4
0
def popUp(title, msg , pb):
	try:
		pynotify.init("Notify")
		pynotify.Notification(title, msg, "dialog-information").show()
	except:
		print "Error sending notification"
		exitApp()
	if pb == 1 and app.PBon == 1:
		try:
			app.PBobj.push_note(title,msg)
		except Exception as e:
			popUp("PushBullet","Failure sending notification",0)
Esempio n. 5
0
File: tweet.py Progetto: 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)
Esempio n. 6
0
File: tweet.py Progetto: 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