mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
mirror: forward --verbose flag to wget to control output
This commit is contained in:
parent
94e67a7623
commit
79a4c469b3
@ -18,6 +18,22 @@ from . import update
|
|||||||
options = None
|
options = None
|
||||||
|
|
||||||
|
|
||||||
|
def _run_wget(path, urls):
|
||||||
|
if options.verbose:
|
||||||
|
verbose = '--verbose'
|
||||||
|
else:
|
||||||
|
verbose = '--no-verbose'
|
||||||
|
|
||||||
|
os.chdir(path)
|
||||||
|
urls_file = '.fdroid-mirror-wget-input-file'
|
||||||
|
with open(urls_file, 'w') as fp:
|
||||||
|
for url in urls:
|
||||||
|
fp.write(url.split('?')[0] + '\n') # wget puts query string in the filename
|
||||||
|
subprocess.call(['wget', verbose, '--continue', '--user-agent="fdroid mirror"',
|
||||||
|
'--input-file=' + urls_file])
|
||||||
|
os.remove(urls_file)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global options
|
global options
|
||||||
|
|
||||||
@ -141,12 +157,7 @@ def main():
|
|||||||
for f in filelist:
|
for f in filelist:
|
||||||
urls.append(_append_to_url_path(section, app['packageName'], locale, k, f))
|
urls.append(_append_to_url_path(section, app['packageName'], locale, k, f))
|
||||||
|
|
||||||
with open(urls_file, 'w') as fp:
|
_run_wget(sectiondir, urls)
|
||||||
for url in urls:
|
|
||||||
fp.write(url.split('?')[0] + '\n') # wget puts query string in the filename
|
|
||||||
subprocess.call(['wget', '--continue', '--user-agent="fdroid mirror"',
|
|
||||||
'--input-file=' + urls_file])
|
|
||||||
os.remove(urls_file)
|
|
||||||
|
|
||||||
urls = dict()
|
urls = dict()
|
||||||
for app in data['apps']:
|
for app in data['apps']:
|
||||||
@ -161,12 +172,7 @@ def main():
|
|||||||
urls[icondir].append(url)
|
urls[icondir].append(url)
|
||||||
|
|
||||||
for icondir in icondirs:
|
for icondir in icondirs:
|
||||||
os.chdir(os.path.join(basedir, section, icondir))
|
_run_wget(os.path.join(basedir, section, icondir), urls[icondir])
|
||||||
with open(urls_file, 'w') as fp:
|
|
||||||
for url in urls[icondir]:
|
|
||||||
fp.write(url.split('?')[0] + '\n') # wget puts query string in the filename
|
|
||||||
subprocess.call(['wget', '--continue', '--input-file=' + urls_file])
|
|
||||||
os.remove(urls_file)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user