-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.py
More file actions
53 lines (48 loc) · 916 Bytes
/
proxy.py
File metadata and controls
53 lines (48 loc) · 916 Bytes
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
import os
import subprocess
import sys
from uploader import Upload
class Migration:
'''
Instance of a migration:
transocde a low res proxy file,
then upload it to Drive
'''
def __init__(
self,
baseName,
inPath,
outDir
):
self.baseName = baseName
self.inPath = inPath
self.outDir = outDir
self.outPath = os.path.join(outDir,baseName)
def transcode(self):
command = [
"ffmpeg",
"-i",
self.inPath,
"-crf",
"24",
"-c:v",
"libx264",
"-pix_fmt",
"yuv420p",
"-c:a",
"aac",
"-movflags",
"+faststart",
self.outPath
]
output = subprocess.run(command,stdout=subprocess.PIPE)
print(output.stdout)
def upload(self):
uploading_file = Upload(self.outPath,self.baseName)
uploading_file.login()
uploading_file.upload_it()
def delete_me(self):
try:
os.path.remove(self.outPath)
except:
print("\n\n**\n\ncouldn't delete "+self.outPath)