-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
68 lines (54 loc) · 1.72 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# import notify2
import os
import subprocess
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
import getpass
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
def complete_captcha(browser):
try:
browser.find_element_by_xpath(
'//*[@id="recaptcha-anchor"]/div[1]').click()
except:
return
def accept_cookies(browser):
try:
browser.find_element_by_xpath(
'/html/body/div[4]/div/div/a').click() # Accepting Cookies
except:
return
def close_promo_ad(browser):
try:
browser.find_element_by_xpath('//*[@id="vid-promo-close"]').click()
except:
return
def close_login_box(browser):
try:
browser.find_element_by_xpath('//*[@id="panel-close"]').click()
except:
return
def show_notificaton(first_message, last_message, play=1):
if play:
track_name = first_message.replace(' ', '_')
album_name = last_message.replace(' ', '_')
message = f"{track_name}"
if os.name == 'posix':
title = "Playong"
subprocess.call(['notify-send', title, message])
else:
print(message)
else:
message = f"{first_message} {last_message}! for using the Program!!"
if os.name == 'posix':
title = "Playong"
subprocess.call(['notify-send', title, message])
else:
print(message)
def to_seconds(timer):
minutes = int(timer.split(':')[0])
sec = int(timer.split(':')[1])
return minutes*60+sec
def close_popup_ad(browser):
browser.find_element_by_xpath('//*[@id="idle-unit-dismiss"]').click()