From 31b6346cbc2f9b865dc05f4370e0969c837b218e Mon Sep 17 00:00:00 2001 From: kabaakaba Date: Fri, 28 Aug 2015 15:45:18 +0300 Subject: [PATCH] added md5 calculation param --- youtube_dl/__init__.py | 3 +++ youtube_dl/options.py | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 55b22c889..44132ab21 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -189,6 +189,8 @@ def _real_main(argv=None): if opts.allsubtitles and not opts.writeautomaticsub: opts.writesubtitles = True + + outtmpl = ((opts.outtmpl is not None and opts.outtmpl) or (opts.format == '-1' and opts.usetitle and '%(title)s-%(id)s-%(format)s.%(ext)s') or (opts.format == '-1' and '%(id)s-%(format)s.%(ext)s') or @@ -372,6 +374,7 @@ def _real_main(argv=None): 'external_downloader_args': external_downloader_args, 'postprocessor_args': postprocessor_args, 'cn_verification_proxy': opts.cn_verification_proxy, + 'md5': opts.md5 } with YoutubeDL(ydl_opts) as ydl: diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 9016e3498..f39960061 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -162,9 +162,9 @@ def parseOpts(overrideArguments=None): '--ignore-config', action='store_true', help='Do not read configuration files. ' - 'When given in the global configuration file /etc/youtube-dl.conf: ' - 'Do not read the user configuration in ~/.config/youtube-dl/config ' - '(%APPDATA%/youtube-dl/config.txt on Windows)') + 'When given in the global configuration file /etc/youtube-dl.conf: ' + 'Do not read the user configuration in ~/.config/youtube-dl/config ' + '(%APPDATA%/youtube-dl/config.txt on Windows)') general.add_option( '--flat-playlist', action='store_const', dest='extract_flat', const='in_playlist', @@ -175,6 +175,11 @@ def parseOpts(overrideArguments=None): action='store_true', dest='no_color', default=False, help='Do not emit color codes in output') + general.add_option( + '--md5', + action='store_true', dest='md5', + default=False, + help='Calculate md5 of video and save in file') network = optparse.OptionGroup(parser, 'Network Options') network.add_option( @@ -204,7 +209,7 @@ def parseOpts(overrideArguments=None): '--cn-verification-proxy', dest='cn_verification_proxy', default=None, metavar='URL', help='Use this proxy to verify the IP address for some Chinese sites. ' - 'The default proxy specified by --proxy (or none, if the options is not present) is used for the actual downloading. (experimental)' + 'The default proxy specified by --proxy (or none, if the options is not present) is used for the actual downloading. (experimental)' ) selection = optparse.OptionGroup(parser, 'Video Selection')