-
Notifications
You must be signed in to change notification settings - Fork 8
/
cloud189-singer.py
67 lines (61 loc) · 2.58 KB
/
cloud189-singer.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
#!/usr/bin/env python
import PySimpleGUI as sg
import utils
import checkin
from threading import Thread
import shlex
import config
import webbrowser
def Cloud189SignGUI():
utils.load_setting()
sg.theme(config.DEFAULT_THEME)
layout = [
[sg.Text('Cloud189 Signer', size=(40, 1), font=('Any 15'))],
[sg.T('账号,多个账号用#号分割:', font=config.default_font), sg.Input(default_text=config.username, size=(40, 1), key='username')],
[sg.T('密码,多个密码用#号分割:', font=config.default_font), sg.Input(default_text=config.password, size=(40, 1), key='password')],
[sg.Button('签到', key='Sign')],
[sg.Output(size=(90, 20), font=config.default_font)],
[sg.Button('退出', key='Exit', button_color=('white', 'firebrick3')), sg.Button('源码', key='home_page',button_color=('white', 'springgreen4'))]
]
window = sg.Window('天翼云签到', layout,
text_justification='r',
default_element_size=(15, 1),
font=('Any 14'))
while True:
event, values = window.read()
if event in ('Exit', None):
utils.save_setting()
break # exit button clicked
if event == 'Sign':
window.refresh()
username = values['username']
password = values['password']
err = False
if username == "":
err = True
print("账号不能为空!")
if password == "":
err = True
print("密码不能为空!")
if not err:
user_list = username.split("#")
pass_list = password.split("#")
if len(user_list) != len(pass_list):
print("账号和密码个数不对应!")
else:
config.username = username
config.password = password
print('开始签到....')
try:
for i in range(len(user_list)):
str_paras = utils.to_command_paras(user_list[i], pass_list[i])
thread_download = Thread(target=checkin.main, args=[
shlex.split(str_paras)])
thread_download.start()
except Exception as e:
print(e)
elif event == 'home_page':
webbrowser.open_new('https://github.com/xiaogouxo/cloud189-signer')
window.close()
if __name__ == '__main__':
Cloud189SignGUI()