Announcement

Collapse
No announcement yet.

[BETA] Multi Threaded Download Action Plugin

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

  • adeam
    replied
    The ftp download works only on Windows XP because when I tested it in Windows 7, the Firewall blocks the program and prompts if you want to allow it, then, click Ok, nothing happens. It shows Downloading.. in the Status but it doesn't really progress.

    In the sample program, I only change the line below.
    Code:
    tblURL[1] = "ftp://[<user>[:<password>]@]<host>[:<port>]/<url-path>"
    Any comment why it doesn't work in Windows 7?

    Thanks.

    Leave a comment:


  • adeam
    replied
    Your plugin is great. I thought that it works only on http but on my test, I put the complete FTP URL in the URL field, shown below, and it works:

    Code:
    tblURL[1] = "ftp://[<user>[:<password>]@]<host>[:<port>]/<url-path>"
    Thanks.
    Last edited by adeam; 03-25-2011, 04:15 AM.

    Leave a comment:


  • adeam
    replied
    Hi reteset,

    I'm new with AMS. Your plug-in seems great, I would like to know if this plug-in can be use with the command FTPWI.Download?

    Code:
    FTPWI.Download("ftp://ftp.yourdomain.com/file.exe", _TempFolder .. "\\file.exe", "FTP_USERNAME", "FTP_PASSWORD", MODE_BINARY, 20, 21, true, nil);
    Thanks.

    Leave a comment:


  • reteset
    replied
    yes that is possible , this plugin can implement same thing
    however , i did not want to make an opponent application to other popular download applications
    aim of this plugin was only download files without block parent thread , and multiple downloads as well
    it also has resume support for broken/stopped downloads

    I will try to add such functionality to this plugin in a free time :yes

    but :
    most web servers do not allow you to open concurrent connections more than 2
    most web servers apply range limits


    this is a good request even if this will not put many things to plugin as extra

    thank you

    Leave a comment:


  • actionstk..
    replied
    For up download speed.. - (Download Action Plugin) need support download file for multi part per file (some server support)
    :yes and me wait Download Action Plugin next version from reteset and thank for nice Plugin

    Click image for larger version

