Skip to content

Wallpaper Feature #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import random as rd
import pyautogui as pyi
from GoogleNews import *
import urllib3
from urllib.request import urlretrieve
import subprocess

engine = pyttsx3.init()
voices = engine.getProperty('voices')
Expand Down Expand Up @@ -128,7 +131,28 @@ def utube():
song = K.replace('play', '')
speak('ok sir, kindly wait')
pywhatkit.playonyt(song)


def wallpaper():
folder = 'YOUR DIRECTORY'
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
except Exception as e:
print(e)
api_key = 'YOUR UNSPLASH API KEY' # Which can be found here https://unsplash.com/developers
url = 'https://api.unsplash.com/photos/random?client_id=' + api_key # pic from unspalsh.com
http = urllib3.PoolManager()
f = http.request('GET', url)
json_string = f.read()
f.close()
parsed_json = json.loads(json_string)
photo = parsed_json['urls']['full']
urlretrieve(photo, "YOUR DIRECTORY/a")
subprocess.call(["killall Dock"], shell=True)
speak('wallpaper changed successfully sir')

if __name__ == "__main__":
wishMe()
while True:
Expand Down Expand Up @@ -284,6 +308,9 @@ def utube():
speak("you won the match")
elif pmove == "pencil" and cmove == "rock":
speak("i won the match")

if 'wallpaper' in query:
wallpaper()

if 'thank you' in query:
speak('pleasure serving you sir!')
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ PyPDF2
pywhatkit

psutil

urllib3