-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
74 lines (55 loc) · 1.59 KB
/
test.py
File metadata and controls
74 lines (55 loc) · 1.59 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
64
65
66
67
68
69
70
71
72
73
74
import os
import platform
import tempfile
from converter import Converter
def get_size_video(version: str) -> object:
return version.split('x')
def make_convert(source_video, video_name, version, destination):
video_name = version + '_' + video_name
width, height = get_size_video(version)
destination = os.path.join(destination, video_name)
print(destination)
print("2-. In processing convert")
c = Converter()
conv = c.convert(
source_video,
destination,
{
'format': 'mp4',
'audio': {
'codec': 'aac',
'channels': 2
},
'video': {
'codec': 'hevc',
'width': width,
'height': height,
}
},
timeout=False
)
for time_code in conv:
time_code
print("3-. processed video")
return [destination, video_name]
def get_name_and_path_file(file_path: str) -> str:
if platform.system() == 'Windows':
array_name = file_path.split("\\")
else:
array_name = file_path.split("/")
name = array_name[len(array_name) - 1]
return [
name,
file_path.replace(name, '')
]
def __main__(file_path: str):
versions = ['854x480', '1280x720']
[file_name, destination] = get_name_and_path_file(file_path)
for version in versions:
make_convert(
file_path,
file_name,
version,
destination
)
__main__('path_file')