1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2026-03-11 00:33:12 +00:00

Linter and misc cleanup

:ci skip dl
This commit is contained in:
pukkandan
2021-01-29 01:02:37 +05:30
parent 64c0d954e5
commit 66c935fb16
11 changed files with 70 additions and 93 deletions

View File

@@ -1119,15 +1119,15 @@ class YoutubeDL(object):
if not ensure_dir_exists(encodeFilename(infofn)):
return
if self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)):
self.to_screen('[info] Playlist description metadata is already present')
self.to_screen('[info] Playlist metadata is already present')
else:
self.to_screen('[info] Writing description playlist metadata as JSON to: ' + infofn)
self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn)
playlist_info = dict(ie_result)
playlist_info.pop('entries')
try:
write_json_file(self.filter_requested_info(playlist_info), infofn)
except (OSError, IOError):
self.report_error('Cannot write playlist description metadata to JSON file ' + infofn)
self.report_error('Cannot write playlist metadata to JSON file ' + infofn)
if self.params.get('writedescription', False):
descfn = replace_extension(
@@ -2144,13 +2144,13 @@ class YoutubeDL(object):
if not ensure_dir_exists(encodeFilename(infofn)):
return
if not self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)):
self.to_screen('[info] Video description metadata is already present')
self.to_screen('[info] Video metadata is already present')
else:
self.to_screen('[info] Writing video description metadata as JSON to: ' + infofn)
self.to_screen('[info] Writing video metadata as JSON to: ' + infofn)
try:
write_json_file(self.filter_requested_info(info_dict), infofn)
except (OSError, IOError):
self.report_error('Cannot write metadata to JSON file ' + infofn)
self.report_error('Cannot write video metadata to JSON file ' + infofn)
return
info_dict['__infojson_filepath'] = infofn

View File

@@ -31,6 +31,7 @@ try:
except ImportError:
NFLTokenGenerator = None
def md5_text(s):
if not isinstance(s, compat_str):
s = compat_str(s)

View File

@@ -2492,8 +2492,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
def get_continuation(continuation, session_token, replies=False):
query = {
'pbj': 1,
'ctoken': continuation,
'pbj': 1,
'ctoken': continuation,
}
if replies:
query['action_get_comment_replies'] = 1

View File

@@ -153,7 +153,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
elif info['ext'] in ['ogg', 'opus']:
if not _has_mutagen:
raise EmbedThumbnailPPError('module mutagen was not found. Please install.')
raise EmbedThumbnailPPError('module mutagen was not found. Please install')
size_regex = r',\s*(?P<w>\d+)x(?P<h>\d+)\s*[,\[]'
size_result = self.run_ffmpeg(thumbnail_filename, thumbnail_filename, ['-hide_banner'])
mobj = re.search(size_regex, size_result)