Initial commit, not quite functional yet
This commit is contained in:
parent
6406263695
commit
0f29bd3b98
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +1,10 @@
|
|||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
||||||
|
# Intellij
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|
||||||
|
29
audio-shrink.py
Normal file
29
audio-shrink.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from optparse import OptionParser
|
||||||
|
import os, shlex, subprocess
|
||||||
|
|
||||||
|
parser = OptionParser()
|
||||||
|
parser.add_option('-i', '--input', dest='fInput')
|
||||||
|
parser.add_option('-o', '--output', dest='fOutput')
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
inputDir = options.fInput
|
||||||
|
outputDir = options.fOutput
|
||||||
|
|
||||||
|
if not outputDir.endswith("/"):
|
||||||
|
outputDir += "/"
|
||||||
|
|
||||||
|
def extractCurrentDirectory(dir):
|
||||||
|
return dir.replace(inputDir, "").replace("/", "", 1)
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk(inputDir):
|
||||||
|
root = extractCurrentDirectory(root)
|
||||||
|
|
||||||
|
# Create the child directory if it doesn't exist so we can put files in it
|
||||||
|
if not os.path.exists(outputDir + root):
|
||||||
|
os.makedirs(outputDir + root)
|
||||||
|
|
||||||
|
for name in files:
|
||||||
|
if name.endswith(".flac"):
|
||||||
|
print("Found File: %s" % name)
|
||||||
|
command = shlex.split("ffmpeg -i \"%s\" -f ogg -c:a libvorbis -q 8 -map 0:0 \"%s\"" % (os.path.abspath(name), outputDir + root + "/" + name))
|
||||||
|
p = subprocess.call(command)
|
Reference in New Issue
Block a user