Announcement

Collapse
No announcement yet.

[BETA] Multi Threaded Download Action Plugin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • webultra
    replied
    Ups!...the callback functions are not working if i start a download under a coroutine, why?. This is how i'm using it:

    I create a new coroutine which starts a new download, and just after create the download i yield the coroutine.
    At the callback function "OnComplete" i wrote "coroutine.resume(myroutine)" to resume my routine (which starts a new download) but it never happend.

    Also the other callback functions are not working :( .

    BTW, i got a headache :P
    Last edited by webultra; 11-26-2010, 09:17 PM. Reason: added a comment lol

    Leave a comment:


  • webultra
    replied
    Nah, don't worry. I already resolved it. I used the socket module (http.request method=head) to get the header of the link and then I used the location parameter to get the real url of the file xD . Then i just split the real url to get the filename.

    Leave a comment:


  • webultra
    replied
    Hi reteset, i haven't downloaded your plugin but before do it i wanna know if your plugin resolves the filename to download. For example, i'm trying to download a file from an url like "http://www.domain.com/files/123". If I write the url in firefox it shows the download dialog with the correct filename ("image.png"). But ams returns "failed to connect to server" (or something like that) because i'm setting the file destination as "C:/Folder" instead of "C:/Folder/image.png".
    Last edited by webultra; 11-23-2010, 06:04 PM.

    Leave a comment:


  • Sakuya
    replied
    Thanks for the update.

    Commited the new version of the plugin to my project.

    Leave a comment:


  • reteset
    replied
    after a long time
    i am playing with this
    i added pause/resume support to plugin
    now you can pause existing download and resume
    you can also close appication during a download session is in progress
    and when you reopen application download will continue where it was finished

    of course this will not be done by plugin itself , you should write some lines of code
    you must tell plugin whether it will start from beginning or resume
    i made a sample to show how to stop and resume a download


    i also fixed two bugs

    Leave a comment:


  • Sakuya
    replied
    Originally posted by sim View Post
    Yes but you did not get any errors remeber it just ended the app thats what I was on about, Mine ended on when updating the windows title and some times when trying to build a table, I will have to try remake the demo tomorrow if I get the time
    Why haven't you taken the advice I gave you? You even posted it a few posts ago.

    Write to a textfile throughout the callback and when it crashes, you'll know what line it got to before it crashed.

    Leave a comment:


  • sim
    replied
    Yes but you did not get any errors remeber it just ended the app thats what I was on about, Mine ended on when updating the windows title and some times when trying to build a table, I will have to try remake the demo tomorrow if I get the time

    Leave a comment:


  • Sakuya
    replied
    Originally posted by sim View Post
    I rebuilt my app there was nothing with my code that was at fault already tested lol but if I feel up for I will try make a demo tomorrow with the same layout as it did before but strange Shadiku as not chamined in here as he said it did the same to him just closes with no errors or anything hes been quirt for some reason.
    There was an error in my code, I fixed it and now it's fine. So it was user error in the end.

    Leave a comment:


  • sim
    replied
    That could be helpful for later on thanks retest.

    Leave a comment:


  • reteset
    replied
    Originally posted by Benjamin View Post
    Are you planning to add in plug-in parameter "timeout"? Like in standart http.download.
    currently no
    it already waits until gets connected (low internet connection etc..)
    if it can not connect it stops and calls OnError callback function with the HTTP error code (probably HTTP_STATUS_NOT_FOUND)

    this plugin already provides non-blocking downloads , so timeout is not necessary (i think)
    your application can continue working while it attepts to connect

    Originally posted by Benjamin View Post

    And maybe actions like "Pause" and "Resume/Continue" downloading?

    Thanks.
    you can make it yourself

    Download.Start() action has an argument StartFrom
    this represents the byte offset of the file you want to download

    for example

    Code:
    function Download.OnProgress(tblData)
       
      if ( tblData ~= nil) then
      LastOffset =  tblData.Loaded*1024
      end
    
    end
    if you save LastOffset variable to somewhere (to a file etc..) when a download stoped or an error occured - application exit and anything else which may stop a download progress
    you can start another download with DownloadStart() action
    later using that last offset

    Code:
    Download.Start(Application.GetWndHandle(), "url", "dest", "", "",[B][COLOR="red"] LastOffset[/COLOR][/B], nil, 0, "", "");
    and if you save next file with a different extension for example
    filename.ext.part2

    if you use same destination file , previous one will be overriden (removed) (will not continue)
    you should use a different destination file

    then you can merge them using Lua's io functions

    currently there is no pause -resume support for existing download sessions

    maybe later

    Leave a comment:


  • sim
    replied
    I rebuilt my app there was nothing with my code that was at fault already tested lol but if I feel up for I will try make a demo tomorrow with the same layout as it did before but strange Shadiku as not chamined in here as he said it did the same to him just closes with no errors or anything hes been quirt for some reason.

    Leave a comment:


  • reteset
    replied
    Originally posted by sim View Post
    Nope, it had the folder it was making the file it was when I was using windows set title it crashed then and I mean dead, then I made a table in the complete section it crached cos I was using the Data or ExData it just droped out also, part from that Its working then setting a download ID also made it wig out on me I tested my code before and to make sure it was not me, it seems it gets funny some time s but others it works great I redone my code like 5 times since then but it also just crashs if the url is wrong I get no warning at all it just closes Shadow made little function to right a log file so I could see where it was failing and it was the download functions.
    please, could you attach a sample project that shows the bug
    you can send it to me privately , if you want

    Leave a comment:


  • Benjamin
    replied
    reteset, Are you planning to add in plug-in parameter "timeout"? Like in standart http.download.

    And maybe actions like "Pause" and "Resume/Continue" downloading?

    Thanks.

    Leave a comment:


  • sim
    replied
    Nope, it had the folder it was making the file it was when I was using windows set title it crashed then and I mean dead, then I made a table in the complete section it crached cos I was using the Data or ExData it just droped out also, part from that Its working then setting a download ID also made it wig out on me I tested my code before and to make sure it was not me, it seems it gets funny some time s but others it works great I redone my code like 5 times since then but it also just crashs if the url is wrong I get no warning at all it just closes Shadow made little function to right a log file so I could see where it was failing and it was the download functions.

    Leave a comment:


  • reteset
    replied
    Originally posted by sim View Post
    Hey Retest, great plugin but I am having a really big problem, if there is a error its not telling me the error its just closing the program the program is not just ending its been killed I have no way to debug without a error lol, When I say its killing the app its not even letting AMS's close Image it drops the app dead I know its my fault but without knowing the error I can debug my self I am not that great and the source looks OK just thought I let you know not that I am bad coder but that it kills the app without the error
    i have simulated all possible server errors and i got nothing bad
    one thing i noticed that : if destination folder does not exist application crashes
    because there is a missing exception handling on a file function
    this causes a runtime error
    could this be the problem you encountered

    Leave a comment:

Working...
X