mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-15 01:32:53 -07:00
Conflicts:
autoProcess/Transcoder.py
This commit is contained in:
commit
c7947952c4
3 changed files with 15 additions and 1 deletions
|
@ -78,7 +78,7 @@ def main(inputDirectory, inputName, inputCategory, inputHash, inputID):
|
||||||
continue # This file has not been recently moved or created, skip it
|
continue # This file has not been recently moved or created, skip it
|
||||||
|
|
||||||
if not (inputCategory == cpsCategory or inputCategory == sbCategory): #process all for non-video categories.
|
if not (inputCategory == cpsCategory or inputCategory == sbCategory): #process all for non-video categories.
|
||||||
Logger.info("MAIN: Found file %s for category %s", filepath, inputCategory)
|
Logger.info("MAIN: Found file %s for category %s", filePath, inputCategory)
|
||||||
copy_link(filePath, targetDirectory, useLink, outputDestination)
|
copy_link(filePath, targetDirectory, useLink, outputDestination)
|
||||||
elif fileExtension in mediaContainer: # If the file is a video file
|
elif fileExtension in mediaContainer: # If the file is a video file
|
||||||
if is_sample(filePath, inputName, minSampleSize): # Ignore samples
|
if is_sample(filePath, inputName, minSampleSize): # Ignore samples
|
||||||
|
|
|
@ -10,6 +10,7 @@ def Transcode_directory(dirName):
|
||||||
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
ffmpeg = os.path.join(os.path.dirname(sys.argv[0]), 'ffmpeg\\bin\\ffmpeg.exe') # note, will need to package in this dir.
|
ffmpeg = os.path.join(os.path.dirname(sys.argv[0]), 'ffmpeg\\bin\\ffmpeg.exe') # note, will need to package in this dir.
|
||||||
|
useNiceness = False
|
||||||
if not os.path.isfile(ffmpeg): # problem
|
if not os.path.isfile(ffmpeg): # problem
|
||||||
Logger.error("ffmpeg not found. ffmpeg needs to be located at: %s", ffmpeg)
|
Logger.error("ffmpeg not found. ffmpeg needs to be located at: %s", ffmpeg)
|
||||||
Logger.info("Cannot transcode files in folder %s", dirName)
|
Logger.info("Cannot transcode files in folder %s", dirName)
|
||||||
|
@ -25,6 +26,7 @@ def Transcode_directory(dirName):
|
||||||
ffmpeg = 'ffmpeg'
|
ffmpeg = 'ffmpeg'
|
||||||
else:
|
else:
|
||||||
ffmpeg = 'ffmpeg'
|
ffmpeg = 'ffmpeg'
|
||||||
|
useNiceness = True
|
||||||
|
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
||||||
|
@ -47,6 +49,8 @@ def Transcode_directory(dirName):
|
||||||
outputAudioCodec = config.get("Transcoder", "outputAudioCodec").strip()
|
outputAudioCodec = config.get("Transcoder", "outputAudioCodec").strip()
|
||||||
outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate").strip()
|
outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate").strip()
|
||||||
outputSubtitleCodec = config.get("Transcoder", "outputSubtitleCodec").strip()
|
outputSubtitleCodec = config.get("Transcoder", "outputSubtitleCodec").strip()
|
||||||
|
if useNiceness:
|
||||||
|
niceness = int(config.get("Transcoder", "niceness"))
|
||||||
|
|
||||||
map(lambda ext: ext.strip(), mediaContainer)
|
map(lambda ext: ext.strip(), mediaContainer)
|
||||||
map(lambda ext: ext.strip(), ignoreExtensions)
|
map(lambda ext: ext.strip(), ignoreExtensions)
|
||||||
|
@ -65,7 +69,15 @@ def Transcode_directory(dirName):
|
||||||
outputVideoExtension = '-transcoded' + outputVideoExtension # adds '-transcoded.ext'
|
outputVideoExtension = '-transcoded' + outputVideoExtension # adds '-transcoded.ext'
|
||||||
newfilePath = os.path.normpath(name + outputVideoExtension)
|
newfilePath = os.path.normpath(name + outputVideoExtension)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
command = [ffmpeg, '-loglevel', 'warning', '-i', filePath, '-map', '0']
|
command = [ffmpeg, '-loglevel', 'warning', '-i', filePath, '-map', '0']
|
||||||
|
=======
|
||||||
|
command = [ffmpeg, '-i', filePath, '-map', '0']
|
||||||
|
|
||||||
|
if useNiceness:
|
||||||
|
command = ['nice', '-%d' % niceness] + command
|
||||||
|
|
||||||
|
>>>>>>> master
|
||||||
if len(outputVideoCodec) > 0:
|
if len(outputVideoCodec) > 0:
|
||||||
command.append('-c:v')
|
command.append('-c:v')
|
||||||
command.append(outputVideoCodec)
|
command.append(outputVideoCodec)
|
||||||
|
|
|
@ -104,6 +104,8 @@ minSampleSize = 200
|
||||||
transcode = 0
|
transcode = 0
|
||||||
###### duplicate =1 will cretae a new file. =0 will replace the original
|
###### duplicate =1 will cretae a new file. =0 will replace the original
|
||||||
duplicate = 1
|
duplicate = 1
|
||||||
|
# Only works on Linux. Highest priority is -20, lowest priority is 19.
|
||||||
|
niceness = 0
|
||||||
ignoreExtensions = .avi,.mkv
|
ignoreExtensions = .avi,.mkv
|
||||||
outputVideoExtension = .mp4
|
outputVideoExtension = .mp4
|
||||||
outputVideoCodec = libx264
|
outputVideoCodec = libx264
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue