musdb/img.py
def download(self):
        """Download the MUSMAG data if it doesn't exist in processed_folder."""
        from six.moves import urllib
        import zipfile

        if self._check_exists():
            return

        # download files
        try:
            os.makedirs(os.path.join(self.root_dir))
        except OSError as e:
            if e.errno == errno.EEXIST:
                pass
            else:
                raise

        print('Downloading MUSMAG...')
        data = urllib.request.urlopen(self.url)
        filename = 'MUSMAG.zip'
        file_path = os.path.join(self.root_dir, filename)
        with open(file_path, 'wb') as f:
            f.write(data.read())
        zip_ref = zipfile.ZipFile(file_path, 'r')
        zip_ref.extractall(os.path.join(self.root_dir))
        zip_ref.close()
        os.unlink(file_path)

        print('Done!')
Download the MUSMAG data if it doesn't exist in processed_folder.
Download the MUSMAG data if it doesn't exist in processed_folder.
Download the MUSMAG data if it doesn ' t exist in processed_folder .
def download(self):
        from six.moves import urllib
        import zipfile
        if self._check_exists():
            return
        try:
            os.makedirs(os.path.join(self.root_dir))
        except OSError as e:
            if e.errno == errno.EEXIST:
                pass
            else:
                raise
        print('Downloading MUSMAG...')
        data = urllib.request.urlopen(self.url)
        filename = 'MUSMAG.zip'
        file_path = os.path.join(self.root_dir, filename)
        with open(file_path, 'wb') as f:
            f.write(data.read())
        zip_ref = zipfile.ZipFile(file_path, 'r')
        zip_ref.extractall(os.path.join(self.root_dir))
        zip_ref.close()
        os.unlink(file_path)
        print('Done!')
def download ( self ) : from six . moves import urllib import zipfile if self . _check_exists ( ) : return try : os . makedirs ( os . path . join ( self . root_dir ) ) except OSError as e : if e . errno == errno . EEXIST : pass else : raise print ( 'Downloading MUSMAG...' ) data = urllib . request . urlopen ( self . url ) filename = 'MUSMAG.zip' file_path = os . path . join ( self . root_dir , filename ) with open ( file_path , 'wb' ) as f : f . write ( data . read ( ) ) zip_ref = zipfile . ZipFile ( file_path , 'r' ) zip_ref . extractall ( os . path . join ( self . root_dir ) ) zip_ref . close ( ) os . unlink ( file_path ) print ( 'Done!' )
Download the MUSMAG data if it doesn't exist in processed_folder.
Download the MUSMAG data if it doesn ' t exist in processed_folder .
"""Download the MUSMAG data if it doesn't exist in processed_folder.""" # download files
self