From 5b3439c05a90ff1b18062229da808ce1a0bd5d3e Mon Sep 17 00:00:00 2001 From: julesontheroad <42461174+julesontheroad@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:52:13 +0200 Subject: [PATCH 1/2] Move functions to avoid curses messing with prints --- py/ztools/MtpInstallRemote.bat | 12 +- py/ztools/MtpTransferRemote.bat | 12 +- py/ztools/lib/picker_walker.py | 301 +++++++++++++++++++++++++++++++- py/ztools/mtp/mtp_gdrive.py | 238 +------------------------ 4 files changed, 312 insertions(+), 251 deletions(-) diff --git a/py/ztools/MtpInstallRemote.bat b/py/ztools/MtpInstallRemote.bat index b5aef3d8..900aadca 100644 --- a/py/ztools/MtpInstallRemote.bat +++ b/py/ztools/MtpInstallRemote.bat @@ -81,9 +81,9 @@ setlocal enabledelayedexpansion echo+ >"%uinput%" endlocal if /i "%eval%"=="0" goto MAIN -if /i "%eval%"=="1" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_cache -xarg "%prog_dir%MTP1GD.txt" ) -if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_libraries -xarg "%prog_dir%MTP1GD.txt" ) -if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_walker -xarg "%prog_dir%MTP1GD.txt" "nsp nsz" ) +if /i "%eval%"=="1" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_cache -xarg "%prog_dir%MTP1GD.txt" ) +if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_libraries -xarg "%prog_dir%MTP1GD.txt" ) +if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_walker -xarg "%prog_dir%MTP1GD.txt" "nsp nsz" ) if /i "%eval%"=="c" ( %pycommand% "%squirrel%" -lib_call workers concurrent_cache ) echo. goto checkagain @@ -117,9 +117,9 @@ echo+ >"%uinput%" endlocal if /i "%eval%"=="0" goto MAIN if /i "%eval%"=="1" goto select_medium -if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_cache -xarg "%prog_dir%MTP1GD.txt" ) -if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_libraries -xarg "%prog_dir%MTP1GD.txt" ) -if /i "%eval%"=="4" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_walker -xarg "%prog_dir%MTP1GD.txt" "nsp nsz" ) +if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_cache -xarg "%prog_dir%MTP1GD.txt" ) +if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_libraries -xarg "%prog_dir%MTP1GD.txt" ) +if /i "%eval%"=="4" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_walker -xarg "%prog_dir%MTP1GD.txt" "nsp nsz" ) if /i "%eval%"=="c" ( %pycommand% "%squirrel%" -lib_call workers concurrent_cache ) if /i "%eval%"=="e" goto salida if /i "%eval%"=="i" goto showlist diff --git a/py/ztools/MtpTransferRemote.bat b/py/ztools/MtpTransferRemote.bat index 76a4ffca..f7a88372 100644 --- a/py/ztools/MtpTransferRemote.bat +++ b/py/ztools/MtpTransferRemote.bat @@ -81,9 +81,9 @@ setlocal enabledelayedexpansion echo+ >"%uinput%" endlocal if /i "%eval%"=="0" goto MAIN -if /i "%eval%"=="1" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_cache -xarg "%prog_dir%MTP2GD.txt" ) -if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_libraries -xarg "%prog_dir%MTP2GD.txt" ) -if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_walker -xarg "%prog_dir%MTP2GD.txt" ) +if /i "%eval%"=="1" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_cache -xarg "%prog_dir%MTP2GD.txt" ) +if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_libraries -xarg "%prog_dir%MTP2GD.txt" ) +if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_walker -xarg "%prog_dir%MTP2GD.txt" ) if /i "%eval%"=="c" ( %pycommand% "%squirrel%" -lib_call workers concurrent_cache ) echo. goto checkagain @@ -117,9 +117,9 @@ echo+ >"%uinput%" endlocal if /i "%eval%"=="0" goto MAIN if /i "%eval%"=="1" goto START_TRANSFER -if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_cache -xarg "%prog_dir%MTP2GD.txt" ) -if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_libraries -xarg "%prog_dir%MTP2GD.txt" ) -if /i "%eval%"=="4" ( %pycommand% "%squirrel%" -lib_call mtp.mtp_gdrive select_from_walker -xarg "%prog_dir%MTP2GD.txt" ) +if /i "%eval%"=="2" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_cache -xarg "%prog_dir%MTP2GD.txt" ) +if /i "%eval%"=="3" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_libraries -xarg "%prog_dir%MTP2GD.txt" ) +if /i "%eval%"=="4" ( %pycommand% "%squirrel%" -lib_call picker_walker remote_select_from_walker -xarg "%prog_dir%MTP2GD.txt" ) if /i "%eval%"=="c" ( %pycommand% "%squirrel%" -lib_call workers concurrent_cache ) if /i "%eval%"=="e" goto salida if /i "%eval%"=="i" goto showlist diff --git a/py/ztools/lib/picker_walker.py b/py/ztools/lib/picker_walker.py index e867eb52..b00f8397 100644 --- a/py/ztools/lib/picker_walker.py +++ b/py/ztools/lib/picker_walker.py @@ -8,7 +8,11 @@ import shutil from secondary import clear_Screen import csv - +try: + import ujson as json +except: + import json + squirrel_dir=os.path.abspath(os.curdir) NSCB_dir=os.path.abspath('../'+(os.curdir)) if os.path.exists(os.path.join(squirrel_dir,'ztools')): @@ -34,6 +38,9 @@ squirrel=testroute2 isExe=True local_libraries=os.path.join(zconfig_dir,'local_libraries.txt') +remote_lib_file = os.path.join(zconfig_dir, 'remote_libraries.txt') +remote_lib_cache=os.path.join(zconfig_dir, 'remote_lib_cache') +cache_lib_file= os.path.join(zconfig_dir, 'remote_cache_location.txt') def About(): print(' __ _ __ __ ') @@ -53,6 +60,45 @@ def About(): print("Program's github: https://github.com/julesontheroad/NSC_BUILDER ") print('Cheats and Eshop information from nutdb and http://tinfoil.io ') print('------------------------------------------------------------------------------------- ') + +def libraries(tfile): + db={} + try: + with open(tfile,'rt',encoding='utf8') as csvfile: + readCSV = csv.reader(csvfile, delimiter='|') + i=0 + for row in readCSV: + if i==0: + csvheader=row + i=1 + else: + dict_={} + for j in range(len(csvheader)): + try: + if row[j]==None or row[j]=='': + dict_[csvheader[j]]=None + else: + dict_[csvheader[j]]=row[j] + except: + dict_[csvheader[j]]=None + db[row[0]]=dict_ + return db + except BaseException as e: + Print.error('Exception: ' + str(e)) + return False + +def get_cache_lib(): + db=libraries(cache_lib_file) + TD=None;lib=None;path="null";libpath=None + for entry in db: + path=db[entry]['path'] + TD=db[entry]['TD_name'] + lib=entry + libpath=path + break + if TD=='': + TD=None + return lib,TD,libpath def get_disks(): available_drives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)] @@ -362,4 +408,255 @@ def end_selection(picker): for f in selected: fpath=(filedata[f[0]])['filepath'] filespaths.append(fpath) - return filespaths \ No newline at end of file + return filespaths + +def remote_interface_filter(path=None): + title = 'Add a search filter?: ' + options = ['Yes','No'] + selected = pick(options, title, min_selection_count=1) + response=selected[0] + if response=='No': + return None + else: + clear_Screen() + About() + if path != None: + print("Filepath {}\n".format(str(path))) + ck=input('INPUT SEARCH FILTER: ') + return ck + +def remote_interface_filter_local(filelist): + title = 'Add a search filter?: ' + options = ['Yes','No'] + selected = pick(options, title, min_selection_count=1) + response=selected[0] + if response=='No': + return filelist + else: + clear_Screen() + About() + ck=input('INPUT SEARCH FILTER: ') + filelist=listmanager.filter_vlist(filelist,token=ck,Print=False) + return filelist + +def eval_link(tfile,userfile): + link=input("Enter your choice: ") + link=link.strip() + if '&' in link: + varout='999' + elif len(link)<2: + varout=link + else: + varout='999' + with open(userfile,"w", encoding='utf8') as userinput: + userinput.write(varout) + if link.startswith('https://1fichier.com'): + with open(tfile,"a", encoding='utf8') as textfile: + textfile.write(link+'\n') + elif link.startswith('https://drive.google.com'): + with open(tfile,"a", encoding='utf8') as textfile: + textfile.write(link+'\n') + +def drive_pick_libraries(): + title = 'Select libraries to search: \n + Press space or right to select content \n + Press E to finish selection' + db=libraries(remote_lib_file) + if db==False: + return False,False + options = [x for x in db.keys()] + picker = Picker(options, title,multi_select=True,min_selection_count=1) + def end_selection(picker): + return False,-1 + picker.register_custom_handler(ord('e'), end_selection) + picker.register_custom_handler(ord('E'), end_selection) + selected = picker.start() + if selected[0]==False: + return False,False + # print(selected) + paths=list();TDs=list() + for entry in selected: + paths.append((db[entry[0]])['path']) + try: + TDs.append((db[entry[0]])['TD_name']) + except: + TDs.append(None) + # for p in range(len(paths)): + # print(paths[p]) + # print(TDs[p]) + return paths,TDs + +def remote_select_from_libraries(tfile): + from workers import concurrent_scrapper + db=libraries(remote_lib_file) + if db==False: + sys.exit(f"Missing {remote_lib_file}") + paths,TDs=drive_pick_libraries() + if paths==False: + return False + order=pick_order() + if order==False: + return False + filter=remote_interface_filter() + print(" * Parsing files from Google Drive. Please Wait...") + if isinstance(paths, list): + db={} + for i in range(len(paths)): + db[paths[i]]={'path':paths[i],'TD_name':TDs[i]} + files=concurrent_scrapper(filter=filter,order=order,remotelib='all',db=db) + else: + db={} + db[paths]={'path':paths,'TD_name':TDs} + files=concurrent_scrapper(filter=filter,order=order,remotelib='all',db=db) + print(" * Entering File Picker") + title = 'Select content to install or transfer: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection' + filenames=[] + for f in files: + filenames.append(f[0]) + options=filenames + picker = Picker(options, title, multi_select=True, min_selection_count=1) + def end_selection(picker): + return False,-1 + picker.register_custom_handler(ord('e'), end_selection);picker.register_custom_handler(ord('E'), end_selection) + selected=picker.start() + if selected[0]==False: + print(" User didn't select any files") + return False + with open(tfile,'a') as textfile: + for f in selected: + textfile.write((files[f[1]])[2]+'/'+(files[f[1]])[0]+'\n') + +def remote_select_from_cache(tfile): + from workers import concurrent_scrapper + cache_is_setup=False + if not os.path.exists(remote_lib_cache): + os.makedirs(remote_lib_cache) + jsonlist=listmanager.folder_to_list(remote_lib_cache,extlist=['json']) + if not jsonlist: + print("Cache wasn't found. Generating cache up...") + from workers import concurrent_cache + concurrent_cache() + jsonlist=listmanager.folder_to_list(remote_lib_cache,extlist=['json']) + if not jsonlist: + sys.exit("Can't setup remote cache. Are libraries set up?") + libnames=[] + for j in jsonlist: + bname=os.path.basename(j) + bname=bname.replace('.json','') + libnames.append(bname) + title = 'Select libraries to search: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection \n + Press A to select all libraries' + db=libraries(remote_lib_file) + options = libnames + picker = Picker(options, title,multi_select=True,min_selection_count=1) + def end_selection(picker): + return False,-1 + def select_all(picker): + return True,libnames + picker.register_custom_handler(ord('e'), end_selection) + picker.register_custom_handler(ord('E'), end_selection) + picker.register_custom_handler(ord('a'), select_all) + picker.register_custom_handler(ord('A'), select_all) + selected = picker.start() + if selected[0]==False: + print("User didn't select any libraries") + return False,False + if selected[0]==True: + cachefiles=jsonlist + else: + cachefiles=[] + for entry in selected: + fname=entry[0]+'.json' + fpath=os.path.join(remote_lib_cache,fname) + cachefiles.append(fpath) + cachedict={} + for cach in cachefiles: + with open(cach) as json_file: + data = json.load(json_file) + for entry in data: + if not entry in cachedict: + cachedict[entry]=data[entry] + # for k in cachedict.keys(): + # print(k) + order=pick_order() + if order==False: + return False + options=[] + if order=='name_ascending': + options=sorted(cachedict,key=lambda x:cachedict[x]['filepath']) + elif order=='name_descending': + options=sorted(cachedict,key=lambda x:cachedict[x]['filepath']) + options.reverse() + elif order=='size_ascending': + options=sorted(cachedict,key=lambda x:cachedict[x]['size']) + elif order=='size_descending': + options=sorted(cachedict,key=lambda x:cachedict[x]['size']) + options.reverse() + elif order=='date_ascending': + options=sorted(cachedict,key=lambda x:cachedict[x]['date']) + elif order=='date_descending': + options=sorted(cachedict,key=lambda x:cachedict[x]['date']) + options.reverse() + options=remote_interface_filter_local(options) + print(" * Entering File Picker") + title = 'Select content to install or transfer: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection' + picker = Picker(options, title, multi_select=True, min_selection_count=1) + def end_selection(picker): + return False,-1 + picker.register_custom_handler(ord('e'), end_selection);picker.register_custom_handler(ord('E'), end_selection) + selected=picker.start() + if selected[0]==False: + print(" User didn't select any files") + return False + with open(tfile,'a') as textfile: + for f in selected: + fpath=(cachedict[f[0]])['filepath'] + textfile.write(fpath+'\n') + +def remote_select_from_walker(tfile,types='all'): + from workers import concurrent_scrapper + from Drive import Private as DrivePrivate + ext=[] + if types!='all': + items=types.split(' ') + for x in items: + ext.append(str(x).lower()) + folder,TeamDrive=DrivePrivate.folder_walker() + if TeamDrive=="" or TeamDrive==False: + TeamDrive=None + if folder==False: + return False + filt=remote_interface_filter() + order=pick_order() + if order==False: + return False + print(f"- Checking {folder}") + print(" * Parsing files from Google Drive. Please Wait...") + db={} + db[folder]={'path':folder,'TD_name':TeamDrive} + files=concurrent_scrapper(filter=filt,order=order,remotelib='all',db=db) + if files==False: + return False + print(" * Entering File Picker") + title = 'Select content to install or transfer: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection' + filenames=[] + for f in files: + if types=='all': + filenames.append(f[0]) + else: + for x in ext: + if (str(f[0]).lower()).endswith(x): + filenames.append(f[0]) + break + if filenames==[]: + print(" * Request didn't retrieve any files") + return False + options=filenames + picker = Picker(options, title, multi_select=True, min_selection_count=1) + def end_selection(picker): + return False,-1 + picker.register_custom_handler(ord('e'), end_selection);picker.register_custom_handler(ord('E'), end_selection) + selected=picker.start() + if selected[0]==False: + print(" User didn't select any files") + return False + with open(tfile,'a') as textfile: + for f in selected: + textfile.write((files[f[1]])[2]+'/'+(files[f[1]])[0]+'|'+str(TeamDrive)+'\n') \ No newline at end of file diff --git a/py/ztools/mtp/mtp_gdrive.py b/py/ztools/mtp/mtp_gdrive.py index 6e3f3fea..dde78862 100644 --- a/py/ztools/mtp/mtp_gdrive.py +++ b/py/ztools/mtp/mtp_gdrive.py @@ -163,193 +163,6 @@ def addtodrive(filename,truecopy=True): globalremote=remote return filename -def interface_filter(path=None): - title = 'Add a search filter?: ' - options = ['Yes','No'] - selected = pick(options, title, min_selection_count=1) - response=selected[0] - if response=='No': - return None - else: - clear_Screen() - About() - if path != None: - print("Filepath {}\n".format(str(path))) - ck=input('INPUT SEARCH FILTER: ') - return ck - -def pick_order(): - title = 'Select order to list the files: \n + Press enter or intro to select \n + Press E to scape back to menu' - db=libraries(download_lib_file) - options = ['name_ascending','name_descending','size_ascending','size_descending','date_ascending','date_descending'] - picker = Picker(options, title, min_selection_count=1) - def end_selection(picker): - return False,-1 - picker.register_custom_handler(ord('e'), end_selection) - picker.register_custom_handler(ord('E'), end_selection) - selected = picker.start() - if selected[0]==False: - return False - order=selected[0] - return order - -def interface_filter_local(filelist): - title = 'Add a search filter?: ' - options = ['Yes','No'] - selected = pick(options, title, min_selection_count=1) - response=selected[0] - if response=='No': - return filelist - else: - clear_Screen() - About() - ck=input('INPUT SEARCH FILTER: ') - filelist=listmanager.filter_vlist(filelist,token=ck,Print=False) - return filelist - -def eval_link(tfile,userfile): - link=input("Enter your choice: ") - link=link.strip() - if '&' in link: - varout='999' - elif len(link)<2: - varout=link - else: - varout='999' - with open(userfile,"w", encoding='utf8') as userinput: - userinput.write(varout) - if link.startswith('https://1fichier.com'): - with open(tfile,"a", encoding='utf8') as textfile: - textfile.write(link+'\n') - elif link.startswith('https://drive.google.com'): - with open(tfile,"a", encoding='utf8') as textfile: - textfile.write(link+'\n') - -def select_from_libraries(tfile): - db=libraries(remote_lib_file) - if db==False: - sys.exit(f"Missing {remote_lib_file}") - paths,TDs=Drv.pick_libraries() - if paths==False: - return False - filter=interface_filter() - order=pick_order() - if order==False: - return False - print(" * Parsing files from Google Drive. Please Wait...") - if isinstance(paths, list): - db={} - for i in range(len(paths)): - db[paths[i]]={'path':paths[i],'TD_name':TDs[i]} - files=concurrent_scrapper(filter=filter,order=order,remotelib='all',db=db) - else: - db={} - db[paths]={'path':paths,'TD_name':TDs} - files=concurrent_scrapper(filter=filter,order=order,remotelib='all',db=db) - print(" * Entering File Picker") - title = 'Select content to install or transfer: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection' - filenames=[] - for f in files: - filenames.append(f[0]) - options=filenames - picker = Picker(options, title, multi_select=True, min_selection_count=1) - def end_selection(picker): - return False,-1 - picker.register_custom_handler(ord('e'), end_selection);picker.register_custom_handler(ord('E'), end_selection) - selected=picker.start() - if selected[0]==False: - print(" User didn't select any files") - return False - with open(tfile,'a') as textfile: - for f in selected: - textfile.write((files[f[1]])[2]+'/'+(files[f[1]])[0]+'\n') - -def select_from_cache(tfile): - cache_is_setup=False - if not os.path.exists(remote_lib_cache): - os.makedirs(remote_lib_cache) - jsonlist=listmanager.folder_to_list(remote_lib_cache,extlist=['json']) - if not jsonlist: - print("Cache wasn't found. Generating cache up...") - from workers import concurrent_cache - concurrent_cache() - jsonlist=listmanager.folder_to_list(remote_lib_cache,extlist=['json']) - if not jsonlist: - sys.exit("Can't setup remote cache. Are libraries set up?") - libnames=[] - for j in jsonlist: - bname=os.path.basename(j) - bname=bname.replace('.json','') - libnames.append(bname) - title = 'Select libraries to search: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection \n + Press A to select all libraries' - db=libraries(remote_lib_file) - options = libnames - picker = Picker(options, title,multi_select=True,min_selection_count=1) - def end_selection(picker): - return False,-1 - def select_all(picker): - return True,libnames - picker.register_custom_handler(ord('e'), end_selection) - picker.register_custom_handler(ord('E'), end_selection) - picker.register_custom_handler(ord('a'), select_all) - picker.register_custom_handler(ord('A'), select_all) - selected = picker.start() - if selected[0]==False: - print("User didn't select any libraries") - return False,False - if selected[0]==True: - cachefiles=jsonlist - else: - cachefiles=[] - for entry in selected: - fname=entry[0]+'.json' - fpath=os.path.join(remote_lib_cache,fname) - cachefiles.append(fpath) - cachedict={} - for cach in cachefiles: - with open(cach) as json_file: - data = json.load(json_file) - for entry in data: - if not entry in cachedict: - cachedict[entry]=data[entry] - # for k in cachedict.keys(): - # print(k) - order=pick_order() - if order==False: - return False - options=[] - if order=='name_ascending': - options=sorted(cachedict,key=lambda x:cachedict[x]['filepath']) - elif order=='name_descending': - options=sorted(cachedict,key=lambda x:cachedict[x]['filepath']) - options.reverse() - elif order=='size_ascending': - options=sorted(cachedict,key=lambda x:cachedict[x]['size']) - elif order=='size_descending': - options=sorted(cachedict,key=lambda x:cachedict[x]['size']) - options.reverse() - elif order=='date_ascending': - options=sorted(cachedict,key=lambda x:cachedict[x]['date']) - elif order=='date_descending': - options=sorted(cachedict,key=lambda x:cachedict[x]['date']) - options.reverse() - options=interface_filter_local(options) - print(" * Entering File Picker") - title = 'Select content to install or transfer: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection' - picker = Picker(options, title, multi_select=True, min_selection_count=1) - def end_selection(picker): - return False,-1 - picker.register_custom_handler(ord('e'), end_selection);picker.register_custom_handler(ord('E'), end_selection) - selected=picker.start() - if selected[0]==False: - print(" User didn't select any files") - return False - with open(tfile,'a') as textfile: - for f in selected: - fpath=(cachedict[f[0]])['filepath'] - textfile.write(fpath+'\n') - - def loop_install(tfile,destiny="SD",outfolder=None,ch_medium=True,check_fw=True,patch_keygen=False,ch_base=False,ch_other=False,truecopy=True,checked=False): check_connection() if not os.path.exists(tfile): @@ -1124,53 +937,4 @@ def select_all(picker): print(" Note:If you interrupt the list use normal install mode to continue list") loop_install(tfile,destiny=destiny,outfolder=None,ch_medium=ch_medium,check_fw=True,patch_keygen=False,ch_base=False,ch_other=False,checked=True) else: - print("\n --- DEVICE IS UP TO DATE ---") - -def select_from_walker(tfile,types='all'): - ext=[] - if types!='all': - items=types.split(' ') - for x in items: - ext.append(str(x).lower()) - folder,TeamDrive=DrivePrivate.folder_walker() - if TeamDrive=="" or TeamDrive==False: - TeamDrive=None - if folder==False: - return False - filt=interface_filter() - order=pick_order() - if order==False: - return False - print(f"- Checking {folder}") - print(" * Parsing files from Google Drive. Please Wait...") - db={} - db[folder]={'path':folder,'TD_name':TeamDrive} - files=concurrent_scrapper(filter=filt,order=order,remotelib='all',db=db) - if files==False: - return False - print(" * Entering File Picker") - title = 'Select content to install or transfer: \n + Press space or right to select content \n + Press Enter to confirm selection \n + Press E to exit selection' - filenames=[] - for f in files: - if types=='all': - filenames.append(f[0]) - else: - for x in ext: - if (str(f[0]).lower()).endswith(x): - filenames.append(f[0]) - break - if filenames==[]: - print(" * Request didn't retrieve any files") - return False - options=filenames - picker = Picker(options, title, multi_select=True, min_selection_count=1) - def end_selection(picker): - return False,-1 - picker.register_custom_handler(ord('e'), end_selection);picker.register_custom_handler(ord('E'), end_selection) - selected=picker.start() - if selected[0]==False: - print(" User didn't select any files") - return False - with open(tfile,'a') as textfile: - for f in selected: - textfile.write((files[f[1]])[2]+'/'+(files[f[1]])[0]+'|'+str(TeamDrive)+'\n') \ No newline at end of file + print("\n --- DEVICE IS UP TO DATE ---") \ No newline at end of file From 5b3751a507757fb87874afea88e12dc71fbaf516 Mon Sep 17 00:00:00 2001 From: julesontheroad <42461174+julesontheroad@users.noreply.github.com> Date: Thu, 23 Jul 2020 15:59:18 +0200 Subject: [PATCH 2/2] UPgrade version to 1.00c --- py/Documentation and Resources/Changelogs/NSCB_1.00.md | 9 +++++++-- py/Interface.bat | 2 +- py/NSCB.bat | 4 ++-- py/Server.bat | 2 +- py/ztools/ADV.bat | 2 +- py/ztools/DriveMode.bat | 4 ++-- py/ztools/JOINER.bat | 2 +- py/ztools/LEGACY.bat | 4 ++-- py/ztools/MNG.bat | 2 +- py/ztools/MtpCmxciFTLocal.bat | 4 ++-- py/ztools/MtpCxciFTLocal.bat | 4 ++-- py/ztools/MtpFTLocal.bat | 4 ++-- py/ztools/MtpInstallRemote.bat | 4 ++-- py/ztools/MtpMode.bat | 4 ++-- py/ztools/MtpTransferRemote.bat | 4 ++-- py/ztools/NSCB_config.bat | 2 +- py/ztools/RST.bat | 2 +- py/ztools/ZSTD.bat | 2 +- py/ztools/info.bat | 2 +- 19 files changed, 34 insertions(+), 29 deletions(-) diff --git a/py/Documentation and Resources/Changelogs/NSCB_1.00.md b/py/Documentation and Resources/Changelogs/NSCB_1.00.md index f403186e..70cdd7ef 100644 --- a/py/Documentation and Resources/Changelogs/NSCB_1.00.md +++ b/py/Documentation and Resources/Changelogs/NSCB_1.00.md @@ -1,4 +1,4 @@ -# NSC_Builder v1.00b - Changelog +# NSC_Builder v1.00c - Changelog ![DeviceTag](https://img.shields.io/badge/Device-SWITCH-e60012.svg) ![LanguageTag](https://img.shields.io/badge/languages-python_batch_html5_javascript-blue.svg) @@ -24,6 +24,11 @@ Here's also a little readme with some DBI information: https://github.com/julesontheroad/NSC_BUILDER/tree/master/py/Documentation%20and%20Resources/DBI ## *Changelog* +### 1.00c Fixes + +Fixes to functions in mtp_gdrive.py where the use of curses prevented some prints on filters. + +Fixed indentation in mtpsp and mtpxci library which derived in **"No module named 'mtpsp'"** and **"No module named 'mtxci'"** errors in the exe builds. ### 1.00b Fixes @@ -31,7 +36,7 @@ Fixed issue where on some systems some search filters wouldn't show the message Fixed bug introduced by 1.00 that would stop the databases update in the middle of the process. -If you already setup 1.00 just override ztools by the 1.00b version. There's no changes in the config files. +If you already setup 1.00 just override ztools by the 1.00c version. There's no changes in the config files. ### 1. Added NSCB.exe diff --git a/py/Interface.bat b/py/Interface.bat index d51b16ca..b71c9aa3 100644 --- a/py/Interface.bat +++ b/py/Interface.bat @@ -3,7 +3,7 @@ set "prog_dir=%~dp0" set "bat_name=%~n0" set "ofile_name=%bat_name%_options.cmd" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad set "list_folder=%prog_dir%lists" ::----------------------------------------------------- ::EDIT THIS VARIABLE TO LINK OTHER OPTION FILE diff --git a/py/NSCB.bat b/py/NSCB.bat index 5dd94bae..b4cf4fa0 100644 --- a/py/NSCB.bat +++ b/py/NSCB.bat @@ -5,7 +5,7 @@ set "bat_name=%~n0" set "ofile_name=%bat_name%_options.cmd" set "opt_interface=Interface_options.cmd" set "opt_server=Server_options.cmd" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad set "list_folder=%prog_dir%lists" ::----------------------------------------------------- ::EDIT THIS VARIABLE TO LINK OTHER OPTION FILE @@ -3014,7 +3014,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b (NEW) +ECHO VERSION 1.00c (NEW) ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/Server.bat b/py/Server.bat index d49a12a3..57e3857d 100644 --- a/py/Server.bat +++ b/py/Server.bat @@ -3,7 +3,7 @@ set "prog_dir=%~dp0" set "bat_name=%~n0" set "ofile_name=%bat_name%_options.cmd" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad set "list_folder=%prog_dir%lists" ::----------------------------------------------------- ::EDIT THIS VARIABLE TO LINK OTHER OPTION FILE diff --git a/py/ztools/ADV.bat b/py/ztools/ADV.bat index 7b9f1947..6d785fca 100644 --- a/py/ztools/ADV.bat +++ b/py/ztools/ADV.bat @@ -424,7 +424,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b +ECHO VERSION 1.00c ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/DriveMode.bat b/py/ztools/DriveMode.bat index d45e0c24..7b1c71e4 100644 --- a/py/ztools/DriveMode.bat +++ b/py/ztools/DriveMode.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad :MAIN cls @@ -87,7 +87,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b (GDRIVE) +ECHO VERSION 1.00c (GDRIVE) ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/JOINER.bat b/py/ztools/JOINER.bat index cdc13ef3..d54fb553 100644 --- a/py/ztools/JOINER.bat +++ b/py/ztools/JOINER.bat @@ -278,7 +278,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b +ECHO VERSION 1.00c ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/LEGACY.bat b/py/ztools/LEGACY.bat index fcb8f388..8971d6b8 100644 --- a/py/ztools/LEGACY.bat +++ b/py/ztools/LEGACY.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad ::Check if user is dragging a folder or a file if "%~1"=="" goto manual @@ -2288,7 +2288,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b (LEGACY) +ECHO VERSION 1.00c (LEGACY) ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/MNG.bat b/py/ztools/MNG.bat index f3ff348c..63bd5111 100644 --- a/py/ztools/MNG.bat +++ b/py/ztools/MNG.bat @@ -272,7 +272,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b +ECHO VERSION 1.00c ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/MtpCmxciFTLocal.bat b/py/ztools/MtpCmxciFTLocal.bat index d12695f8..db8791fc 100644 --- a/py/ztools/MtpCmxciFTLocal.bat +++ b/py/ztools/MtpCmxciFTLocal.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad :://///////////////////////////////////////////////// :://///////////////////////////////////////////////// @@ -333,7 +333,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " A MTP MANAGER FOR DBI INSTALLER " -ECHO VERSION 1.00b (MTP) +ECHO VERSION 1.00c (MTP) ECHO ------------------------------------------------------------------------------------- ECHO DBI by DUCKBILL: https://github.com/rashevskyv/switch/releases ECHO Latest DBI: https://github.com/rashevskyv/switch/releases/tag/462 diff --git a/py/ztools/MtpCxciFTLocal.bat b/py/ztools/MtpCxciFTLocal.bat index 775b5a62..10edf2c7 100644 --- a/py/ztools/MtpCxciFTLocal.bat +++ b/py/ztools/MtpCxciFTLocal.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad REM ////////////////////////////////////////////////// REM ///////////////////////////////////////////////// REM START OF MANUAL MODE. INDIVIDUAL PROCESSING @@ -264,7 +264,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " A MTP MANAGER FOR DBI INSTALLER " -ECHO VERSION 1.00b (MTP) +ECHO VERSION 1.00c (MTP) ECHO ------------------------------------------------------------------------------------- ECHO DBI by DUCKBILL: https://github.com/rashevskyv/switch/releases ECHO Latest DBI: https://github.com/rashevskyv/switch/releases/tag/462 diff --git a/py/ztools/MtpFTLocal.bat b/py/ztools/MtpFTLocal.bat index 54cefb46..1079cc2e 100644 --- a/py/ztools/MtpFTLocal.bat +++ b/py/ztools/MtpFTLocal.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad :MAIN if exist "MTP2.txt" goto prevlist @@ -258,7 +258,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " A MTP MANAGER FOR DBI INSTALLER " -ECHO VERSION 1.00b (MTP) +ECHO VERSION 1.00c (MTP) ECHO ------------------------------------------------------------------------------------- ECHO DBI by DUCKBILL: https://github.com/rashevskyv/switch/releases ECHO Latest DBI: https://github.com/rashevskyv/switch/releases/tag/462 diff --git a/py/ztools/MtpInstallRemote.bat b/py/ztools/MtpInstallRemote.bat index 900aadca..4046a175 100644 --- a/py/ztools/MtpInstallRemote.bat +++ b/py/ztools/MtpInstallRemote.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad :MAIN if exist "MTP1GD.txt" goto prevlist @@ -260,7 +260,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " A MTP MANAGER FOR DBI INSTALLER " -ECHO VERSION 1.00b (MTP) +ECHO VERSION 1.00c (MTP) ECHO ------------------------------------------------------------------------------------- ECHO DBI by DUCKBILL: https://github.com/rashevskyv/switch/releases ECHO Latest DBI: https://github.com/rashevskyv/switch/releases/tag/462 diff --git a/py/ztools/MtpMode.bat b/py/ztools/MtpMode.bat index 324ff1a4..f4badc4f 100644 --- a/py/ztools/MtpMode.bat +++ b/py/ztools/MtpMode.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad :MAIN cls @@ -699,7 +699,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " A MTP MANAGER FOR DBI INSTALLER " -ECHO VERSION 1.00b (MTP) +ECHO VERSION 1.00c (MTP) ECHO ------------------------------------------------------------------------------------- ECHO DBI by DUCKBILL: https://github.com/rashevskyv/switch/releases ECHO Latest DBI: https://github.com/rashevskyv/switch/releases/tag/462 diff --git a/py/ztools/MtpTransferRemote.bat b/py/ztools/MtpTransferRemote.bat index f7a88372..bfd5655e 100644 --- a/py/ztools/MtpTransferRemote.bat +++ b/py/ztools/MtpTransferRemote.bat @@ -2,7 +2,7 @@ :TOP_INIT CD /d "%prog_dir%" set "bat_name=%~n0" -Title NSC_Builder v1.00b -- Profile: %ofile_name% -- by JulesOnTheRoad +Title NSC_Builder v1.00c -- Profile: %ofile_name% -- by JulesOnTheRoad :MAIN if exist "MTP2GD.txt" goto prevlist @@ -238,7 +238,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " A MTP MANAGER FOR DBI INSTALLER " -ECHO VERSION 1.00b (MTP) +ECHO VERSION 1.00c (MTP) ECHO ------------------------------------------------------------------------------------- ECHO DBI by DUCKBILL: https://github.com/rashevskyv/switch/releases ECHO Latest DBI: https://github.com/rashevskyv/switch/releases/tag/462 diff --git a/py/ztools/NSCB_config.bat b/py/ztools/NSCB_config.bat index 7da1857d..b28874ba 100644 --- a/py/ztools/NSCB_config.bat +++ b/py/ztools/NSCB_config.bat @@ -2753,7 +2753,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED IN THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b +ECHO VERSION 1.00c ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/RST.bat b/py/ztools/RST.bat index f95e57f3..cb9e3368 100644 --- a/py/ztools/RST.bat +++ b/py/ztools/RST.bat @@ -297,7 +297,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b +ECHO VERSION 1.00c ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/ZSTD.bat b/py/ztools/ZSTD.bat index 3f6b043c..78c2b703 100644 --- a/py/ztools/ZSTD.bat +++ b/py/ztools/ZSTD.bat @@ -506,7 +506,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b +ECHO VERSION 1.00c ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar diff --git a/py/ztools/info.bat b/py/ztools/info.bat index 6b53ddde..9414248f 100644 --- a/py/ztools/info.bat +++ b/py/ztools/info.bat @@ -413,7 +413,7 @@ ECHO ============================= BY JULESONTHEROAD =================== ECHO ------------------------------------------------------------------------------------- ECHO " POWERED BY SQUIRREL " ECHO " BASED ON THE WORK OF BLAWAR AND LUCA FRAGA " -ECHO VERSION 1.00b +ECHO VERSION 1.00c ECHO ------------------------------------------------------------------------------------- ECHO Program's github: https://github.com/julesontheroad/NSC_BUILDER ECHO Blawar's github: https://github.com/blawar