Name:	multipart.gif
Views:	1
Size:	13.2 KB
ID:	283007

    :yes•Download Action Plugin Cheer!!!!•:yes

    Leave a comment:


  • webultra
    replied
    It's very very weird...All this take me to a conclusion...My ISP sucks hahaha, cause it doesn't matter the web server...It happens with other web servers but I have tried it only with my ISP...I'll try another one...

    Leave a comment:


  • reteset
    replied
    i checked your sample project and it works well , no error , no stop , nothing else
    see attached screenshot
    the web server is very slow , also web server may apply a bandwith limit for your IP or country
    Attached Files

    Leave a comment:


  • webultra
    replied
    Yeap. The download session never fails so i never get an error, it just doesn't start

    Leave a comment:


  • reteset
    replied
    sorry , i really need to see a sample project to see what happens at the steps you mentioned

    howover , if a download session fails it must call OnError callback with an HTTP error code
    can you check that code to see why that download session fails

    Leave a comment:


  • webultra
    replied
    Hi reteset...Yes, I have defined the tblDestFiles table so that's no the problem:

    Code:
    tblDestFiles[1] = _SourceFolder.."\\AutoPlay\\Docs\\01%20-%20Boys%20Don%27t%20Cry.mp3"
    tblDestFiles[2] = _SourceFolder.."\\AutoPlay\\Docs\\01%20-%20Hermetica%20-%20Vencedores%20Vencidos.mp3"
    tblDestFiles[3] = _SourceFolder.."\\AutoPlay\\Docs\\01%20El%20deporte%20y%20el%20hombre%20(Primera%20%c3%a9.mp3"
    tblDestFiles[4] = _SourceFolder.."\\AutoPlay\\Docs\\01.%20Atrocity%20Exhibition.mp3"
    tblDestFiles[5] = _SourceFolder.."\\AutoPlay\\Docs\\01.Ponernos%20de%20Acuerdo.mp3"
    tblDestFiles[6] = _SourceFolder.."\\AutoPlay\\Docs\\02%20-%20The%20Trickster.mp3"
    tblDestFiles[7] = _SourceFolder.."\\AutoPlay\\Docs\\02%20-%20Whatcha%20gonna%20do.mp3"
    tblDestFiles[8] = _SourceFolder.."\\AutoPlay\\Docs\\02.%20Isolation.mp3"
    tblDestFiles[9] = _SourceFolder.."\\AutoPlay\\Docs\\02.Luna%20Bonita.mp3"
    tblDestFiles[10] = _SourceFolder.."\\AutoPlay\\Docs\\03%20Beauty%20Lies%20In%20The%20Eye.mp3"
    tblDestFiles[11] = _SourceFolder.."\\AutoPlay\\Docs\\03%20The%20Wretched.mp3"
    tblDestFiles[12] = _SourceFolder.."\\AutoPlay\\Docs\\03-haiducii_-_dragostea_din_tei-WwW.Xtreme*****.NeT.mp3"
    tblDestFiles[13] = _SourceFolder.."\\AutoPlay\\Docs\\031-mish%20mash%20-%20speechless-www%20servertt%20com.mp3"
    tblDestFiles[14] = _SourceFolder.."\\AutoPlay\\Docs\\04.%20Life%20On%20Mars.mp3"
    tblDestFiles[15] = _SourceFolder.."\\AutoPlay\\Docs\\04.%20The%20Man%20Who%20Sold%20The%20World.mp3"
    The 5th or 6th download starts but it gets stuck. The OnProgress Event (function) shows the following: "0 bytes / 0 bytes Dowloading...".

    It happens even if I start randomly the downloads with something like (I always delete all the downloaded files every time I test the code):

    Code:
    function Dw(m)
    	if not m then
    		n = Math.Random(1, 15);
    	else
    		n = m
    	end
    	if not File.DoesExist(tblDestFiles[n]) then
    	local session = Download.Start(Application.GetWndHandle(), tblURL[n], tblDestFiles[n], "", "", false, tblProxy, 0, "some text", "another some text");
    
        if (session ~= nil ) then
    
          Table.Insert(tblSessionsToDelete, Table.Count(tblSessionsToDelete)+ 1, session);
          local nRow = Grid.InsertRow("Grid1", -1, true);
          Grid.SetCellText("Grid1", nRow, 0, session, false);
          Grid.SetCellText("Grid1", nRow, 1, "0 KB/S", false);
          Grid.SetCellText("Grid1", nRow, 2, "0 Second", false);
          Grid.SetCellText("Grid1", nRow, 3, 0, false);
          Grid.SetCellText("Grid1", nRow, 4, 0, false);
          Grid.SetCellText("Grid1", nRow, 5, "%0", false);
          Grid.SetCellText("Grid1", nRow, 6, "Downloading..", false);
    	end
    	end
    end
    I have timer that checks every 5 seconds if the download get stuck. If it got stuck then it deletes the download session and restarts it. After doing this, the download starts fine.
    Last edited by webultra; 12-06-2010, 11:10 AM.

    Leave a comment:


  • reteset
    replied
    your problem is a usage issue , your implemention is wrong

    you are using tblDestFiles did you define a table that matches with tblURL
    probably no , sample project defines only 4 table items so your download queue will stop at 5th download

    when an error occurs you should jump to next download , queue will not work otherwise
    program will attempt to download same file always and will never continue
    you should check HTTP error code to get why that error occurs

    converting URLs to local file paths is easy like below

    Code:
    function MakeLocalPath(strDestinationDir, strUrl)
    	local tblMakePath = String.SplitPath(String.Replace(strUrl, "/", "\\\\", false));
        local strLocalPath = strDestinationDir..tblMakePath.Filename..tblMakePath.Extension;
        return strLocalPath;
        end
    Usage :
    Code:
    strLocal = MakeLocalPath(_SourceFolder.."\\AutoPlay\\Docs\\", tblURL[n]);
    	local session = Download.Start(Application.GetWndHandle(), tblURL[n], strLocal, "", "", false, tblProxy, 0, "", "");

    Leave a comment:


  • webultra
    replied
    Yeap...This is what I'm doing (using your download sample):

    On Show: n = 1;

    My Global function:

    Code:
    function Dw(m)
    	if not m then
    		n = n+1
    	else
    		n = m
    	end
    	local session = Download.Start(Application.GetWndHandle(), tblURL[n], tblDestFiles[n], "", "", false, tblProxy, 0, "some text", "another some text");
    
        if (session ~= nil ) then
    
          Table.Insert(tblSessionsToDelete, Table.Count(tblSessionsToDelete)+ 1, session);
          local nRow = Grid.InsertRow("Grid1", -1, true);
          Grid.SetCellText("Grid1", nRow, 0, session, false);
          Grid.SetCellText("Grid1", nRow, 1, "0 KB/S", false);
          Grid.SetCellText("Grid1", nRow, 2, "0 Second", false);
          Grid.SetCellText("Grid1", nRow, 3, 0, false);
          Grid.SetCellText("Grid1", nRow, 4, 0, false);
          Grid.SetCellText("Grid1", nRow, 5, "%0", false);
          Grid.SetCellText("Grid1", nRow, 6, "Downloading..", false);
    	end
    end
    Global OnComplete function:

    Code:
    function Download.OnComplete(tblData)
    
      Download.Delete(tblData.Session);
        if (tblData.Data == "DialogEx1") then
    
         Label.SetText("Label1", "Completed..");
    
       else
       
         local nRow = FindRow(tblData.Session);
        
         if(nRow > 0) then
      
            Grid.SetCellText("Grid1", nRow, 6, "Completed", true);
            Dw()--It Starts a new download
       
          end
       end
          
    end
    Global OnError function:

    Code:
    function Download.OnError(tblData)
       
       Download.Delete(tblData.Session); -- Important !! - do not forget to call this first
       
         if (tblData.Data == "DialogEx1") then
    
         Label.SetText("Label1", "Error Occured..");
    
       else
        
      local nRow = FindRow(tblData.Session);
      if(nRow > 0) then
      
       Grid.SetCellText("Grid1", nRow, 1, "0 KB/S", true);
       Grid.SetCellText("Grid1", nRow, 2, "0 Seconds", true);
       Grid.SetCellText("Grid1", nRow, 3, "0 KB", true);
       Grid.SetCellText("Grid1", nRow, 4, "0 KB", true);
       Grid.SetCellText("Grid1", nRow, 5, "% 0", true);
       Grid.SetCellText("Grid1", nRow, 6, "Error Occured", true);
       Dw(n)--Restart the download
       
      end
    end
    end
    This is my Download queue (taken from google):

    Code:
    tblURL[1] = "http://www.laisladelax.com.ar/mp3/01%20-%20Boys%20Don%27t%20Cry.mp3"
    tblURL[2] = "http://www.laisladelax.com.ar/mp3/01%20-%20Hermetica%20-%20Vencedores%20Vencidos.mp3"
    tblURL[3] = "http://www.laisladelax.com.ar/mp3/01%20El%20deporte%20y%20el%20hombre%20(Primera%20%c3%a9.mp3"
    tblURL[4] = "http://www.laisladelax.com.ar/mp3/01.%20Atrocity%20Exhibition.mp3"
    tblURL[5] = "http://www.laisladelax.com.ar/mp3/01.Ponernos%20de%20Acuerdo.mp3"
    tblURL[6] = "http://www.laisladelax.com.ar/mp3/02%20-%20The%20Trickster.mp3"
    tblURL[7] = "http://www.laisladelax.com.ar/mp3/02%20-%20Whatcha%20gonna%20do.mp3"
    tblURL[8] = "http://www.laisladelax.com.ar/mp3/02.%20Isolation.mp3"
    tblURL[9] = "http://www.laisladelax.com.ar/mp3/02.Luna%20Bonita.mp3"
    tblURL[10] = "http://www.laisladelax.com.ar/mp3/03%20Beauty%20Lies%20In%20The%20Eye.mp3"
    tblURL[11] = "http://www.laisladelax.com.ar/mp3/03%20The%20Wretched.mp3"
    tblURL[12] = "http://www.laisladelax.com.ar/mp3/03-haiducii_-_dragostea_din_tei-WwW.Xtreme*****.NeT.mp3"
    tblURL[13] = "http://www.laisladelax.com.ar/mp3/031-mish%20mash%20-%20speechless-www%20servertt%20com.mp3"
    tblURL[14] = "http://www.laisladelax.com.ar/mp3/04.%20Life%20On%20Mars.mp3"
    tblURL[15] = "http://www.laisladelax.com.ar/mp3/04.%20The%20Man%20Who%20Sold%20The%20World.mp3"
    At the "Start" button (On click) I have the folling code:

    Code:
    tblProxy = {}
    tblProxy.Ip = "";
    tblProxy.Port = 0;
    tblProxy.Username = "";
    tblProxy.Password = "";
    Dw(n)
    After the 5th or 6th download the process gets stuck.

    Leave a comment:


  • reteset
    replied
    Originally posted by webultra View Post
    Thnx for your answers...I already downloaded your plugin and I made a download queue. Just sometimes (mostly after the 6th download) the download doesn't start so i have to restart it with the same download link.
    can you show me a sample project about it

    also you should keep error exception in mind
    for example if a session encounters an error , your queue will be breaked

    Leave a comment:


  • webultra
    replied
    Thnx for your answers...I already downloaded your plugin and I made a download queue. Just sometimes (mostly after the 6th download) the download doesn't start so i have to restart it with the same download link.

    Leave a comment:


  • reteset
    replied
    Originally posted by webultra View Post
    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".
    this is a plugin and it is not a complete download program
    this plugin requires a valid URL to target file on a server
    and a valid local path to desitnation file
    this is the way how a plugin or extension must be designed

    if i made it so , at this time you was going to ask that
    i want to save downloaded file with a different name but this stupid plugin do not let me to do it , it only ask me for the destination path but not for file name
    so , you must check redirected URLs and get actual URLs yourself
    and get file name etc..
    Originally posted by webultra View Post
    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.
    same as above

    Originally posted by webultra View Post
    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
    this plugin is already multi threaded , why are you dealing with other threads etc..
    if you want to make a queue , why not start first download and continue next downloads at Oncompleted() callback function of each other

    also you can not pause a download session (that is actually a thread and can not be paused by plugin user) if you try something that blocks a thread
    you will probably see a naked girl over your application window

    Leave a comment:

Working...
X