This repository has been archived by the owner on Oct 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gituwe_batch.py
83 lines (61 loc) · 2.48 KB
/
Gituwe_batch.py
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
75
76
77
78
79
80
81
82
83
import os
import shutil
from os import walk
from pathlib import Path, PureWindowsPath
execPath = os.path.dirname(__file__)
os.chdir(execPath)
if not os.path.isdir("tmp"):
os.makedirs("tmp")
logo = """
:::::::: ::::::::::: ::::::::::: ::: ::: ::: ::: ::::::::::
:+: :+: :+: :+: :+: :+: :+: :+: :+:
+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+
:#: +#+ +#+ +#+ +:+ +#+ +:+ +#+ +#++:++#
+#+ +#+# +#+ +#+ +#+ +#+ +#+ +#+#+ +#+ +#+
#+# #+# #+# #+# #+# #+# #+#+# #+#+# #+#
######## ########### ### ######## ### ### ##########
___ ____ ___ ____ _ _
|__] |__| | | |__|
|__] | | | |___ | |
"""
print(logo)
###
def loop(inf):
# Before beginning, check for temp existance
os.chdir(execPath)
if not os.path.isdir("tmp"):
os.makedirs("tmp")
merge = " -i " + inf + " -o tmp/temp.mkv -e vp9 --no-comb --no-deinterlace --no-detelecine --no-hqdn3d --no-nlmeans --no-unsharp --no-lapsharp --no-deblock -2 -T --encoder-preset VeryFast --loose-anamorphic -a none -b 1000"
# Render
os.system('HandBrakeCLI.exe' + merge)
os.system('ffmpeg.exe' + ffmpegvar)
# Delete temp, so no prompt is thrown for overwrite
shutil.rmtree("tmp")
pass
###
# Find all files in folder, create array with location and file name
# send this to loop until the end of array
# Get location input
locPath = input("What location would you like to mass render? (drag-drop) ")
# Change cwd to input
os.chdir(locPath)
# Walk the dir for all files, delete any that do not end with "gif, mp4, avi, wmv, mkv"
files = []
i=0
for (dirpath, dirnames, filenames) in walk(locPath):
files.extend(filenames)
pass
while i<len(files):
# Construct input file for loop
inf = locPath+"\\"+files[i]
# Change suffix
p = PureWindowsPath(files[i]).with_suffix('.webm')
p = str(p).replace(" ", "_")
print("===============================>>>"+p)
# Create output var
os.chdir(execPath)
ffmpegvar = " -i tmp/temp.mkv -c copy " + locPath+"\\"+p
# Send into loop
loop(inf)
i+=1
pass