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
commit d87110db64
7 changed files with 26 additions and 7 deletions

View file

@ -278,7 +278,7 @@
externalSubDir = externalSubDir =
# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. # outputDefault. Loads default configs for the selected device. The remaining options below are ignored.
# If you want to use your own profile, leave this blank and set the remaining options below. # If you want to use your own profile, leave this blank and set the remaining options below.
# outputDefault profiles allowed: iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p # outputDefault profiles allowed: iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p
outputDefault = outputDefault =
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg) # hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg)
hwAccel = 0 hwAccel = 0
@ -287,6 +287,7 @@
outputVideoCodec = libx264 outputVideoCodec = libx264
VideoCodecAllow = VideoCodecAllow =
outputVideoPreset = medium outputVideoPreset = medium
outputVideoResolution = 1920:1080
outputVideoFramerate = 24 outputVideoFramerate = 24
outputVideoBitrate = 800000 outputVideoBitrate = 800000
outputAudioCodec = ac3 outputAudioCodec = ac3

View file

@ -189,7 +189,7 @@
# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) # externalSubDir. set the directory where subs should be saved (if not the same directory as the video)
#externalSubDir= #externalSubDir=
# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p). # outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p).
# #
# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. # outputDefault. Loads default configs for the selected device. The remaining options below are ignored.
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.

View file

@ -385,7 +385,7 @@
# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) # externalSubDir. set the directory where subs should be saved (if not the same directory as the video)
#externalSubDir= #externalSubDir=
# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p). # outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p).
# #
# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. # outputDefault. Loads default configs for the selected device. The remaining options below are ignored.
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.

View file

@ -179,7 +179,7 @@
# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) # externalSubDir. set the directory where subs should be saved (if not the same directory as the video)
#externalSubDir = #externalSubDir =
# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p). # outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p).
# #
# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. # outputDefault. Loads default configs for the selected device. The remaining options below are ignored.
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.

View file

@ -197,7 +197,7 @@
# externalSubDir. set the directory where subs should be saved (if not the same directory as the video) # externalSubDir. set the directory where subs should be saved (if not the same directory as the video)
#externalSubDir= #externalSubDir=
# outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p). # outputDefault (None, iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, xbox, Roku-1080p, Roku-720p, Roku-480p).
# #
# outputDefault. Loads default configs for the selected device. The remaining options below are ignored. # outputDefault. Loads default configs for the selected device. The remaining options below are ignored.
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.

View file

@ -491,6 +491,14 @@ def initialize(section=None):
'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None, 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None,
'SCODEC':'mov_text' 'SCODEC':'mov_text'
}, },
'xbox':{
'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,
'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'],
'ACODEC':'ac3','ACODEC_ALLOW':['ac3'],'ABITRATE':None, 'ACHANNELS':6,
'ACODEC2':None,'ACODEC2_ALLOW':[],'ABITRATE2':None, 'ACHANNELS2':None,
'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None,
'SCODEC':'mov_text'
},
'Roku-480p':{ 'Roku-480p':{
'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None, 'VEXTENSION':'.mp4','VCODEC':'libx264','VPRESET':None,'VFRAMERATE':None,'VBITRATE':None,
'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'],

View file

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