-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmtranscoder
More file actions
executable file
·39 lines (34 loc) · 1.17 KB
/
mtranscoder
File metadata and controls
executable file
·39 lines (34 loc) · 1.17 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from libs.video import Video
from libs.audio import Audio
from libs.args import args
audio = ['mp3', 'ogg', 'aac', 'flac', '']
video = ['mp4', 'mkv', 'wmv', 'avi', 'flv',
'mov', '3gp', 'vob', 'webm', 'wma', '']
if args.o == '':
args.o = args.i
if args.O == '':
args.O = args.I
if args.b != '':
args.b = '-b:a ' + args.b
if args.t != '':
args.t = '-ss ' + args.t[0] + ' -t ' + args.t[1]
else:
args.t = ''
# Executed from for video
if args.I in video and args.O in video:
video = Video(args.I, args.i, args.O, args.o, args.b, args.t, args.r)
if not video.filter_files():
print(f'\nThere is no .{video.input_midia_format} file(s) in {video.source_path}')
exit()
video.processing_file(video.filter_files())
exit()
# Executed from for video/audio or audio
elif args.I in audio or args.I in video and args.O in audio:
audio = Audio(args.I, args.i, args.O, args.o, args.b, args.t, args.r)
if not audio.filter_files():
print(f'\nThere is no .{audio.input_midia_format} file(s) in {audio.source_path}')
exit()
audio.processing_file(audio.filter_files())
exit()