From 6568fae30095c84358b9f8be06a3d97b1f1255c2 Mon Sep 17 00:00:00 2001 From: loki1985 Date: Sat, 30 Oct 2021 20:11:58 +0200 Subject: [PATCH] implemented -skippatches option for download cmd --- gogrepoc.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gogrepoc.py b/gogrepoc.py index 1053897..488ad42 100755 --- a/gogrepoc.py +++ b/gogrepoc.py @@ -823,6 +823,9 @@ def check_skip_file(fname, skipfiles): return skipf return None +def check_skip_patch(fname): + return fname.startswith("patch_") + def process_path(path): fpath = path if sys.version_info[0] <= 2: @@ -881,6 +884,7 @@ def process_argv(argv): g1.add_argument('-skipgalaxy', action='store_true', help='skip downloading Galaxy installers (Deprecated)' ) g1.add_argument('-skipstandalone', action='store_true', help='skip downloading standlone installers (Deprecated)') g1.add_argument('-skipshared', action = 'store_true', help ='skip downloading installers shared between Galaxy and standalone (Deprecated)') + g1.add_argument('-skippatches', action = 'store_true', help ='skip downloading patches') g2 = g1.add_mutually_exclusive_group() g2.add_argument('-skipextras', action='store_true', help='skip downloading of any GOG extra files') g2.add_argument('-skipgames', action='store_true', help='skip downloading of any GOG game files (deprecated, use -skipgalaxy -skipstandalone -skipshared instead)') @@ -1481,7 +1485,7 @@ def cmd_import(src_dir, dest_dir,os_list,lang_list,skipextras,skipids,ids,skipga shutil.copy(f, dest_file) -def cmd_download(savedir, skipextras,skipids, dryrun, ids,os_list, lang_list,skipgalaxy,skipstandalone,skipshared, skipfiles,downloadLimit = None): +def cmd_download(savedir, skipextras, skippatches, skipids, dryrun, ids,os_list, lang_list,skipgalaxy,skipstandalone,skipshared, skipfiles,downloadLimit = None): sizes, rates, errors = {}, {}, {} work = Queue() # build a list of work items @@ -1583,7 +1587,7 @@ def gigs(b): if skipextras: item.extras = [] - + if skipstandalone: item.downloads = [] @@ -1685,6 +1689,11 @@ def gigs(b): info(' skip %s (matches "%s")' % (game_item.name, skipfile_skip)) continue + patch_skip = check_skip_patch(game_item.name) + if skippatches and patch_skip: + info(' skip %s (detected as patch)' % (game_item.name)) + continue + dest_file = os.path.join(item_homedir, game_item.name) downloading_file = os.path.join(item_downloaddir, game_item.name) @@ -2537,7 +2546,7 @@ def main(args): time.sleep(args.wait * 60 * 60) if args.downloadlimit is not None: args.downloadlimit = args.downloadlimit*1024.0*1024.0 #Convert to Bytes - cmd_download(args.savedir, args.skipextras, args.skipids, args.dryrun, args.ids,args.os,args.lang,args.skipgalaxy,args.skipstandalone,args.skipshared, args.skipfiles,args.downloadlimit) + cmd_download(args.savedir, args.skipextras, args.skippatches, args.skipids, args.dryrun, args.ids,args.os,args.lang,args.skipgalaxy,args.skipstandalone,args.skipshared, args.skipfiles,args.downloadlimit) elif args.command == 'import': #Hardcode these as false since extras currently do not have MD5s as such skipgames would give nothing and skipextras would change nothing. The logic path and arguments are present in case this changes, though commented out in the case of arguments) args.skipgames = False