Download and is server occupied
-
@ustk What is isOccupied?
-
isOccupied is
true
when a call is made and the server is waiting for the response -
You can create a isOccupied whenever you start a download, when you finish the download you clear that state. That is how loading is usually done. Getting the exact loading state is sometimes tricky thats why you often see a fake progress bar that seems to hold the 99% after some time while waiting for the download to finish.
If you want to display the stuff that is currently loading you can use:
https://docs.hise.audio/scripting/scripting-api/server/index.html#getpendingcalls
and
https://docs.hise.audio/scripting/scripting-api/server/index.html#getpendingdownloads
-
@oskarsh yeah that's what I said I did it by tracking inside the downloadFile function, it just would have been nice to have the info in the server CB... But I made my own variable successfully
getPendingDownload
doesn't help much, it's an empty array (which is probably a bug) where you can just get its length as information,but it's not useful once you enter theWAS NON-SENSEthis.data.success
case for instance. -
@oskarsh Thanks ! In the end it was easier to use
getPendingDownloads().length
than tracking the number of downloads manually...
(even ifgetPendingDownloads()
contains nothing, @Christoph-Hart ?)Still, triggering the server CB would have fixed another issue for me so the request stays relevant
-
@ustk I believe the
getPendingDownload
is not empty as you can prove by getting its length. Sometimes HISE cannot print out the content of a complex object such as a Download object or a Path for example.You can loop over that array and get the status of each element.
so basically
for (download in Server.getPendingDownloads() { Console.print(download.isRunning()); }
code is untested
Check this part of the docs to learn more about Downloads.
https://docs.hise.audio/scripting/scripting-api/download/index.html
-
I use a broadcaster to track if currently downloading
-
@oskarsh Of course, stupid me... I tried to trace the content but the download object are access through the specific methods...
-
This is where I set up the broadcaster - https://codeberg.org/LibreWave/Rhapsody/src/branch/main/Scripts/App.js#L39
Then when I start some downloads I set the state - https://codeberg.org/LibreWave/Rhapsody/src/branch/main/Scripts/Downloader.js#L52
Then after all downloads complete I reset it - https://codeberg.org/LibreWave/Rhapsody/src/branch/main/Scripts/Downloader.js#L191
-
@d-healey I wanted to ask (because I haven't found anything about a broadcaster connected to a download or server task) but you were faster! Nice but the 3 links you kindly posted are the same...
-
@ustk Oh that's weird. I'll update the post, one moment