Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ede93c9

Browse files
add simple UI
1 parent 55f5ec2 commit ede93c9

File tree

2 files changed

+191
-0
lines changed

2 files changed

+191
-0
lines changed

‎management/format.json‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"status": 1,
3+
"info": "OK",
4+
"data": {
5+
"info": {
6+
"id": 99999,
7+
"cnname": "中文名",
8+
"enname": "英文名",
9+
"aliasname": "别名",
10+
"channel": "movie/tv",
11+
"channel_cn": "电影/美剧",
12+
"area": "法国",
13+
"show_type": "",
14+
"expire": "1610401225",
15+
"views": 0
16+
},
17+
"list": [
18+
{
19+
"season_num": "0",
20+
"season_cn": "正片",
21+
"items": {
22+
"MP4": [
23+
{
24+
"itemid": "428324",
25+
"episode": "0",
26+
"name": "name",
27+
"size": "1.43GB",
28+
"yyets_trans": 0,
29+
"dateline": "1565351112",
30+
"files": [
31+
{
32+
"way": "1",
33+
"way_cn": "电驴",
34+
"address": "",
35+
"passwd": ""
36+
},
37+
{
38+
"way": "2",
39+
"way_cn": "磁力",
40+
"address": "",
41+
"passwd": ""
42+
},
43+
{
44+
"way": "9",
45+
"way_cn": "网盘",
46+
"address": "",
47+
"passwd": ""
48+
},
49+
{
50+
"way": "115",
51+
"way_cn": "微云",
52+
"address": "",
53+
"passwd": ""
54+
}
55+
]
56+
}
57+
]
58+
},
59+
"formats": [
60+
"MP4"
61+
]
62+
}
63+
]
64+
}
65+
}

‎management/ui.py‎

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/usr/local/bin/python3
2+
# coding: utf-8
3+
4+
# YYeTsBot - ui.py
5+
# 2/8/21 17:55
6+
#
7+
8+
__author__ = "Benny <benny.think@gmail.com>"
9+
10+
import PySimpleGUI as sg
11+
import json
12+
13+
# All the stuff inside your window.
14+
channel_map = {
15+
"movie": "电影",
16+
"tv": "电视剧"
17+
}
18+
19+
complete = {
20+
"status": 1,
21+
"info": "OK",
22+
"data": {
23+
"info": {},
24+
"list": [
25+
{
26+
"season_num": "1",
27+
"season_cn": "第一季",
28+
"items": {},
29+
"formats": [
30+
"MP4"
31+
]
32+
}
33+
]
34+
}
35+
}
36+
37+
dl = {
38+
"itemid": "",
39+
"episode": "0",
40+
"name": "",
41+
"size": "",
42+
"yyets_trans": 0,
43+
"dateline": "1565351112",
44+
"files": [
45+
{
46+
"way": "1",
47+
"way_cn": "电驴",
48+
"address": "",
49+
"passwd": ""
50+
},
51+
{
52+
"way": "2",
53+
"way_cn": "磁力",
54+
"address": "",
55+
"passwd": ""
56+
},
57+
{
58+
"way": "9",
59+
"way_cn": "网盘",
60+
"address": "",
61+
"passwd": ""
62+
},
63+
{
64+
"way": "115",
65+
"way_cn": "微云",
66+
"address": "",
67+
"passwd": ""
68+
}
69+
]
70+
}
71+
item_structure = {
72+
"MP4": [
73+
]
74+
}
75+
76+
77+
def get_value():
78+
for i in range(1, int(episode_input[1].get()) + 1):
79+
d = dl.copy()
80+
d["episode"] = str(i)
81+
d["name"] = "{}{}".format(cn_input[1].get(), i)
82+
item_structure["MP4"].append(d)
83+
84+
info_structure = {
85+
"id": 0,
86+
"cnname": cn_input[1].get(),
87+
"enname": en_input[1].get(),
88+
"aliasname": alias_input[1].get(),
89+
"channel": channel_input[1].get(),
90+
"channel_cn": channel_map.get(channel_input[1].get(), ""),
91+
"area": area_input[1].get(),
92+
"show_type": "",
93+
"expire": "1610401225",
94+
"views": 0
95+
}
96+
97+
complete["data"]["info"] = info_structure
98+
complete["data"]["list"] = [item_structure]
99+
100+
with open("sample.json", "w") as f:
101+
json.dump(complete, f, indent=4, ensure_ascii=False)
102+
103+
104+
cn_input = [sg.Text('cn name'), sg.InputText()]
105+
en_input = [sg.Text('en name'), sg.InputText()]
106+
alias_input = [sg.Text('alias name'), sg.InputText()]
107+
channel_input = [sg.Text('channel'), sg.Combo(['movie', 'tv'], "tv")]
108+
area_input = [sg.Text('area'), sg.Combo(['美国', '日本', '韩国', '英国'], "美国")]
109+
episode_input = [sg.Text('episode count'), sg.InputText()]
110+
111+
layout = [cn_input, en_input, alias_input, channel_input, area_input, episode_input,
112+
[sg.Button('Ok')]
113+
]
114+
115+
# Create the Window
116+
window = sg.Window('Management', layout)
117+
# Event Loop to process "events" and get the "values" of the inputs
118+
while True:
119+
event, values = window.read()
120+
if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel
121+
break
122+
if event == "Ok":
123+
print('You entered ', values[0], values[1], values[2])
124+
get_value()
125+
break
126+
window.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /