aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/FileDownloader.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/FileDownloader.py')
-rw-r--r--youtube_dl/FileDownloader.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py
index e496b8a8d..4549dd464 100644
--- a/youtube_dl/FileDownloader.py
+++ b/youtube_dl/FileDownloader.py
@@ -78,7 +78,7 @@ 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 .srt file
+ writesubtitles: Write the video subtitles to a file (default=srt)
onlysubtitles: Downloads only the subtitles of the video
allsubtitles: Downloads all the subtitles of the video
subtitleslang: Language of the subtitles to download
@@ -291,9 +291,9 @@ class FileDownloader(object):
""" Report that the description file is being written """
self.to_screen(u'[info] Writing video description to: ' + descfn)
- def report_writesubtitles(self, srtfn):
+ def report_writesubtitles(self, sub_filename):
""" Report that the subtitles file is being written """
- self.to_screen(u'[info] Writing video subtitles to: ' + srtfn)
+ self.to_screen(u'[info] Writing video subtitles to: ' + sub_filename)
def report_writeinfojson(self, infofn):
""" Report that the metadata file has been written """
@@ -444,12 +444,12 @@ class FileDownloader(object):
# subtitles download errors are already managed as troubles in relevant IE
# that way it will silently go on when used with unsupporting IE
subtitle = info_dict['subtitles'][0]
- (srt_error, srt_lang, srt) = subtitle
+ (sub_error, sub_lang, sub) = subtitle
try:
- srtfn = filename.rsplit('.', 1)[0] + u'.' + srt_lang + u'.srt'
- self.report_writesubtitles(srtfn)
- with io.open(encodeFilename(srtfn), 'w', encoding='utf-8') as srtfile:
- srtfile.write(srt)
+ sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.srt'
+ self.report_writesubtitles(sub_filename)
+ with io.open(encodeFilename(sub_filename), 'w', encoding='utf-8') as subfile:
+ subfile.write(sub)
except (OSError, IOError):
self.trouble(u'ERROR: Cannot write subtitles file ' + descfn)
return
@@ -459,12 +459,12 @@ class FileDownloader(object):
if self.params.get('allsubtitles', False) and 'subtitles' in info_dict and info_dict['subtitles']:
subtitles = info_dict['subtitles']
for subtitle in subtitles:
- (srt_error, srt_lang, srt) = subtitle
+ (sub_error, sub_lang, sub) = subtitle
try:
- srtfn = filename.rsplit('.', 1)[0] + u'.' + srt_lang + u'.srt'
- self.report_writesubtitles(srtfn)
- with io.open(encodeFilename(srtfn), 'w', encoding='utf-8') as srtfile:
- srtfile.write(srt)
+ sub_filename = filename.rsplit('.', 1)[0] + u'.' + sub_lang + u'.srt'
+ self.report_writesubtitles(sub_filename)
+ with io.open(encodeFilename(sub_filename), 'w', encoding='utf-8') as subfile:
+ subfile.write(sub)
except (OSError, IOError):
self.trouble(u'ERROR: Cannot write subtitles file ' + descfn)
return