ISDBDownloader::DownloadFileEx
Jump to navigation
Jump to search
Parameters
Name | Type | Description |
---|---|---|
URL | String | URL of the content to be downloaded |
FileName | String | Specifies where to download the file, if this parameter is empty then the default download location specified in Options is used |
Headers | ISDBStringList | Custom request headers to send (e.g. "Accept-Language: en-us") |
Body | String | Body to POST, if the Body is empty string then HTTP GET is used otherwise HTTP POST method is used |
AddToLibrary | Boolean | If this parameter is TRUE then the downloaded track will be added to MediaMonkey library |
Title | String | Track title to show in the downloader (under the 'Downloads' node in Media Tree) |
Album | String | Track album to show in the downloader (under the 'Downloads' node in Media Tree) |
Artist | String | Track artist to show in the downloader (under the 'Downloads' node in Media Tree) |
Genre | String | Track genre to show in the downloader (under the 'Downloads' node in Media Tree) |
Method description
Initializes download of a file on the background.
To manipulate with the initialized download and for getting download progress use the others methods of SDBDownloader class. If you want to get an URL content directly to String then use ISDBDownloader::GetURLContentEx
Added in MediaMonkey 4.1.0.1638
Example code
Option Explicit
Dim UI : Set UI = SDB.UI
Sub OnStartUp()
Dim mnuTest
Set mnuTest = SDB.UI.AddMenuItem(SDB.UI.Menu_Edit, 0, 0)
mnuTest.Caption = SDB.Localize("Download Script")
mnuTest.OnClickFunc = "SDBOnClick"
mnuTest.UseScript = Script.ScriptPath
Script.RegisterEvent SDB, "OnDownloadFinished", "SDBDownloadFinished"
End Sub
Sub SDBDownloadFinished( URL, Success, ResponseCode)
if Success then
MsgBox("Download has finished successfuly for the URL:"&URL)
else
MsgBox("Download has failed for the URL:"&URL&", ResponseCode = "&ResponseCode)
end if
End Sub
Sub SDBOnClick(Item)
Dim Headers
Set Headers = SDB.NewStringList
Headers.Add "Accept-Language: en-us"
Headers.Add "My-Header: My Custom Header Content"
SDB.Downloader.DownloadFileEx "http://pgl.yoyo.org/http/browser-headers.php", "c:\Temp\headers.html", Headers, "My Post body", false, "title", "album", "artist", "genre"
End Sub