From d154b663ca782889c12ff85dd2a7a049ec6d95b2 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Wed, 30 Jul 2014 07:16:29 +0930 Subject: [PATCH] fix for no sub languages and avoid hdmv_pgs_subtitle codecs. Fixes #474 --- nzbtomedia/__init__.py | 1 + nzbtomedia/transcoder/transcoder.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nzbtomedia/__init__.py b/nzbtomedia/__init__.py index 21769377..009489db 100644 --- a/nzbtomedia/__init__.py +++ b/nzbtomedia/__init__.py @@ -378,6 +378,7 @@ def initialize(section=None): AINCLUDE = int(CFG["Transcoder"]["allAudioLanguages"]) SLANGUAGES = CFG["Transcoder"]["subLanguages"] if isinstance(SLANGUAGES, str): SLANGUAGES = SLANGUAGES.split(',') + if SLANGUAGES == ['']: SLANGUAGES = [] SINCLUDE = int(CFG["Transcoder"]["allSubLanguages"]) SEXTRACT = int(CFG["Transcoder"]["extractSubs"]) SEMBED = int(CFG["Transcoder"]["embedSubs"]) diff --git a/nzbtomedia/transcoder/transcoder.py b/nzbtomedia/transcoder/transcoder.py index 4370a2f4..174fe1eb 100644 --- a/nzbtomedia/transcoder/transcoder.py +++ b/nzbtomedia/transcoder/transcoder.py @@ -122,7 +122,8 @@ def buildCommands(file, newDir): videoStreams = [item for item in video_details["streams"] if item["codec_type"] == "video"] audioStreams = [item for item in video_details["streams"] if item["codec_type"] == "audio"] subStreams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle"] - + if nzbtomedia.VEXTENSION not in ['.mkv', '.mpegts']: + subStreams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle" and item["codec_name"] != "hdmv_pgs_subtitle"] for video in videoStreams: codec = video["codec_name"] @@ -377,7 +378,7 @@ def extract_subs(file, newfilePath, bitbucket): video_details, result = getVideoDetails(file) if not video_details: return - subStreams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle"] + subStreams = [item for item in video_details["streams"] if item["codec_type"] == "subtitle" and item["codec_name"] != "hdmv_pgs_subtitle"] if nzbtomedia.SUBSDIR: subdir = nzbtomedia.SUBSDIR else: