Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #in the name of GOD
- #For Using This Program You Need "wget","talkey","copypaste","vocabulary" and "mss" libraries
- from mss import mss
- from vocabulary.vocabulary import Vocabulary as vb
- from google import search
- import math
- import time
- import requests
- import wget
- import random
- import urllib.request
- import socket
- import urllib
- from copypaste import copy, paste
- import sys
- def is_number(s):
- try:
- float(s)
- return True
- except:
- return False
- def ttss():
- try:
- import talkey
- tts = talkey.Talkey(
- engine_preference=['espeak'],
- espeak={
- 'options': {
- 'enabled': True,
- },
- 'defaults': {
- 'words_per_minute': 183,
- },
- 'languages': {
- 'en': {
- 'voice': 'english-mb-en1',
- 'words_per_minute': 183
- },
- }
- }
- )
- return True
- except:
- return False
- def is_downloadable(url):
- """
- Does the url contain a downloadable resource
- """
- h = requests.head(url, allow_redirects=True)
- header = h.headers
- content_type = header.get('content-type')
- if 'text' in content_type.lower():
- return False
- if 'html' in content_type.lower():
- return False
- return True
- def isdl(url):
- if is_downloadable(url) == True:
- return True
- else:
- return False
- gel = ttss()
- if gel == True:
- import talkey
- tts = talkey.Talkey(
- engine_preference=['espeak'],
- espeak={
- 'options': {
- 'enabled': True,
- },
- 'defaults': {
- 'words_per_minute': 183,
- },
- 'languages': {
- 'en': {
- 'voice': 'english-mb-en1',
- 'words_per_minute': 183
- },
- }
- }
- )
- count = 0
- print ("Welcome To K&S Program\nFor Help Please Type \"help\" And For More Information Please Type \"credits\" Or \"license\"")
- tts.say("welcome to K and S program. for help please type help and for more information please type credits or license")
- while count < 5:
- print ("==>")
- u = input ()
- if u == "download" or u == 'Download' or u == "DOWNLOAD":
- def internet():
- try:
- urllib.request.urlopen ('http://ipecho.net/plain')
- return True
- except:
- return False
- def is_downloadable(url):
- h = requests.head(url, allow_redirects=True)
- header = h.headers
- content_type = header.get('content-type')
- if 'text' in content_type.lower():
- return False
- if 'html' in content_type.lower():
- return False
- return True
- if internet() == True:
- print ("Please Enter The Download Link If You Copied The Download Link Please Type \"paste\":")
- tts.say ("Please Enter The Download Link If You Copied The Download Link Please Type paste")
- popp = input()
- if popp == 'paste' or popp == 'Paste':
- tt = paste()
- ff= str(tt)
- if is_downloadable(ff) == True:
- print ("Starting Download...")
- filename = wget.download(ff)
- print ("File Downloaded")
- else:
- print ("Your Download Link Is Incorrect")
- tts.say ("your download link is incorrect")
- else:
- ff= popp
- if is_downloadable(ff) == True:
- print ("Starting Download")
- filename = wget.download(ff)
- print ("File Downloaded")
- else:
- print ("Your Download Link Is Incorrect")
- tts.say ("your download link is incorrect")
- else:
- print ("You Are Not Connected To The Internet")
- tts.say("you are not connected to the internet")
- elif u == 'source' or u == 'Source' or u == "SOURCE":
- print ("\nPlease Go To https://pastebin.com/veFRa685 To See The Source Code\n")
- elif u == "google" or u == 'Google' or u == 'Search' or u == "search":
- def internet():
- try:
- urllib.request.urlopen ('http://ipecho.net/plain')
- return True
- except:
- return False
- if internet() == False:
- print ("You Are Not Connected To The Internet")
- tts.say ("You Are Not Connected To The Internet")
- else:
- print ("Please Enter The Text That You Want To Search:")
- tts.say ('please enter the text that you want to search')
- searchvar = input()
- for url in search(searchvar, tld='com.pk', lang='es', stop=5):
- print(url)
- elif u == 'time' or u == 'Time' or u =="TIME":
- localtime = time.asctime( time.localtime(time.time()) )
- print ("Local current time :", localtime)
- tts.say("local current time is")
- tts.say (localtime)
- elif u == 'dic' or u == "dictionary":
- def internet():
- try:
- urllib.request.urlopen ('http://ipecho.net/plain')
- return True
- except:
- return False
- if internet() == True:
- print ("Welcome To The Dictionary\nPlease Type \"syn\" For Synonym \nType \"mean\" For Meaning Of The Word\nType \"ant\" For Antonyms Of The Word\nAnd Type \"exa\" To See A Quick Example On How To Use The Word")
- print ("Please Type Your Command:")
- tts.say ("please enter your command")
- diccom = input ()
- if diccom == 'syn':
- print ("Please Enter The Word:")
- tts.say ("please enter the word")
- dicword = input()
- print (vb.synonym(dicword))
- elif diccom == 'mean':
- print ("Please Enter The Word:")
- tts.say ("please enter the word")
- dicword = input()
- print (vb.meaning(dicword))
- elif diccom == "ant":
- print ("Please Enter The Word:")
- tts.say ("please enter the word")
- dicword = input()
- print (vb.antonym(dicword))
- elif diccom == "exa":
- print ("Please Enter The Word:")
- tts.say ("please enter the word")
- dicword = input()
- print (vb.usage_example(dicword))
- else:
- print ("Your Command Is Incorrect")
- tts.say ("your command is incorrect")
- elif internet() == False:
- print ("You Are Not Connected To The Internet")
- tts.say ("you are not connected to the internet")
- elif u == 'game' or u == 'Game' or u == "GAME":
- ii =random.randint(1,10)
- print("Welcome To The Guess The Number Game\nYou Should Guess A Number Between 1 And 10\n You Have 3 Chances To Guess\n")
- tts.say ("welcome to guess the number game you should guess a number between 1 and 10 you have three chances to guess")
- print ("Please Enter Your First Guess:")
- tts.say ("please type your first guess")
- pp = input()
- if is_number(pp) == True:
- if int(pp) == int(ii):
- print("Excellent You Won!!!!!\n")
- tts.say ("excellent you won")
- else:
- if int(pp) > int(ii):
- print ("Your Nmuber Is Greater Than Our Number")
- tts.say ("your number is greater than our number")
- else:
- print ("Your Number Is Smaller Than Our Number")
- tts.say ("your number is smaller than our number")
- print ("Please Enter Your Second Guess:")
- tts.say ("please enter your second guess")
- oo = input()
- if is_number(oo) == True:
- if int(oo) == int(ii):
- print ("Excellent You Won!!!!!!!\n")
- tts.say ("excellent you won")
- else:
- if int(oo) > int (ii):
- print ("Your Nmuber Is Greater Than Our Number")
- tts.say ("your number is greater than our number")
- else:
- print ("Your Number Is Smaller Than Our Number")
- tts.say ("your number is smaller than our number")
- print ("Please Enter Your Last Guess:")
- tts.say ("please enter your last guess")
- uuu = input()
- if is_number (uuu) == True:
- if int(uuu) == ii:
- print ("Excellent You Won!!!!!!\n")
- tts.say ("excellent you won")
- else:
- print ("GAME OVER!!!")
- tts.say ("game over")
- print ("The Number Was",ii)
- tts.say ("the number was")
- tts.say (str (ii))
- else:
- print ("Please Enter A Number And Nothing Else")
- tts.say ("please enter a number and nothing else")
- else:
- print ("Please Enter A Number And Nothing Else")
- tts.say ("please enter a number and nothing else")
- else:
- print ("Please Enter A Number And Nothing Else")
- tts.say ("please enter a number and nothing else")
- elif u == "convert" or u == "Convert" or u == 'CONVERT':
- print ("\nPlease Type \"c\" For Converting Centigrade To Fahrenheit And Type \"f\" For Conerting Fahrenheit To Centigrade:")
- tts.say("please type C for converting centigrade to fahrenheit and type F for converting fahrenheit to centigrade")
- con = input()
- if con == 'c' or con == "C":
- print ("Please Enter The Number:")
- tts.say ("Please Enter The Number")
- tobe = input()
- if is_number(tobe) == True:
- iu = int(tobe)*1.8+32
- print (tobe,"Centigrade = ",iu,"Fahrenheit")
- tts.say(str(tobe))
- tts.say("Centigrade")
- tts.say("Is equal to")
- tts.say(str(iu))
- tts.say("fahrenheit")
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif con == 'f' or con == "F":
- print ("Please Enter The Number:")
- tts.say("Please Enter The Number:")
- tobe = input()
- if is_number(tobe) == True:
- iu = (int(tobe)-32)/8
- print (tobe,"Fahrenheit = ",iu,"Centigrade")
- tts.say(str(tobe))
- tts.say("fahrenheit")
- tts.say("Is equal to")
- tts.say(str(iu))
- tts.say("centigrade")
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- else:
- print ("Your Command Is Incorrect")
- tts.say("your command is incorrect")
- elif u == 'tts' or u == "Tts" or u == "TTS":
- ttsvar = input ("Please Enter Your Text:")
- tts.say(ttsvar)
- elif u == "screenshot" or u == 'scrshot' or u == 'Screenshot' or u == 'SCREENSHOT' or u == "Scrshot" or u == 'SCRSHOT':
- with mss() as sct:
- sct.shot()
- print ("The Screenshot Picture Saved")
- tts.say ("the screenshot picture saved")
- elif u == "credits":
- print ("\n2016-2017 Soheil And Kamyar\nsoheilmokhe@gmail.com\n")
- tts.say ("Soheil And Kamyar")
- elif u == "help" or u == 'Help' or u == 'HELP':
- print ("\nTo Run Calculator Please Type \"calc\"\nTo See Credits Type \"credits\"\nTo See The Local Current Time Please Type \"time\"\nTo Downlaod Something Via K&S Please Type \"download\"\nTo See The Source Code Please Type \"source\"\nTo Use The Text To Speech Please Type \"tts\"")
- print ("To Use Convert Tool To Convert Centigrade To Fahrenheit Or Fahrenheit To Centigrade Please Type \"convert\"")
- print ("To Use The Google Search Tool Please Type \"search\"")
- print ("To Take A Screen Shot From Your Desktop Please Type \"scrshot\"")
- print ('To Run Guess The Number Game Please Type \"game\"')
- print ("For Using Dictionary Please Type \"dic\"")
- print ("To See Your Public IP Address Please Type \"ip\"\nTo Close The Program Please Type \"close\"\n")
- elif u == 'close' or u == "Close" or u == "CLOSE":
- exit()
- elif u == 'ip' or u == 'IP' or u == "Ip":
- def internet():
- try:
- urllib.request.urlopen ("http://ipecho.net/plain")
- return True
- except:
- return False
- if internet() == True:
- fp = urllib.request.urlopen("http://ipecho.net/plain")
- mybytes = fp.read()
- mystr = mybytes.decode("utf8")
- fp.close()
- print("\nYour Public IP Address:",mystr)
- tts.say("your public i p address is")
- tts.say(mystr)
- else:
- print("You Are Not Connected To The Internet")
- tts.say("you are not connected to the internet")
- elif u == "license":
- print ("You Can Do Whatever You Want With This Program And Its Sourcecode :D")
- tts.say ("you can do whatever you want with this program and its source code")
- elif u == "calc" or u == 'Calc' or u == "CALC":
- print ("\nCalculator Version 1.0\nPlease Enter Your Operator (+,-,/,*,**,#,cos,sin,tan,acos,acosh,asin,atan,ceil,floor,factorial) :")
- tts.say("Please Type Your Operator")
- x = input()
- if x == '+':
- print ("Please Enter Your First Number:")
- tts.say("Please enter your first number")
- y = input()
- if is_number(y) == True:
- print ("Please Enter Your Second Number:")
- tts.say("Please enter your second number")
- z = input ()
- if is_number(z) == True:
- c = int(y) + int(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == '-':
- print ("Please Enter Your First Number:")
- tts.say("Please enter your first number")
- y = input()
- if is_number(y) == True:
- print ("Please Enter Your Second Number:")
- tts.say("Please enter your second number")
- z = input ()
- if is_number(z) == True:
- c = int(y) - int(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == '*':
- print ("Please Enter Your First Number:")
- tts.say("Please enter your first number")
- y = input()
- if is_number(y) == True:
- print ("Please Enter Your Second Number:")
- tts.say("Please enter your second number")
- z = input ()
- if is_number(z) == True:
- c = int(y) * int(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == '/':
- print ("Please Enter Your First Number:")
- tts.say("Please enter your first number")
- y = input()
- if is_number(y) == True:
- print ("Please Enter Your Second Number:")
- tts.say("Please enter your second number")
- z = input ()
- if is_number(z) == True:
- c = int(y) / int(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == '#':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.sqrt (z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == '**':
- print ("Please Enter Your First Number:")
- tts.say("Please enter your first number")
- y = input()
- if is_number(y) == True:
- print ("Please Enter Your Second Number:")
- tts.say("Please enter your second number")
- z = input ()
- if is_number(z) == True:
- c = int(y) ** int(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- else:
- print("Please enter a number and nothing else")
- tts.say("please enter a number and nothing else")
- elif x == 'cos':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.cos(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == "sin":
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.sin(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'tan':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.tan(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'acos':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.acos(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'acosh':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.acosh(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'asin':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.asin(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'atan':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.atan(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'ceil':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.ceil(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'factorial':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.factorial(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- elif x == 'floor':
- print ("Please Enter Your Number:")
- tts.say("Please Enter your number")
- y = input()
- if is_number(y) == True:
- z = int (y)
- c = math.floor(z)
- print ("Your Number Is:",c)
- tts.say("your number is")
- tts.say (str(c))
- else:
- print("Please Enter A Number And Nothing Else")
- tts.say("please enter a number and nothing else")
- else :
- print ("Your Operator Is Incorrect")
- tts.say("your operator is incorrect")
- else :
- print ("I Think Your Command Is Incorrect For Help Please Type \"help\"")
- tts.say("I Think Your Command Is Incorrect For Help Please Type help.")
- elif gel == False:
- def internet():
- try:
- urllib.request.urlopen ("http://ipecho.net/plain")
- return True
- except:
- return False
- print ("ERORR:For Using This Program You Need To Have A Text To Speech Engine Like eSpeak\nIf You Are A Linux User You Can Download And Install eSpeak By This Command:\nsudo apt-get install espeak")
- print ( "If You Are A Windows User You Can Download eSpeak From http://espeak.sourceforge.net/download.html \nOr You Can Download eSpeak From This Program (2.5 MBytes)\nDo You Want Download eSpeak From This Program (y/n)?:")
- pof = input()
- if pof == 'y' or pof == 'Y':
- if internet() == True:
- print ("Starting Download..")
- print ("Downloading File....")
- hh = "http://s9.picofile.com/d/8301732550/64adee64-fe5c-47e6-9096-feb4f227ad0c/setup_espeak_1_48_04.exe"
- file_url = wget.download (hh)
- print ("The setup_espeak-1.48.04.exe File Downloaded. Please Run And Install Downloded File And Reopen The K&S Program")
- doncomp = input()
- else:
- print ("You Are Not Connected To The Internet.Please Connect To The Internet To Download The File")
- ops = input()
- else:
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement