-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitReader.py
More file actions
63 lines (45 loc) · 1.91 KB
/
gitReader.py
File metadata and controls
63 lines (45 loc) · 1.91 KB
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
from types import SimpleNamespace
import requests
def haveLayout(userName):
return_code = requests.get(f"https://raw.githubusercontent.com/{userName}/{userName}/refs/heads/main/files/layout.html").status_code
print("return_code:", return_code)
return return_code == 200
def argsCollector(inputArgs):
if hasattr(inputArgs, "args"):
# Если случайно передали request, возьмём request.args
inputArgs = inputArgs.args
args = {
"person": inputArgs.get('person'),
"width": inputArgs.get('width'),
"height": inputArgs.get('height'),
"IsPhoto": inputArgs.get('type'),
"fps": inputArgs.get('fps'),
"noCache": inputArgs.get('nocache'),
"length": inputArgs.get('length'),
"debug": inputArgs.get('debug'),
"debugvideoname": inputArgs.get('debugvideoname'),
"quality": inputArgs.get('quality'),
"lockfile": inputArgs.get('lockfile'),
}
args = SimpleNamespace(**args)
args.width = int(args.width) if args.width is not None else 910
args.height = int(args.height) if args.height is not None else 513
if args.fps is not None:
args.fps = int(args.fps)
args.IsPhoto = args.IsPhoto in ["image", "photo"]
if args.length is not None:
args.length = float(args.length) if args.length != "auto" else "auto"
elif not args.IsPhoto:
args.length = "auto"
args.noCache = args.noCache == "true" if args.noCache is not None else False
args.debug = args.debug == "true" if args.debug is not None else False
if args.quality is not None and str(args.quality).isdigit():
args.quality = int(args.quality)
else:
args.quality = 90
if args.lockfile is None:
args.lockfile = False
return args
def argsToUrl(request):
args = request.args.to_dict()
return "&".join([f"{key}={value}" for key, value in args.items()])