Commit 6d4e2a10 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch 'download' into 'master'

Using bob.extension download script

Closes #3

See merge request !11
parents 4acdc2cc fb0424da
Pipeline #34394 passed with stages
in 6 minutes and 40 seconds
......@@ -9,6 +9,7 @@ import os
import sys
import pkg_resources
from bob.db.base.driver import Interface as BaseInterface
from import download_and_unzip
def dumplist(args):
......@@ -118,28 +119,13 @@ def download(arguments):
source_url = ''
import tempfile
import zipfile
if sys.version_info[0] <= 2:
import urllib2 as urllib
import urllib.request as urllib
if not arguments.quiet:
print ("Extracting url `%s' into `%s'" %(source_url, arguments.output_dir))
u = urllib.urlopen(source_url)
f = tempfile.NamedTemporaryFile(suffix = ".zip")
open(, 'wb').write(
z = zipfile.ZipFile(f, mode='r')
members = z.infolist()
for k,m in enumerate(members):
if not arguments.quiet:
print("x [%d/%d] %s" % (k+1, len(members), m.filename,))
z.extract(m, arguments.output_dir)
source_url = ['',
if not os.path.exists(arguments.output_dir):
download_and_unzip(source_url, os.path.join(arguments.output_dir, ""))
return 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment