-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d81fd62
commit 2d9e96d
Showing
9 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# In window to display notification we have differnet modues we are going to use the plyer moduels | ||
"""" | ||
Author: Bablu | ||
Date: 28 july 2020 | ||
Purpose: Learning the practical implementaion of covid 19 notification on the windows machine | ||
""" | ||
# pip install plyer | ||
|
||
# if you wnat to runt everyhour then keep into the while loop | ||
|
||
from plyer import notification | ||
from bs4 import BeautifulSoup | ||
import time | ||
# soup = BeautifulSoup(html_doc, 'html.parser') | ||
|
||
def notifyMe(title, message): | ||
notification.notify( | ||
title=title, | ||
message=message, | ||
app_icon="icon.ico", | ||
timeout=10 | ||
) | ||
|
||
def getdata(url): | ||
import requests | ||
r = requests.get(url) | ||
return r.text | ||
|
||
if __name__ == '__main__': | ||
# notifyMe("Bablu ", "Let get it done") | ||
myHtmlData = getdata("https://www.mohfw.gov.in/") | ||
# print(myHtmlData) | ||
soup = BeautifulSoup(myHtmlData, 'html.parser') | ||
#print(soup.prettify()) | ||
myDatastr = "" | ||
for tr in soup.find_all('tbody')[1].find_all('tr'): | ||
#print(tr.get_text()) | ||
myDatastr = tr.get_text() | ||
myDatastr = myHtmlData[1:] | ||
itemlist = myDatastr.split("\n\n") | ||
|
||
states = ['chandighar','telangana','haryana','telangana'] | ||
for item in itemlist[0:22]: | ||
datalist = item.split("\n") | ||
if datalist[1] in states: | ||
print(datalist) | ||
nTitle = 'Cases of Covid 19' | ||
nText = f" State {datalist[1]} \n Indian: {datalist[2]} \n Foriegn : {datalist[3]} \n Cured : {datalist[4]}\n Deaths:{datalist[5]}\n" | ||
notifyMe(nTitle,nText) | ||
time.sleep(5) | ||
#print(item) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# In window to display notification we have differnet modues we are going to use the plyer moduels | ||
"""" | ||
Author: Bablu | ||
Date: 28 july 2020 | ||
Purpose: Learning the practical implementaion of covid 19 notification on the windows machine | ||
""" | ||
# pip install plyer | ||
|
||
# if you wnat to runt everyhour then keep into the while loop | ||
|
||
from plyer import notification | ||
from bs4 import BeautifulSoup | ||
import time | ||
# soup = BeautifulSoup(html_doc, 'html.parser') | ||
|
||
def notifyMe(title, message): | ||
notification.notify( | ||
title=title, | ||
message=message, | ||
app_icon="icon.ico", | ||
timeout=6 | ||
) | ||
|
||
def getdata(url): | ||
import requests | ||
r = requests.get(url) | ||
return r.text | ||
|
||
if __name__ == '__main__': | ||
# notifyMe("Bablu ", "Let get it done") | ||
myHtmlData = getdata("https://www.mygov.in/covid-19#info-2") | ||
# print(myHtmlData) | ||
soup = BeautifulSoup(myHtmlData, 'html.parser') | ||
# print(soup) | ||
mystringdata = "" | ||
for item in soup.find_all(id="stateCount"): | ||
mystringdata = item.get_text() | ||
|
||
#print(item.get_text()) | ||
#print(mystringdata) | ||
mystringdata = mystringdata.split("\n") | ||
#print(mystringdata) | ||
mystringdata = [string for string in mystringdata if len(string)!=0] | ||
print(mystringdata) | ||
states = [ "Andhra Pradesh","Haryana","Madhya Pradesh","Telengana"] | ||
for item in range(len(mystringdata)): | ||
if mystringdata[item] in states: | ||
ntitle = "Covid 19 State wise Status India 2020 " | ||
nText = f" State is :{mystringdata[item]} \nTotal infected: {mystringdata[item+1]} \nConfirmed : {mystringdata[item+2]} \nActive: {mystringdata[item+3]} \nRecoverd: {mystringdata[item+4]} \nDeceased {mystringdata[item+5]} \n " | ||
notifyMe(ntitle, nText) | ||
time.sleep(15) | ||
|
||
|
||
|
||
|
||
|
||
#mystringdata = mystringdata[1:] | ||
#print(mystringdata[1]) | ||
# andhra = mystringdata[1].split("\n") | ||
# #an = mystringdata[1].split("\n") | ||
# #print(an) | ||
# print(andhra) | ||
# ntitle = "Covid 19 State wise Status" | ||
# nText = f" State is :{andhra[1]} and infected are: {andhra[2]}" | ||
# | ||
# | ||
# notifyMe(ntitle, nText) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
beautifulsoup4==4.9.1 | ||
bs4==0.0.1 | ||
certifi==2020.6.20 | ||
chardet==3.0.4 | ||
idna==2.10 | ||
plyer==1.4.3 | ||
requests==2.24.0 | ||
soupsieve==2.0.1 | ||
urllib3==1.25.10 |
78 changes: 78 additions & 0 deletions
78
Python Project 6(Chrome Dinosour automation)/DinosourAutomation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
"""" | ||
Author: Bablu Bambal | ||
Date: 29 july 2020 | ||
Description : making the dinosour of the chrome automate | ||
Problems: | ||
1. Cactus Detection in the image | ||
2. Making the jumping when cactus is near | ||
Packages Required: | ||
pip install pyautogui ## used to automate the click mouse and hit enter key | ||
#plan .. | ||
first using pill grab image and check if a black pixel is there or not then i hit up arrow key | ||
""" | ||
|
||
import pyautogui | ||
import time | ||
from PIL import Image, ImageGrab | ||
from numpy import asarray | ||
|
||
|
||
def hit(key): | ||
pyautogui.keyDown(key) | ||
return | ||
|
||
|
||
def isCollide(data): | ||
# for cactus | ||
for i in range(160, 240): | ||
for j in range(395, 470): | ||
if data[i, j] < 100: | ||
hit("up") | ||
return | ||
|
||
# for birds | ||
for i in range(180, 210): | ||
for j in range(300, 395): | ||
if data[i, j] < 100: | ||
hit("down") | ||
return | ||
return | ||
|
||
|
||
# def takeScreenshot(): | ||
# image = ImageGrab.grab().convert('L') | ||
# return image | ||
|
||
if __name__ == '__main__': | ||
print("Dino Game is going to start in 3 seconds") | ||
time.sleep(5) | ||
hit("up") | ||
|
||
# image = ImageGrab.grab().convert('L') | ||
# # image = takeScreenshot() | ||
# data = image.load() | ||
# # print(data) | ||
# # print(asarray(img)) | ||
# | ||
# #drawing rectangel for cactus | ||
# for i in range(160,240): | ||
# for j in range(395,470): | ||
# data[i, j] = 0 | ||
# #drwaing for birdss | ||
# for i in range(180,210): | ||
# for j in range(300,395): | ||
# data[i, j] = 171 | ||
# ##It shows the image which is captured | ||
# image.show() | ||
|
||
# Playing game in loop | ||
while True: | ||
image = ImageGrab.grab().convert('L') | ||
data = image.load() | ||
isCollide(data) |
11 changes: 11 additions & 0 deletions
11
Python Project 6(Chrome Dinosour automation)/Taking Screenshot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# install pillow into the system | ||
from PIL import Image,ImageGrab | ||
import time | ||
|
||
def takeScreenshot(): | ||
image = ImageGrab.grab() | ||
image.show() | ||
|
||
if __name__ == '__main__': | ||
time.sleep(4) | ||
takeScreenshot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# automatic install the python | ||
|
||
import pyautogui | ||
|
||
pyautogui.keyDown('b') | ||
pyautogui.keyDown('a') | ||
pyautogui.keyDown('b') | ||
pyautogui.keyDown('l') | ||
pyautogui.keyDown('u') |
10 changes: 10 additions & 0 deletions
10
Python Project 6(Chrome Dinosour automation)/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
MouseInfo==0.1.3 | ||
numpy==1.19.1 | ||
Pillow==7.2.0 | ||
PyAutoGUI==0.9.50 | ||
PyGetWindow==0.0.8 | ||
PyMsgBox==1.0.8 | ||
pyperclip==1.8.0 | ||
PyRect==0.1.4 | ||
PyScreeze==0.1.26 | ||
PyTweening==1.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# automatic install the python | ||
|
||
import pyautogui | ||
import time | ||
|
||
stri = "Hi 😁😁😁😁 " | ||
time.sleep(5) | ||
for i in range(3): | ||
pyautogui.write(stri,interval=0.25) | ||
pyautogui.press('enter') | ||
|
||
|
||
pyautogui.write(stri) | ||
pyautogui.press('enter') |