add ignoreextensions

This commit is contained in:
Clinton Hall 2013-03-08 19:26:21 -08:00
commit 99779d19f9

View file

@ -2,9 +2,7 @@ import sys
import os import os
import ConfigParser import ConfigParser
import logging import logging
from subprocess import call
from nzbToMediaEnv import *
from nzbToMediaSceneExceptions import process_all_exceptions
Logger = logging.getLogger() Logger = logging.getLogger()
@ -21,6 +19,7 @@ def Transcode_file(filePath):
duplicate = config.get("Transcoder", "duplicate") duplicate = config.get("Transcoder", "duplicate")
ffmpeg = os.path.normpath(config.get("Transcoder", "ffmpeg")) ffmpeg = os.path.normpath(config.get("Transcoder", "ffmpeg"))
ignoreExtensions = (config.get("Transcoder", "ignoreExtensions")).split(',')
outputVideoExtension = config.get("Transcoder", "outputVideoExtension") outputVideoExtension = config.get("Transcoder", "outputVideoExtension")
outputVideoCodec = config.get("Transcoder", "outputVideoCodec") outputVideoCodec = config.get("Transcoder", "outputVideoCodec")
outputVideoFramrate = config.get("Transcoder", "outputVideoFramrate") outputVideoFramrate = config.get("Transcoder", "outputVideoFramrate")
@ -29,6 +28,11 @@ def Transcode_file(filePath):
outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate") outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate")
name, ext = os.path.splitext(file) name, ext = os.path.splitext(file)
if ext in ignoreExtensions:
Logger.info("No need to transcode video type %s", ext)
return 0 # exit Transcoder.
if ext == outputVideoExtension: # we need to change the name to prevent overwriting itself.
outputVideoExtension = '-transcoded' + outputVideoExtension # adds '-transcoded.ext'
newfilePath = os.path.normpath(name + outputVideoExtension) newfilePath = os.path.normpath(name + outputVideoExtension)
command = [ffmpeg, '-i', filePath] command = [ffmpeg, '-i', filePath]
@ -49,7 +53,7 @@ def Transcode_file(filePath):
command.append(outputAudioBitrate) command.append(outputAudioBitrate)
command.append(newfilePath) command.append(newfilePath)
Logger.info("Transcoding video %s to %s", filePath, newfilePath) Logger.debug("Transcoding video %s to %s", filePath, newfilePath)
try: try:
result = call(command) result = call(command)
except e: except e: