From c9e97a820350fab2d2950c7c6beaee999c8b04fd Mon Sep 17 00:00:00 2001 From: Daniel Demus Date: Fri, 24 Nov 2023 22:30:16 +0100 Subject: [PATCH] Allow to only try certain targets Lightify is rate limited and danfoss has apparently hidden it's content in a zip file and removed previous firmware versions --- fw_downloads.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/fw_downloads.py b/fw_downloads.py index 48a2120..fff63e1 100755 --- a/fw_downloads.py +++ b/fw_downloads.py @@ -15,13 +15,20 @@ parser = argparse.ArgumentParser( prog = 'fw_downloads.py', description = 'Downloads zigbee firmware update files from various sources for the Deconz OTA plugin') parser.add_argument('-v', '--verbose', action='store_true', help='write each file operation to the console') +parser.add_argument('targets', help='Only download from the given targets. If none are specified, all will be tried', nargs='*', choices=['danfoss', 'ikea', 'lightify', 'koenkk']) args = parser.parse_args() print ('%s - Downloadscript started' % f"{datetime.datetime.now():%Y-%m-%d %H:%M:%S}") -Danfoss(args.verbose).perform_downloads() -Ikea(args.verbose).perform_downloads() -GithubKoenkk(args.verbose).perform_downloads() -Lightify(args.verbose).perform_downloads() +fetch_all = not args.targets + +if fetch_all or 'koenkk' in args.targets: + GithubKoenkk(args.verbose).perform_downloads() +if fetch_all or 'ikea' in args.targets: + Ikea(args.verbose).perform_downloads() +if fetch_all or 'lightify' in args.targets: + Lightify(args.verbose).perform_downloads() +if fetch_all or 'danfoss' in args.targets: + Danfoss(args.verbose).perform_downloads() print ('%s - Downloadscript finished' % f"{datetime.datetime.now():%Y-%m-%d %H:%M:%S}")