Cleanup some code (see desc)

* `--get-comments` doesn't imply `--write-info-json` if `-J`, `-j` or `--print-json` are used
* Don't pass `config_location` to `YoutubeDL` (it is unused)
* [bilibiliaudio] Recognize the file as audio-only
* Update gitignore
* Fix typos
This commit is contained in:
pukkandan 2021-02-28 20:55:32 +05:30
parent 277d6ff5f2
commit f0884c8b3f
5 changed files with 16 additions and 7 deletions

8
.gitignore vendored
View File

@ -8,6 +8,7 @@ dist/
zip/ zip/
tmp/ tmp/
venv/ venv/
completions/
# Misc # Misc
*~ *~
@ -34,8 +35,9 @@ README.txt
*.spec *.spec
# Binary # Binary
youtube-dl /youtube-dl
youtube-dlc /youtube-dlc
/yt-dlp
yt-dlp.zip yt-dlp.zip
*.exe *.exe
@ -50,12 +52,14 @@ yt-dlp.zip
*.m4v *.m4v
*.mp3 *.mp3
*.3gp *.3gp
*.webm
*.wav *.wav
*.ape *.ape
*.mkv *.mkv
*.swf *.swf
*.part *.part
*.ytdl *.ytdl
*.dump
*.frag *.frag
*.frag.urls *.frag.urls
*.aria2 *.aria2

View File

@ -652,7 +652,7 @@ Then simply run `make`. You can also run `make yt-dlp` instead to compile only t
similar syntax to the output template can similar syntax to the output template can
also be used. The parsed parameters replace also be used. The parsed parameters replace
any existing values and can be use in any existing values and can be use in
output templateThis option can be used output template. This option can be used
multiple times. Example: --parse-metadata multiple times. Example: --parse-metadata
"title:%(artist)s - %(title)s" matches a "title:%(artist)s - %(title)s" matches a
title like "Coldplay - Paradise". Example title like "Coldplay - Paradise". Example

View File

@ -268,6 +268,11 @@ def _real_main(argv=None):
any_printing = opts.print_json any_printing = opts.print_json
download_archive_fn = expand_path(opts.download_archive) if opts.download_archive is not None else opts.download_archive download_archive_fn = expand_path(opts.download_archive) if opts.download_archive is not None else opts.download_archive
# If JSON is not printed anywhere, but comments are requested, save it to file
printing_json = opts.dumpjson or opts.print_json or opts.dump_single_json
if opts.getcomments and not printing_json:
opts.writeinfojson = True
def report_conflict(arg1, arg2): def report_conflict(arg1, arg2):
write_string('WARNING: %s is ignored since %s was given\n' % (arg2, arg1), out=sys.stderr) write_string('WARNING: %s is ignored since %s was given\n' % (arg2, arg1), out=sys.stderr)
if opts.remuxvideo and opts.recodevideo: if opts.remuxvideo and opts.recodevideo:
@ -472,7 +477,7 @@ def _real_main(argv=None):
'updatetime': opts.updatetime, 'updatetime': opts.updatetime,
'writedescription': opts.writedescription, 'writedescription': opts.writedescription,
'writeannotations': opts.writeannotations, 'writeannotations': opts.writeannotations,
'writeinfojson': opts.writeinfojson or opts.getcomments, 'writeinfojson': opts.writeinfojson,
'allow_playlist_files': opts.allow_playlist_files, 'allow_playlist_files': opts.allow_playlist_files,
'getcomments': opts.getcomments, 'getcomments': opts.getcomments,
'writethumbnail': opts.writethumbnail, 'writethumbnail': opts.writethumbnail,
@ -548,7 +553,6 @@ def _real_main(argv=None):
'postprocessor_args': opts.postprocessor_args, 'postprocessor_args': opts.postprocessor_args,
'cn_verification_proxy': opts.cn_verification_proxy, 'cn_verification_proxy': opts.cn_verification_proxy,
'geo_verification_proxy': opts.geo_verification_proxy, 'geo_verification_proxy': opts.geo_verification_proxy,
'config_location': opts.config_location,
'geo_bypass': opts.geo_bypass, 'geo_bypass': opts.geo_bypass,
'geo_bypass_country': opts.geo_bypass_country, 'geo_bypass_country': opts.geo_bypass_country,
'geo_bypass_ip_block': opts.geo_bypass_ip_block, 'geo_bypass_ip_block': opts.geo_bypass_ip_block,

View File

@ -558,6 +558,7 @@ class BilibiliAudioIE(BilibiliAudioBaseIE):
formats = [{ formats = [{
'url': play_data['cdns'][0], 'url': play_data['cdns'][0],
'filesize': int_or_none(play_data.get('size')), 'filesize': int_or_none(play_data.get('size')),
'vcodec': 'none'
}] }]
song = self._call_api('song/info', au_id) song = self._call_api('song/info', au_id)

View File

@ -369,7 +369,7 @@ def parseOpts(overrideArguments=None):
help='Download only the video, if the URL refers to a video and a playlist') help='Download only the video, if the URL refers to a video and a playlist')
selection.add_option( selection.add_option(
'--yes-playlist', '--yes-playlist',
action='store_false', dest='noplaylist', default=False, action='store_false', dest='noplaylist',
help='Download the playlist, if the URL refers to a video and a playlist') help='Download the playlist, if the URL refers to a video and a playlist')
selection.add_option( selection.add_option(
'--age-limit', '--age-limit',
@ -1143,7 +1143,7 @@ def parseOpts(overrideArguments=None):
'Give field name to extract data from, and format of the field seperated by a ":". ' 'Give field name to extract data from, and format of the field seperated by a ":". '
'Either regular expression with named capture groups or a ' 'Either regular expression with named capture groups or a '
'similar syntax to the output template can also be used. ' 'similar syntax to the output template can also be used. '
'The parsed parameters replace any existing values and can be use in output template' 'The parsed parameters replace any existing values and can be use in output template. '
'This option can be used multiple times. ' 'This option can be used multiple times. '
'Example: --parse-metadata "title:%(artist)s - %(title)s" matches a title like ' 'Example: --parse-metadata "title:%(artist)s - %(title)s" matches a title like '
'"Coldplay - Paradise". ' '"Coldplay - Paradise". '