def download(self, url, fullpath, item): try: df = Download(url, fullpath) df.download() except urllib.error.HTTPError: print("Http Error, skipping") return False self.check_id3_edit(item.podcast.id, fullpath, item) return
def downloadAll(id): keys = ['geo','id','title'] dlist = [] for k in keys: fname = gconfig.metadatadir + '/%s/%s.json' % (id,k) fr = open(fname) data = json.loads(fr.read()) for photo in data['photos']: dlist.append(photo['photo']) fr.close() db = Download(gconfig.tmpdir + '/%s' % id) db.download(dlist)
def download_list(self, url_list: list): for item in url_list: t.log_message('Downloading: ' + item) try: download = Download(item, retries=5) download.download() path = os.path.abspath(download.download_path) _, extension = os.path.splitext(path) if extension[1:] in dict(shutil.get_archive_formats()).keys( ) and self.config.extract_archives: shutil.unpack_archive(path) except Exception as e: t.log_message("ERROR. Download: " + item + ' FAILED.\n' + str(e))
def download_config(self, config_url: str, file_name: str = None): downloader = Download(config_url, file_name) downloader.download()