From 7beda9c74116ceadc09480862b1fac774f6f25f0 Mon Sep 17 00:00:00 2001 From: Dragunovam Date: Thu, 19 May 2022 03:27:02 +0200 Subject: [PATCH] Changed the way the items are downloaded This other methods is safer, the code will not break if a component is missing and can't be downloaded. --- download.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/download.py b/download.py index 4294a61..6c3f8fe 100755 --- a/download.py +++ b/download.py @@ -61,16 +61,22 @@ def download(self): for imgurl in {img.get('{http://www.w3.org/1999/xlink}href') for img in doc.iterfind('.//{http://www.w3.org/2000/svg}image')}: self._get(imgurl) - - self._get('panzooms.xml') - self._get('cursor.xml') - self._get('deskshare.xml') - self._get('presentation_text.json') - self._get('captions.json') - self._get('slides_new.xml') - - self._get('video/webcams.webm') - self._get('deskshare/deskshare.webm') + + components = ['panzooms.xml', + 'cursor.xml', + 'deskshare.xml', + 'presentation_text.json', + 'captions.json', + 'slides_new.xml', + 'video/webcams.webm', + 'deskshare/deskshare.webm'] + + for item in components: + try: + self._get(item) + except Exception: + f"Component {item} not available in presentation" + def main(argv):