Skip to content

Commit

Permalink
subtitle-encoding option
Browse files Browse the repository at this point in the history
  • Loading branch information
michael committed Mar 20, 2016
1 parent 8ab60a8 commit 01dd0d8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions autoProcess.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ apikey =
[MP4]
ffmpeg = ffmpeg.exe
ffprobe = ffprobe.exe
threads = auto
output_directory =
copy_to =
move_to =
Expand All @@ -38,6 +39,7 @@ audio-channel-bitrate =
subtitle-codec = mov_text
subtitle-language =
subtitle-default-language =
subtitle-encoding = utf-8
fullpathguess = True
convert-mp4 = False
tagfile = True
Expand Down
8 changes: 6 additions & 2 deletions converter/avcodecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,19 @@ def parse_options(self, opt, stream=0):
else:
s = str(0)

if 'encoding' in safe:
if safe['encoding'] is None:
del safe['encoding']

safe = self._codec_specific_parse_options(safe)

optlist = []
if 'encoding' in safe:
optlist.extend(['-sub_charenc', str(safe['encoding'])])
optlist.extend(['-c:s:' + stream, self.ffmpeg_codec_name])
stream = str(stream)
if 'map' in safe:
optlist.extend(['-map', s + ':' + str(safe['map'])])
if 'encoding' in safe:
optlist.extend(['-sub_charenc', str(safe['encoding'])])
if 'path' in safe:
optlist.extend(['-i', str(safe['path'])])
if 'default' in safe:
Expand Down
5 changes: 4 additions & 1 deletion mkvtomp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self, settings=None,
adl=None,
sdl=None,
scodec='mov_text',
subencoding='utf-8',
downloadsubs=True,
processMP4=False,
copyto=None,
Expand Down Expand Up @@ -84,6 +85,7 @@ def __init__(self, settings=None,
self.downloadsubs = downloadsubs
self.subproviders = providers
self.embedsubs = embedsubs
self.subencoding = subencoding

# Import settings
if settings is not None:
Expand Down Expand Up @@ -126,6 +128,7 @@ def importSettings(self, settings):
self.downloadsubs = settings.downloadsubs
self.subproviders = settings.subproviders
self.embedsubs = settings.embedsubs
self.subencoding = settings.subencoding

self.log.debug("Settings imported.")

Expand Down Expand Up @@ -419,7 +422,7 @@ def generateOptions(self, inputfile, original=None):
'map': s.index,
'codec': self.scodec,
'language': s.metadata['language'],
'encoding': 'UTF-8'
'encoding': self.subencoding,
# 'forced': s.sub_forced,
# 'default': s.sub_default
}})
Expand Down
5 changes: 5 additions & 0 deletions readSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self, directory, filename, logger=None):
'subtitle-codec': 'mov_text',
'subtitle-language': '',
'subtitle-default-language': '',
'subtitle-encoding': 'utf-8',
'convert-mp4': 'False',
'fullpathguess': 'True',
'tagfile': 'True',
Expand Down Expand Up @@ -367,6 +368,10 @@ def __init__(self, directory, filename, logger=None):
else:
self.swl = self.swl.replace(' ', '').split(',')

self.subencoding = config.get(section, 'subtitle-encoding').strip().lower()
if self.subencoding == '':
self.subencoding = None

self.adl = config.get(section, 'audio-default-language').strip().lower() # What language to default an undefinied audio language tag to. If blank, it will remain undefined. This is useful for single language releases which tend to leave things tagged as und
if self.adl == "" or len(self.adl) > 3:
self.adl = None
Expand Down

0 comments on commit 01dd0d8

Please sign in to comment.