From fe0eda9aa1a8063daccea6b567214382c570b230 Mon Sep 17 00:00:00 2001 From: jede Date: Thu, 16 Nov 2023 23:37:13 +0100 Subject: [PATCH 1/4] fix --- tools/retrieveSoftwareOricOrg.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/retrieveSoftwareOricOrg.py b/tools/retrieveSoftwareOricOrg.py index 6fafaea..8e43a55 100644 --- a/tools/retrieveSoftwareOricOrg.py +++ b/tools/retrieveSoftwareOricOrg.py @@ -474,10 +474,10 @@ def manage_download(tsoftware, download_file, download_platform, download_label, print(f"[download_file] Retrieve download file { download_file } to { tmpfolderRetrieveSoftware }") while (RetrieveSoftwareInTmpFolder(download_file, tmpfolderRetrieveSoftware) == 1): - print("Retry curl ... ") + print(f"Retry curl ... { nb_curl_error }") nb_curl_error = nb_curl_error + 1 if nb_curl_error == 20: - print("Exitint furl") + print("Exiting curl") exit() extension = getFileExtension(download_file) @@ -717,6 +717,8 @@ def manage_download(tsoftware, download_file, download_platform, download_label, rombasic11 = datastore[i]["basic11_ROM_TWILIGHTE"] + nb_curl_error = 0 + if download_1_file != "": print(f"########################################## { name_software } : { id_software } #################################################") print("[download_1_file] Retrieve download file " +download_1_file+" to : " + tmpfolderRetrieveSoftware) @@ -731,8 +733,6 @@ def manage_download(tsoftware, download_file, download_platform, download_label, print("Exiting curl") exit() - RetrieveSoftwareInTmpFolder(download_1_file, tmpfolderRetrieveSoftware) - extension=download_1_file[-3:].lower() head, tail = os.path.split(download_1_file) letter=tail[0:1].lower() From 6aa6dbcba79ded1746ce33e663a8fa4cc7cf63af Mon Sep 17 00:00:00 2001 From: jede Date: Thu, 16 Nov 2023 23:58:35 +0100 Subject: [PATCH 2/4] fix retry --- tools/retrieveSoftwareOricOrg.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/retrieveSoftwareOricOrg.py b/tools/retrieveSoftwareOricOrg.py index 8e43a55..0d03d08 100644 --- a/tools/retrieveSoftwareOricOrg.py +++ b/tools/retrieveSoftwareOricOrg.py @@ -880,7 +880,14 @@ def manage_download(tsoftware, download_file, download_platform, download_label, filenametapbase = tcnf[0] filenametap8bytesLength = filenametapbase[0:8] print(f"[download_2_file] Retrieve download file { download_2_file } to : { tmpfolderRetrieveSoftware}") - RetrieveSoftwareInTmpFolder(download_2_file, tmpfolderRetrieveSoftware) + + while (RetrieveSoftwareInTmpFolder(download_2_file, tmpfolderRetrieveSoftware) == 1): + print(f"Retry curl (download_2_file) ... -> {nb_curl_error}") + nb_curl_error = nb_curl_error + 1 + if nb_curl_error == 20: + print("Exiting curl") + exit() + if not CheckZip(download_1_file) == 0: print(f"Download file 2 : { download_2_file } { tmpfolderRetrieveSoftware }") else: From a1a3e6249fc1a44b7f635d68d288bf04646bcdc4 Mon Sep 17 00:00:00 2001 From: jede Date: Fri, 17 Nov 2023 00:19:53 +0100 Subject: [PATCH 3/4] fix --- tools/retrieveSoftwareOricOrg.py | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tools/retrieveSoftwareOricOrg.py b/tools/retrieveSoftwareOricOrg.py index 0d03d08..7c09cd7 100644 --- a/tools/retrieveSoftwareOricOrg.py +++ b/tools/retrieveSoftwareOricOrg.py @@ -160,7 +160,7 @@ def fileToExecuteTruncateTo8Letters(filename): return filenametap8bytesLength.upper() -def buildMdFile(tsoftware, filenametap8bytesLength, dest,letter, download_platform_software): +def buildMdFile(tsoftware, filenametap8bytesLength, dest,letter, download_platform_software) -> int: name_software = tsoftware["name_software"] date_software = tsoftware["date_software"] programmer_software = tsoftware["programmer_software"] @@ -239,7 +239,12 @@ def buildMdFile(tsoftware, filenametap8bytesLength, dest,letter, download_platfo crl.setopt(crl.WRITEDATA, b_obj) # Perform a file transfer - crl.perform() + try: + crl.perform() + except pycurl.error as e: + # Gestion des exceptions Curl + print("Erreur Curl :", e) + return 1 # End curl session crl.close() @@ -287,20 +292,30 @@ def buildMdFile(tsoftware, filenametap8bytesLength, dest,letter, download_platfo md_bin = bytearray(md_software,'ascii') f.write(md_bin) f.close() + return 0 + def BuildDsk(tsoftware, platform_software, letter, destpath, destetc, filenametap8bytesLength, tail, tmpfolderRetrieveSoftware, version_bin, rombasic11): name_software = tsoftware["name_software"] date_software = tsoftware["date_software"] programmer_software = tsoftware["programmer_software"] junk_software = tsoftware["junk_software"] - + nb_curl_error = 0 CreateTargetFolder(destpath, destetc,letter) print("[DSK]Copying dsk : " + tmpfolderRetrieveSoftware + tail + " into :"+destpath + "/"+ letter +"/"+filenametap8bytesLength+".dsk" ) copyfile(tmpfolderRetrieveSoftware+tail,destpath+ "/" +letter+"/"+ filenametap8bytesLength+".dsk" ) os.remove(tmpfolderRetrieveSoftware + tail) if not os.path.exists(destetc + "/"+ letter): os.mkdir(destetc+"/" + letter) - buildMdFile(tsoftware, filenametap8bytesLength, destpath, letter, platform_software) + + while (buildMdFile(tsoftware, filenametap8bytesLength, destpath, letter, platform_software) == 1): + print(f"Retry curl buildMdFile ... { nb_curl_error }") + nb_curl_error = nb_curl_error + 1 + if nb_curl_error == 20: + print("Exiting curl") + exit() + + buildDbFileSoftwareSingle(tsoftware, destetc,letter, filenametap8bytesLength, version_bin,rombasic11) def BuildTape(tsoftware, tmpfolderRetrieveSoftware, tail, dest, letter,filenametap8bytesLength,filenametapext,destroot,destetc,download_platform_software,version_bin,rombasic11): @@ -324,7 +339,14 @@ def BuildTape(tsoftware, tmpfolderRetrieveSoftware, tail, dest, letter,filenamet if not os.path.exists(destetc + "/" + letter): os.mkdir(destetc + "/" + letter) print("Writing in db file rom id : ", str(rombasic11)) - buildMdFile(tsoftware, filenametap8bytesLength, dest, letter, download_platform_software) + + while (buildMdFile(tsoftware, filenametap8bytesLength, dest, letter, download_platform_software) == 1): + print(f"Retry curl buildMdFile ... { nb_curl_error }") + nb_curl_error = nb_curl_error + 1 + if nb_curl_error == 20: + print("Exiting curl") + exit() + buildDbFileSoftwareSingle(tsoftware, destetc, letter, filenametap8bytesLength, version_bin, rombasic11) def CheckTape(tsoftware, filename, tmpfolderRetrieveSoftware, tail, dest, letter, filenametap8bytesLength, filenametapext, destroot, destetc, download_platform_software, version_bin, rombasic11): From 1f609b6a6c9d0f0b53d8a3e07eb6e087561c2c15 Mon Sep 17 00:00:00 2001 From: jede Date: Fri, 17 Nov 2023 21:30:04 +0100 Subject: [PATCH 4/4] fix --- tools/retrieveSoftwareOricOrg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/retrieveSoftwareOricOrg.py b/tools/retrieveSoftwareOricOrg.py index 7c09cd7..11002d2 100644 --- a/tools/retrieveSoftwareOricOrg.py +++ b/tools/retrieveSoftwareOricOrg.py @@ -300,7 +300,7 @@ def BuildDsk(tsoftware, platform_software, letter, destpath, destetc, filenameta date_software = tsoftware["date_software"] programmer_software = tsoftware["programmer_software"] junk_software = tsoftware["junk_software"] - nb_curl_error = 0 + CreateTargetFolder(destpath, destetc,letter) print("[DSK]Copying dsk : " + tmpfolderRetrieveSoftware + tail + " into :"+destpath + "/"+ letter +"/"+filenametap8bytesLength+".dsk" ) copyfile(tmpfolderRetrieveSoftware+tail,destpath+ "/" +letter+"/"+ filenametap8bytesLength+".dsk" ) @@ -308,6 +308,8 @@ def BuildDsk(tsoftware, platform_software, letter, destpath, destetc, filenameta if not os.path.exists(destetc + "/"+ letter): os.mkdir(destetc+"/" + letter) + nb_curl_error = 0 + while (buildMdFile(tsoftware, filenametap8bytesLength, destpath, letter, platform_software) == 1): print(f"Retry curl buildMdFile ... { nb_curl_error }") nb_curl_error = nb_curl_error + 1 @@ -340,6 +342,8 @@ def BuildTape(tsoftware, tmpfolderRetrieveSoftware, tail, dest, letter,filenamet os.mkdir(destetc + "/" + letter) print("Writing in db file rom id : ", str(rombasic11)) + nb_curl_error = 0 + while (buildMdFile(tsoftware, filenametap8bytesLength, dest, letter, download_platform_software) == 1): print(f"Retry curl buildMdFile ... { nb_curl_error }") nb_curl_error = nb_curl_error + 1