aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/FileDownloader.py
diff options
context:
space:
mode:
authorIsmael Mejia <iemejia@gmail.com>2013-02-22 03:53:54 +0100
committerFilippo Valsorda <filippo.valsorda@gmail.com>2013-03-20 08:41:54 +0100
commit9e62bc443996c1950de0841997c76d110cb77c6e (patch)
tree22ec9c71c62b4c60b8b98eac4a26735a97e7727d /youtube_dl/FileDownloader.py
parent553d097442ad5ee62d227de2e2703a2377dcf40f (diff)
Added new option '--sub-format' to choose the format of the subtitles to downloade (defaut=srt)
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r--youtube_dl/FileDownloader.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py
index 4549dd464..a041e1219 100644
--- a/youtube_dl/FileDownloader.py
+++ b/youtube_dl/FileDownloader.py
@@ -78,9 +78,10 @@ class FileDownloader(object):
updatetime: Use the Last-modified header to set output file timestamps.
writedescription: Write the video description to a .description file
writeinfojson: Write the video description to a .info.json file
- writesubtitles: Write the video subtitles to a file (default=srt)
+ writesubtitles: Write the video subtitles to a file
onlysubtitles: Downloads only the subtitles of the video
allsubtitles: Downloads all the subtitles of the video
+ subtitlesformat: Subtitle format [sbv/srt] (default=srt)
subtitleslang: Language of the subtitles to download
test: Download only first bytes to test the downloader.
keepvideo: Keep the video file after post-processing
@@ -445,8 +446,9 @@ class FileDownloader(object):
# that way it will silently go on when used with unsupporting IE
subtitle = info_dict['subtitles'][0]
(sub_error, sub_lang, sub) = subtitle
+ sub_format = self.params.get('subtitlesformat')
try:
- sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.srt'
+ sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.' + sub_format
self.report_writesubtitles(sub_filename)
with io.open(encodeFilename(sub_filename), 'w', encoding='utf-8') as subfile:
subfile.write(sub)
@@ -458,10 +460,11 @@ class FileDownloader(object):
if self.params.get('allsubtitles', False) and 'subtitles' in info_dict and info_dict['subtitles']:
subtitles = info_dict['subtitles']
+ sub_format = self.params.get('subtitlesformat')
for subtitle in subtitles:
(sub_error, sub_lang, sub) = subtitle
try:
- sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.srt'
+ sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.' + sub_format
self.report_writesubtitles(sub_filename)
with io.open(encodeFilename(sub_filename), 'w', encoding='utf-8') as subfile:
subfile.write(sub)