mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 08:43:58 +03:00
[common] add new option: --output-filename (close #425)
This commit is contained in:
parent
f3d9c5df2b
commit
d8e2a9333b
@ -101,6 +101,7 @@ force = False
|
|||||||
player = None
|
player = None
|
||||||
extractor_proxy = None
|
extractor_proxy = None
|
||||||
cookies = None
|
cookies = None
|
||||||
|
output_filename = None
|
||||||
|
|
||||||
fake_headers = {
|
fake_headers = {
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
@ -610,6 +611,10 @@ class DummyProgressBar:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_output_filename(urls, title, ext, output_dir, merge):
|
def get_output_filename(urls, title, ext, output_dir, merge):
|
||||||
|
# lame hack for the --output-filename option
|
||||||
|
global output_filename
|
||||||
|
if output_filename: return output_filename
|
||||||
|
|
||||||
merged_ext = ext
|
merged_ext = ext
|
||||||
if (len(urls) > 1) and merge:
|
if (len(urls) > 1) and merge:
|
||||||
from .processor.ffmpeg import has_ffmpeg_installed
|
from .processor.ffmpeg import has_ffmpeg_installed
|
||||||
@ -999,6 +1004,7 @@ def script_main(script_name, download, download_playlist, **kwargs):
|
|||||||
-c | --cookies Load cookies.txt or cookies.sqlite.
|
-c | --cookies Load cookies.txt or cookies.sqlite.
|
||||||
-n | --no-merge Don't merge video parts.
|
-n | --no-merge Don't merge video parts.
|
||||||
-F | --format <STREAM_ID> Video format code.
|
-F | --format <STREAM_ID> Video format code.
|
||||||
|
-O | --output-filename <FILE> Set the output filename.
|
||||||
-o | --output-dir <PATH> Set the output directory for downloaded videos.
|
-o | --output-dir <PATH> Set the output directory for downloaded videos.
|
||||||
-p | --player <PLAYER [options]> Directly play the video with PLAYER like vlc/smplayer.
|
-p | --player <PLAYER [options]> Directly play the video with PLAYER like vlc/smplayer.
|
||||||
-x | --http-proxy <HOST:PORT> Use specific HTTP proxy for downloading.
|
-x | --http-proxy <HOST:PORT> Use specific HTTP proxy for downloading.
|
||||||
@ -1008,8 +1014,8 @@ def script_main(script_name, download, download_playlist, **kwargs):
|
|||||||
--json Output the information of videos in json text without downloading.
|
--json Output the information of videos in json text without downloading.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
short_opts = 'Vhfiuc:nF:o:p:x:y:'
|
short_opts = 'Vhfiuc:nF:O:o:p:x:y:'
|
||||||
opts = ['version', 'help', 'force', 'info', 'url', 'cookies', 'no-merge', 'no-proxy', 'debug', 'json', 'format=', 'stream=', 'itag=', 'output-dir=', 'player=', 'http-proxy=', 'extractor-proxy=', 'lang=']
|
opts = ['version', 'help', 'force', 'info', 'url', 'cookies', 'no-merge', 'no-proxy', 'debug', 'json', 'format=', 'stream=', 'itag=', 'output-filename=', 'output-dir=', 'player=', 'http-proxy=', 'extractor-proxy=', 'lang=']
|
||||||
if download_playlist:
|
if download_playlist:
|
||||||
short_opts = 'l' + short_opts
|
short_opts = 'l' + short_opts
|
||||||
opts = ['playlist'] + opts
|
opts = ['playlist'] + opts
|
||||||
@ -1027,6 +1033,7 @@ def script_main(script_name, download, download_playlist, **kwargs):
|
|||||||
global player
|
global player
|
||||||
global extractor_proxy
|
global extractor_proxy
|
||||||
global cookies
|
global cookies
|
||||||
|
global output_filename
|
||||||
|
|
||||||
info_only = False
|
info_only = False
|
||||||
playlist = False
|
playlist = False
|
||||||
@ -1093,6 +1100,8 @@ def script_main(script_name, download, download_playlist, **kwargs):
|
|||||||
traceback = True
|
traceback = True
|
||||||
elif o in ('-F', '--format', '--stream', '--itag'):
|
elif o in ('-F', '--format', '--stream', '--itag'):
|
||||||
stream_id = a
|
stream_id = a
|
||||||
|
elif o in ('-O', '--output-filename'):
|
||||||
|
output_filename = a
|
||||||
elif o in ('-o', '--output-dir'):
|
elif o in ('-o', '--output-dir'):
|
||||||
output_dir = a
|
output_dir = a
|
||||||
elif o in ('-p', '--player'):
|
elif o in ('-p', '--player'):
|
||||||
|
Loading…
Reference in New Issue
Block a user