HISE Logo Forum
    • Categories
    • Register
    • Login

    Images from server

    Scheduled Pinned Locked Moved Scripting
    imagesserver
    64 Posts 8 Posters 3.9k 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.
    • Christoph HartC
      Christoph Hart
      last edited by

      I don‘t see the extend timeout call in the snippet ;)

      Call it in the loop and you should be fine.

      d.healeyD 1 Reply Last reply Reply Quote 1
      • d.healeyD
        d.healey @Christoph Hart
        last edited by

        @Christoph-Hart Oh ok, I was calling it at the start of on init

        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey
          last edited by d.healey

          I'm going to try the exendTimeout thing now, but while I was waiting 7 whole minutes! for your reply I found another solution

          var files = {};
          var urls = {};
                      
          for (r in response)
          {
              files[r.name] = FileSystem.getFolder(FileSystem.Downloads).getChildFile(r.name + ".jpg");   
              urls[r.name] = r.image.replace(Webstore.baseURL, "");
          }
                      
          for (r in response)
              Server.downloadFile(urls[r.name], {}, files[r.name], downloadCallback);
          

          Nice to see emojis working again :D :p ;)

          Update: And I confirm the timeout method works! 🐕

          5706ea93-3393-47ae-a1b5-6e8299abec72-image.png

          1 Reply Last reply Reply Quote 2
          • d.healeyD
            d.healey
            last edited by d.healey

            I have a strange issue (bug maybe) with the this.data.finished clause being accessed more than once for each download.

            Content.makeFrontInterface(600, 500);
            
            Console.clear();
            
            reg count = 0;
            
            Server.setBaseURL("https://forum.hise.audio/uploads/profile");
            
            const images = ["1-profileimg.jpg", "12-profileimg.jpg", "67-profileavatar.jpeg", "121-profileimg.jpg", "338-profileavatar.png"];
            
            function downloadCallback()
            {
                if (this.data.finished)
                {
                    Console.print(count + " : " + this.getDownloadedTarget().toString(1));
                    count++;
                }
            }
            
            reg f;
            
            for (i = 0; i < images.length; i++)
            {
                f = FileSystem.getFolder(FileSystem.Downloads).getChildFile(images[i]);
                Server.downloadFile(images[i], {}, f, downloadCallback);    
            }
            

            I thought it might be something to do with the loop or reusing the f variable so I also wrote it out the long way and the result is the same

            reg f0 = FileSystem.getFolder(FileSystem.Downloads).getChildFile(images[0]);
            Server.downloadFile(images[0], {}, f0, downloadCallback);
            
            var f1 = FileSystem.getFolder(FileSystem.Downloads).getChildFile(images[1]);
            Server.downloadFile(images[1], {}, f1, downloadCallback);
            
            var f2 = FileSystem.getFolder(FileSystem.Downloads).getChildFile(images[2]);
            Server.downloadFile(images[2], {}, f2, downloadCallback);
            
            var f3 = FileSystem.getFolder(FileSystem.Downloads).getChildFile(images[3]);
            Server.downloadFile(images[3], {}, f3, downloadCallback);
            
            var f4 = FileSystem.getFolder(FileSystem.Downloads).getChildFile(images[4]);
            Server.downloadFile(images[4], {}, f4, downloadCallback);
            
            1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by

              Any ideas? Is it possible that there is some shared data between the different instances of the downloadCallback so as each download finishes it's triggering the callback for other downloads?

              1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey
                last edited by d.healey

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by

                  I think I've found a solution/workaround, recursion. Each download complete triggers the next download start.

                  Content.makeFrontInterface(600, 500);
                  
                  Console.clear();
                  
                  Server.setBaseURL("https://forum.hise.audio/uploads/profile");
                  
                  const images = ["12-profileimg.jpg", "67-profileavatar.jpeg", "121-profileimg.jpg", "338-profileavatar.png"];
                  
                  function downloadCallback()
                  {
                      if (this.data.finished)
                      {        
                          if (count < images.length-1)
                          {
                              count++;
                              startNextDownload(images[count]);
                          }
                      }
                  }
                  
                  inline function startNextDownload(fileName)
                  {
                      Console.print(fileName);
                      local f = FileSystem.getFolder(FileSystem.Downloads).getChildFile(fileName);
                      Server.downloadFile(fileName, {}, f, downloadCallback);
                  }
                  
                  reg count = 0;
                  startNextDownload(images[0]);
                  
                  Y 1 Reply Last reply Reply Quote 2
                  • Christoph HartC
                    Christoph Hart
                    last edited by

                    I fixed a few things about this, however it still is a bit glitchy if you're hammering the queue - I haven't been able to track down the reason, but sometimes the URL request returns a 404 despite the resource being available (I think it has to do with concurrent requests to the same server). This will make the callback fire multiple times for one download - however the success property is false for the requests that didn't work, so it's still executed once with the success flag set to true.

                    d.healeyD 1 Reply Last reply Reply Quote 1
                    • d.healeyD
                      d.healey @Christoph Hart
                      last edited by

                      @Christoph-Hart Thanks, I'll try it out :D

                      1 Reply Last reply Reply Quote 0
                      • Y
                        yall
                        last edited by

                        @d-healey
                        i just tried your script, the download works but the images do not appear in hise. I created 5 images (empty).

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @yall
                          last edited by

                          @yall What do you mean they don't appear?

                          1 Reply Last reply Reply Quote 0
                          • Y
                            yall
                            last edited by

                            in hise, it does not appear.

                            d.healeyD 1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey @yall
                              last edited by

                              @yall Show me the code you are using to display the images.

                              DanHD 1 Reply Last reply Reply Quote 0
                              • Y
                                yall @d.healey
                                last edited by

                                @d-healey said in Images from server:

                                I think I've found a solution/workaround, recursion. Each download complete triggers the next download start.

                                Content.makeFrontInterface(600, 500);
                                
                                Console.clear();
                                
                                Server.setBaseURL("https://forum.hise.audio/uploads/profile");
                                
                                const images = ["12-profileimg.jpg", "67-profileavatar.jpeg", "121-profileimg.jpg", "338-profileavatar.png"];
                                
                                function downloadCallback()
                                {
                                    if (this.data.finished)
                                    {        
                                        if (count < images.length-1)
                                        {
                                            count++;
                                            startNextDownload(images[count]);
                                        }
                                    }
                                }
                                
                                inline function startNextDownload(fileName)
                                {
                                    Console.print(fileName);
                                    local f = FileSystem.getFolder(FileSystem.Downloads).getChildFile(fileName);
                                    Server.downloadFile(fileName, {}, f, downloadCallback);
                                }
                                
                                reg count = 0;
                                startNextDownload(images[0]);
                                

                                @d-healey this :) in fact I'm trying but without really understanding for the moment

                                1 Reply Last reply Reply Quote 0
                                • DanHD
                                  DanH @d.healey
                                  last edited by

                                  @d-healey Could I use something like this for Users to download HR1 files into their native OS downloads folder?

                                  I've had to make a separate downloader anyway which links to a website but I'd rather it just download files without using a browser

                                  DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                  https://dhplugins.com/ | https://dcbreaks.com/
                                  London, UK

                                  d.healeyD 1 Reply Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey @DanH
                                    last edited by

                                    @DanH Yes.

                                    @yall said in Images from server:

                                    @d-healey this :) in fact I'm trying but without really understanding for the moment

                                    I think so too :)

                                    Go read the docs and write it out from scratch then you'll understand it.

                                    DanHD 1 Reply Last reply Reply Quote 0
                                    • DanHD
                                      DanH @d.healey
                                      last edited by

                                      @d-healey This is super useful, I've been playing around with it but not sure it's going to work with Dropbox (or at least it hasn't really yet)... which is where my files are stored at the moment.

                                      Also wondering if it's possible to wrap the...

                                      Server.downloadFile("download/HISE_1_1_1.exe", {}, target, function()
                                      

                                      in a button callback?

                                      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                      https://dhplugins.com/ | https://dcbreaks.com/
                                      London, UK

                                      1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey
                                        last edited by

                                        It should work with dropbox as long as the URL is public.

                                        Also wondering if it's possible to wrap the...in a button callback?

                                        Try it and see.

                                        DanHD 1 Reply Last reply Reply Quote 0
                                        • DanHD
                                          DanH @d.healey
                                          last edited by

                                          @d-healey Thanks David. So I can download the example from the Docs ok (Hise windows installer) but not having any luck with my dropbox... Small snippet below in case anyone has any ideas :)

                                          HiseSnippet 1025.3ocsV0sSiaDEdLfW0j1rpqTe.F4qR1M0wgk1cEHDPHIUnxOQqCa6cqlXOgLE6YbmYLPDBo9n0Go9FzdFamDyRfhhD9BKe9c9lybNeiGHEATkRHQVUFNMghr9Na+ob8jCmPXbzQcQVu1NLRPBwZpRiai5LMgnTzPjk05+hwGqJafxd9m85PhH7.5BUHzmEr.5wrXldg1A6+qrnn9jP5PVbIu2Z+iBD7CEQhT.Oqa6gRHAWRtfdJw31Z1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GexXLDDGjpEw4iIfhA8x3srr5kwfj0Qh9OHpm3ON
                                          

                                          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                                          https://dhplugins.com/ | https://dcbreaks.com/
                                          London, UK

                                          1 Reply Last reply Reply Quote 0
                                          • d.healeyD
                                            d.healey
                                            last edited by

                                            That dropbox link isn't a direct link to the file, it's a link to a Dropbox page from which you can download the file. You can test this by opening the link in your web browser. To get direct download links from dropbox you have to apped ?dl=1 to the url.

                                            Like this: https://www.dropbox.com/s/tr4uob71yjbmnqu/DOWNLOADTEST.rtf?dl=1

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

                                            22

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            102.6k

                                            Posts