add xbox default. Fixes #513. Minor fix to subs extract. #512

This commit is contained in:
clinton-hall 2014-08-01 15:36:41 +09:30
parent 0a8b512645
commit d87110db64
7 changed files with 26 additions and 7 deletions

View file

@ -6,6 +6,7 @@ import urllib2
import traceback
import nzbtomedia
import json
import shutil
from subprocess import call
from nzbtomedia import logger
from nzbtomedia.nzbToMediaUtil import makeDir
@ -393,7 +394,10 @@ def extract_subs(file, newfilePath, bitbucket):
subdir = os.path.split(newfilePath)[0]
name = os.path.splitext(os.path.split(newfilePath)[1])[0]
subStreams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle" and item["tags"]["language"] in nzbtomedia.SLANGUAGES and item["codec_name"] != "hdmv_pgs_subtitle"]
try:
subStreams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle" and item["tags"]["language"] in nzbtomedia.SLANGUAGES and item["codec_name"] != "hdmv_pgs_subtitle"]
except:
subStreams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle" and item["codec_name"] != "hdmv_pgs_subtitle"]
num = len(subStreams)
for n in range(num):
sub = subStreams[n]
@ -424,9 +428,12 @@ def extract_subs(file, newfilePath, bitbucket):
logger.error("Extracting subtitle has failed")
if result == 0:
try:
shutil.copymode(file, outputFile)
except: pass
logger.info("Extracting %s subtitle from %s has succeeded" % (lan, file))
else:
logger.error("Extracting subtitles has failed")
logger.error("Extracting subtitles has failed")
def Transcode_directory(dirName):
if platform.system() == 'Windows':
@ -482,6 +489,9 @@ def Transcode_directory(dirName):
logger.error("Transcoding of video %s has failed" % (file))
if result == 0:
try:
shutil.copymode(file, newfilePath)
except: pass
logger.info("Transcoding of video %s to %s succeeded" % (file, newfilePath))
if not nzbtomedia.DUPLICATE and os.path.isfile(newfilePath): # we get rid of the original file
os.unlink(file)