[common] resolve conflict

This commit is contained in:
Mort Yao 2018-02-09 15:31:03 +01:00
commit 53a87c975f
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -845,6 +845,10 @@ def get_output_filename(urls, title, ext, output_dir, merge):
merged_ext = 'ts' merged_ext = 'ts'
return '%s.%s' % (title, merged_ext) return '%s.%s' % (title, merged_ext)
def print_user_agent(faker=False):
urllib_default_user_agent = 'Python-urllib/%d.%d' % sys.version_info[:2]
user_agent = fake_headers['User-Agent'] if faker else urllib_default_user_agent
print('User Agent: %s' % user_agent)
def download_urls( def download_urls(
urls, title, ext, total_size, output_dir='.', refer=None, merge=True, urls, title, ext, total_size, output_dir='.', refer=None, merge=True,
@ -858,6 +862,7 @@ def download_urls(
) )
return return
if dry_run: if dry_run:
print_user_agent(faker=faker)
print('Real URLs:\n%s' % '\n'.join(urls)) print('Real URLs:\n%s' % '\n'.join(urls))
return return
@ -986,6 +991,7 @@ def download_rtmp_url(
): ):
assert url assert url
if dry_run: if dry_run:
print_user_agent(faker=faker)
print('Real URL:\n%s\n' % [url]) print('Real URL:\n%s\n' % [url])
if params.get('-y', False): # None or unset -> False if params.get('-y', False): # None or unset -> False
print('Real Playpath:\n%s\n' % [params.get('-y')]) print('Real Playpath:\n%s\n' % [params.get('-y')])
@ -1009,6 +1015,7 @@ def download_url_ffmpeg(
): ):
assert url assert url
if dry_run: if dry_run:
print_user_agent(faker=faker)
print('Real URL:\n%s\n' % [url]) print('Real URL:\n%s\n' % [url])
if params.get('-y', False): # None or unset ->False if params.get('-y', False): # None or unset ->False
print('Real Playpath:\n%s\n' % [params.get('-y')]) print('Real Playpath:\n%s\n' % [params.get('-y')])