Skip to content

Add Download Archives Support#2991

Open
alzamer2 wants to merge 1 commit into
dazedcat19:masterfrom
alzamer2:add-download-archives-support
Open

Add Download Archives Support#2991
alzamer2 wants to merge 1 commit into
dazedcat19:masterfrom
alzamer2:add-download-archives-support

Conversation

@alzamer2
Copy link
Copy Markdown

some sites can support download archive for their chapters, this feature update FMD2 so it can handle archives Urls and download them function Init()
local m = NewWebsiteModule()
m.ID = 'my-module'
m.Name = 'MySite'
m.RootURL = 'https://example.com'
m.Category = 'Category'
m.OnGetInfo = 'GetInfo'
m.OnGetPageNumber = 'GetPageNumber'

m.SupportArchiveDownloading = true
m.OnDownloadArchive = 'DownloadArchive'

end
function GetPageNumber()
-- Add archive URLs to TASK.PageLinks
TASK.PageLinks.Add('https://example.com/chapter1.zip')
return true
end
function DownloadArchive()
-- URL = archive URL from TASK.PageLinks
-- PATH = manga root path (not chapter folder)
-- FILENAME = chapter name
local saveFile = PATH .. FILENAME .. '.zip'
return HTTP.GET(URL) and HTTP.Document.SaveToFile(saveFile)
end

some sites can support download archive for their chapters, this feature update FMD2 so it can handle archives Urls and download them
function Init()
    local m = NewWebsiteModule()
    m.ID = 'my-module'
    m.Name = 'MySite'
    m.RootURL = 'https://example.com'
    m.Category = 'Category'
    m.OnGetInfo = 'GetInfo'
    m.OnGetPageNumber = 'GetPageNumber'

    m.SupportArchiveDownloading = true
    m.OnDownloadArchive = 'DownloadArchive'
end
function GetPageNumber()
    -- Add archive URLs to TASK.PageLinks
    TASK.PageLinks.Add('https://example.com/chapter1.zip')
    return true
end
function DownloadArchive()
    -- URL = archive URL from TASK.PageLinks
    -- PATH = manga root path (not chapter folder)
    -- FILENAME = chapter name
    local saveFile = PATH .. FILENAME .. '.zip'
    return HTTP.GET(URL) and HTTP.Document.SaveToFile(saveFile)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant