mirror of
https://github.com/soimort/you-get.git
synced 2025-03-15 04:13:58 +03:00
Merge branch 'develop' of https://github.com/icemoon1987/you-get into icemoon1987-develop
This commit is contained in:
commit
9e9b2ce671
@ -131,6 +131,7 @@ SITES = {
|
|||||||
dry_run = False
|
dry_run = False
|
||||||
json_output = False
|
json_output = False
|
||||||
force = False
|
force = False
|
||||||
|
skip_existing_file_size_check = False
|
||||||
player = None
|
player = None
|
||||||
extractor_proxy = None
|
extractor_proxy = None
|
||||||
cookies = None
|
cookies = None
|
||||||
@ -633,15 +634,22 @@ def url_save(
|
|||||||
while continue_renameing:
|
while continue_renameing:
|
||||||
continue_renameing = False
|
continue_renameing = False
|
||||||
if os.path.exists(filepath):
|
if os.path.exists(filepath):
|
||||||
if not force and file_size == os.path.getsize(filepath):
|
if not force and (file_size == os.path.getsize(filepath) or skip_existing_file_size_check):
|
||||||
if not is_part:
|
if not is_part:
|
||||||
if bar:
|
if bar:
|
||||||
bar.done()
|
bar.done()
|
||||||
log.w(
|
if skip_existing_file_size_check:
|
||||||
'Skipping {}: file already exists'.format(
|
log.w(
|
||||||
tr(os.path.basename(filepath))
|
'Skipping {} without checking size: file already exists'.format(
|
||||||
|
tr(os.path.basename(filepath))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
log.w(
|
||||||
|
'Skipping {}: file already exists'.format(
|
||||||
|
tr(os.path.basename(filepath))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
if bar:
|
if bar:
|
||||||
bar.update_received(file_size)
|
bar.update_received(file_size)
|
||||||
@ -948,8 +956,12 @@ def download_urls(
|
|||||||
|
|
||||||
if total_size:
|
if total_size:
|
||||||
if not force and os.path.exists(output_filepath) and not auto_rename\
|
if not force and os.path.exists(output_filepath) and not auto_rename\
|
||||||
and os.path.getsize(output_filepath) >= total_size * 0.9:
|
and (os.path.getsize(output_filepath) >= total_size * 0.9\
|
||||||
log.w('Skipping %s: file already exists' % output_filepath)
|
or skip_existing_file_size_check):
|
||||||
|
if skip_existing_file_size_check:
|
||||||
|
log.w('Skipping %s without checking size: file already exists' % output_filepath)
|
||||||
|
else:
|
||||||
|
log.w('Skipping %s: file already exists' % output_filepath)
|
||||||
print()
|
print()
|
||||||
return
|
return
|
||||||
bar = SimpleProgressBar(total_size, len(urls))
|
bar = SimpleProgressBar(total_size, len(urls))
|
||||||
@ -1458,6 +1470,10 @@ def script_main(download, download_playlist, **kwargs):
|
|||||||
'-f', '--force', action='store_true', default=False,
|
'-f', '--force', action='store_true', default=False,
|
||||||
help='Force overwriting existing files'
|
help='Force overwriting existing files'
|
||||||
)
|
)
|
||||||
|
download_grp.add_argument(
|
||||||
|
'--skip-existing-file-size-check', action='store_true', default=False,
|
||||||
|
help='Skip existing file without checking file size'
|
||||||
|
)
|
||||||
download_grp.add_argument(
|
download_grp.add_argument(
|
||||||
'-F', '--format', metavar='STREAM_ID',
|
'-F', '--format', metavar='STREAM_ID',
|
||||||
help='Set video format to STREAM_ID'
|
help='Set video format to STREAM_ID'
|
||||||
@ -1544,6 +1560,7 @@ def script_main(download, download_playlist, **kwargs):
|
|||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
|
||||||
global force
|
global force
|
||||||
|
global skip_existing_file_size_check
|
||||||
global dry_run
|
global dry_run
|
||||||
global json_output
|
global json_output
|
||||||
global player
|
global player
|
||||||
@ -1557,6 +1574,8 @@ def script_main(download, download_playlist, **kwargs):
|
|||||||
info_only = args.info
|
info_only = args.info
|
||||||
if args.force:
|
if args.force:
|
||||||
force = True
|
force = True
|
||||||
|
if args.skip_existing_file_size_check:
|
||||||
|
skip_existing_file_size_check = True
|
||||||
if args.auto_rename:
|
if args.auto_rename:
|
||||||
auto_rename = True
|
auto_rename = True
|
||||||
if args.url:
|
if args.url:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user