Need some help with downloadFile()
-
I'm running into some issues with a downloadFile method I'm using for batch-updating .hxi's
Edit: The youtube embed can't fullscreen, have to click the title of the video to be able to fullscreen
It doesn't always work, I think the download is timing out but I can't figure out how to check for this. When this happens, I have to restart the bulk download by clicking the button again, in which case it seems to delete any previously downloaded .hxi's (you can see them missing after I restart the plugin).
If I don't manually restart the download, and close the plugin instead, the DAW crashes. I need a way to detect these timeouts so I can automatically restart the download, or at least let the user know it failed.
The downloads are stored on Google cloud in a public bucket.
I see this post: https://forum.hise.audio/topic/3849/images-from-server/20?_=1675571634098
Is this still an issue?
inline function updateAllExpansions() { //Server.cleanFinishedDownloads(); //do I need this here? for (i=0; i<expansionNames.length; i++) //for each expansion { if (library_outdatedVersions[i]) //check if a later version is available { //Removed some code here that sets up a backup folder etc... download_target = expansionList[i].getRootFolder().getChildFile("info.hxi"); download_target.move(backup_version_subfolder.getChildFile("info.hxi")); //Copy old .hxi to newly created backup folder Server.setBaseURL("https://storage.googleapis.com/myawesomefolder/myawesomesubfolder/"); local thisButton = expButton[i]; local url = ""; if (library_is_premodular[i]) //this is just checking if it's a really old version url = migration_list_urls_JSON[expansionNames[i]]; else url = library_names[i] +".hxi"; Server.downloadFile(url, {}, download_target, function[thisButton]() { if (this.data.finished) { if (this.data.success) //this doesn't seem to check for time-outs { if (thisButton.data.index == (expansionNames.length - 1)) //checks for the last download in the loop { Engine.showMessageBox("Update Complete", "All Libraries updated successfully. Please restart NEAT Player.", 0); Server.cleanFinishedDownloads(); currentlyDownloading = false; } } else { Engine.showMessageBox("Download timed out.", "Wow you are a dumb dumb!! XD", 0); //never gets called, despite timeouts } } }); } } //nesting :D }
-
I think the download is timing out
Your video is in a DAW, does that mean there is no problem when testing in HISE?
If the problem is also in HISE what do you see in the Server Controller that makes you think the issue is a time out?
Have you tried changing the number of simultaneous downloads?
Have you tried downloading from different URLs instead of Google drive?
Have you tried only downloading the next hxi after the previous one completed?
-
@d-healey said in Need some help with downloadFile():
Your video is in a DAW, does that mean there is no problem when testing in HISE?
Both HISE and DAW
If the problem is also in HISE what do you see in the Server Controller that makes you think the issue is a time out?
You can see it only added files to the queue up to Oracle (there's 3 after that are missing).
I guess this is what's causing the issue (and crash), the loop never reaches the end, therefore no end-method cleanup
Have you tried changing the number of simultaneous downloads?
Not sure how to do this.
Have you tried downloading from different URLs instead of Google drive?
Google Cloud not drive :) I've tried hosting on github as well and ran into the same issue.
Have you tried only downloading the next hxi after the previous one completed?
That was my next move but I was hoping to not have to rewrite it all.
-
-
@d-healey Yeh that didn't work either unfortunately, I'll bite the bullet and make it sequential and pray that fixes it lol
-
This post is deleted! -
Okay I think I've found the issue
At initialization I had a loop running through each expansion and checking if it was out of date with server calls. Because this loop takes a few seconds, sometimes I'd be clicking the update button before the full list of outdated libraries had been populated.
t shirt time :D