Added settings library
This commit is contained in:
60
TVEncoder.py
60
TVEncoder.py
@@ -7,27 +7,69 @@ Created on Fri Jul 5 14:14:22 2013
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import getopt
|
import getopt
|
||||||
|
import libfilemanager
|
||||||
|
import libsettings
|
||||||
|
import libhandbrake
|
||||||
|
|
||||||
|
def ShowHelp():
|
||||||
|
print 'TVEncoder.py -p -n <number of files to prepare for processing> - prepare n recordings'
|
||||||
|
print 'TVEncoder.py -p -l -n <number of files to process> - lists the files that will be processed without actually encoding them'
|
||||||
|
print 'TVEncoder.py -e - encode the files that have been processed'
|
||||||
|
print 'TVEncoder.py -e -l - list the files that would be encoded'
|
||||||
|
|
||||||
|
def PrintShowsToEncode(showData):
|
||||||
|
print "/n".join(showData)
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
numFiles = 0
|
numFiles = 0
|
||||||
doEncode = True
|
doEncode = False
|
||||||
|
readOnly = True
|
||||||
|
doList = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv,"hn:l")
|
opts, args = getopt.getopt(argv,"hlpen:")
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
print 'TVEncoder.py -n <number of files to process> - processes n recordings'
|
ShowHelp()
|
||||||
print 'TVEncoder.py -l -n <number of files to process> - lists the files that will be processed without actually encoding them'
|
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
if opt == '-h':
|
if opt == '-h':
|
||||||
print 'TVEncoder.py -n <number of files to process> - processes n recordings'
|
ShowHelp()
|
||||||
print 'TVEncoder.py -l -n <number of files to process> - lists the files that will be processed without actually encoding them'
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
elif opt == "-p":
|
||||||
|
doEncode = False
|
||||||
|
readOnly = False
|
||||||
|
elif opt == "-e":
|
||||||
|
readOnly = False
|
||||||
|
doEncode = True
|
||||||
elif opt == "-n":
|
elif opt == "-n":
|
||||||
numFiles = arg
|
numFiles = arg
|
||||||
elif opt == "-l"):
|
elif opt == "-l":
|
||||||
doEncode = True
|
readOnly = True
|
||||||
|
doList = True
|
||||||
|
|
||||||
print "Get to work"
|
shows = Settings("")
|
||||||
|
|
||||||
|
if readOnly and doList:
|
||||||
|
if doEncode:
|
||||||
|
#Generate the list of files that would be encoded
|
||||||
|
showData = GetEncodingFiles(shows, readOnly)
|
||||||
|
PrintShowsToEncode(showData)
|
||||||
|
else:
|
||||||
|
# Generate the list of files to process
|
||||||
|
else:
|
||||||
|
if doEncode:
|
||||||
|
#Encode the files and move them to their final destination
|
||||||
|
showData = GetEncodingFiles(shows, readOnly)
|
||||||
|
|
||||||
|
for show in showData:
|
||||||
|
if CheckFileExists(show.outputFile):
|
||||||
|
print "File {0} already exists. Cannot process.".format(show.outputFile)
|
||||||
|
else:
|
||||||
|
result = Encoder.Encode(show.inputFile, show.outputFile)
|
||||||
|
|
||||||
|
PerformPostEncodeFileOperations(show.inputFile, show.outputFile)
|
||||||
|
else:
|
||||||
|
#Process files for encoding
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main(sys.argv[1:])
|
main(sys.argv[1:])
|
||||||
7
libsettings.py
Normal file
7
libsettings.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Created on Fri Jul 5 20:14:15 2013
|
||||||
|
|
||||||
|
@author: shanef
|
||||||
|
"""
|
||||||
|
|
||||||
Reference in New Issue
Block a user