Add Transcoder here.

This commit is contained in:
Clinton Hall 2013-03-12 23:26:34 -07:00
commit d288bf2bd7

View file

@ -8,6 +8,7 @@ import time
import json import json
import logging import logging
import Transcoder
from nzbToMediaEnv import * from nzbToMediaEnv import *
from nzbToMediaSceneExceptions import process_all_exceptions from nzbToMediaSceneExceptions import process_all_exceptions
@ -132,6 +133,11 @@ def process(dirName, nzbName=None, status=0):
except ConfigParser.NoOptionError: except ConfigParser.NoOptionError:
web_root = "" web_root = ""
try:
transcode = int(config.get("Transcoder", "transcode"))
except (ConfigParser.NoOptionError, ValueError):
transcode = 0
myOpener = AuthURLOpener(username, password) myOpener = AuthURLOpener(username, password)
nzbName = str(nzbName) # make sure it is a string nzbName = str(nzbName) # make sure it is a string
@ -155,6 +161,16 @@ def process(dirName, nzbName=None, status=0):
process_all_exceptions(nzbName.lower(), dirName) process_all_exceptions(nzbName.lower(), dirName)
if status == 0: if status == 0:
if transcode == 1:
Logger.info("Checking for files to be transcoded")
mediaContainer = (config.get("Torrent", "mediaExtensions")).split(',') # for now, this is in Torrent section...
for dirpath, dirnames, filenames in os.walk(dirName):
for file in filenames:
filePath = os.path.join(dirpath, file)
fileExtension = os.path.splitext(file)[1]
if fileExtension in mediaContainer: # If the file is a video file
result = Transcoder.Transcode_file(filePath)
if method == "manage": if method == "manage":
command = "manage.update" command = "manage.update"
else: else: