Forum
    • Categories
    • Register
    • Login

    Download and is server occupied

    Scheduled Pinned Locked Moved Feature Requests
    14 Posts 3 Posters 939 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk @David Healey
      last edited by ustk

      @d-healey

      Server.setServerCallback(function(isOccupied)
      {
          // Triggered with server calls but not with downloadFile
      });
      

      It's not a big deal because I could do what I wanted in the downloadFile function, but it would have been more straight forward to have the server CB to trigger

      Hise made me an F5 dude, browser just suffers...

      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @ustk
        last edited by

        @ustk What is isOccupied?

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        ustkU oskarshO 2 Replies Last reply Reply Quote 0
        • ustkU
          ustk @David Healey
          last edited by ustk

          @d-healey Screenshot 2023-12-06 at 15.05.53.png

          isOccupied is true when a call is made and the server is waiting for the response

          Hise made me an F5 dude, browser just suffers...

          1 Reply Last reply Reply Quote 0
          • oskarshO
            oskarsh @David Healey
            last edited by

            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

            ustkU 2 Replies Last reply Reply Quote 0
            • ustkU
              ustk @oskarsh
              last edited by ustk

              @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 the this.data.success case for instance. WAS NON-SENSE

              Hise made me an F5 dude, browser just suffers...

              1 Reply Last reply Reply Quote 0
              • ustkU
                ustk @oskarsh
                last edited by ustk

                @oskarsh Thanks ! In the end it was easier to use getPendingDownloads().length than tracking the number of downloads manually...
                (even if getPendingDownloads() contains nothing, @Christoph-Hart ?)

                Still, triggering the server CB would have fixed another issue for me so the request stays relevant

                Hise made me an F5 dude, browser just suffers...

                oskarshO 1 Reply Last reply Reply Quote 0
                • oskarshO
                  oskarsh @ustk
                  last edited by

                  @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

                  David HealeyD ustkU 2 Replies Last reply Reply Quote 1
                  • David HealeyD
                    David Healey @oskarsh
                    last edited by

                    I use a broadcaster to track if currently downloading

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    1 Reply Last reply Reply Quote 1
                    • ustkU
                      ustk @oskarsh
                      last edited by

                      @oskarsh Of course, stupid me... I tried to trace the content but the download object are access through the specific methods...

                      Hise made me an F5 dude, browser just suffers...

                      David HealeyD 1 Reply Last reply Reply Quote 0
                      • David HealeyD
                        David Healey @ustk
                        last edited by David Healey

                        @ustk

                        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

                        Free HISE Bootcamp Full Course for beginners.
                        YouTube Channel - Public HISE tutorials
                        My Patreon - HISE tutorials

                        ustkU 1 Reply Last reply Reply Quote 1
                        • ustkU
                          ustk @David Healey
                          last edited by

                          @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...

                          Hise made me an F5 dude, browser just suffers...

                          David HealeyD 1 Reply Last reply Reply Quote 0
                          • David HealeyD
                            David Healey @ustk
                            last edited by

                            @ustk Oh that's weird. I'll update the post, one moment

                            Free HISE Bootcamp Full Course for beginners.
                            YouTube Channel - Public HISE tutorials
                            My Patreon - HISE tutorials

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post

                            22

                            Online

                            2.1k

                            Users

                            13.0k

                            Topics

                            112.4k

                            Posts