LOVEDownloader - A download library

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Joemag
Prole
Posts: 24
Joined: Sun Apr 14, 2013 5:42 pm

LOVEDownloader - A download library

Post by Joemag »

LOVEDownloader is a library that let you download files very easy and with seeing the progress.

A documentation is on Github: https://github.com/Joemag/LOVEDownloader


Demo 0.8.0: https://www.dropbox.com/s/sefd8vo83kcu6 ... ample.love
Demo 0.9.0: https://www.dropbox.com/s/ax9o12sc2q3c0 ... ample.love
hGJI0MO.png
hGJI0MO.png (7.41 KiB) Viewed 930 times

Download
LOVEDownloader_0.8.0.zip
(6.94 KiB) Downloaded 329 times
LOVEDownloader_0.9.0.zip
(7.02 KiB) Downloaded 392 times
Very easy

Code: Select all

LOVEDownloader = require('LOVEDownloader')

function love.load()
    file = LOVEDownloader.download("http://www.randomnumber.org/randdata/1MB_200409232104.dat", "file.dat", {
        update = function(per, down, size)
            print(per, down, size)
        end
    })
    file:start() -- Start download
end
function love.update()
    file:update()
end
function love.draw()
    love.graphics.print(math.floor(file.progress*100) .. "%", 10, 10)
    if file.success then
        print("success")
    end
end
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: LOVEDownloader - A download library

Post by Davidobot »

Looks very interesting, I'll be sure to try it out! :awesome:
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
MPQC
Citizen
Posts: 65
Joined: Fri Jun 28, 2013 2:45 pm

Re: LOVEDownloader - A download library

Post by MPQC »

Can't check the source now, but curious. Does it download the file to the love save path, or its current directory?
Joemag
Prole
Posts: 24
Joined: Sun Apr 14, 2013 5:42 pm

Re: LOVEDownloader - A download library

Post by Joemag »

MPQC wrote:Can't check the source now, but curious. Does it download the file to the love save path, or its current directory?
It uses love.filesystem, so it downloads to the loves save directory. But if you want to download to another directory, you can replace love.filesystem.newFile() with io.open() in thread.lua
User avatar
MPQC
Citizen
Posts: 65
Joined: Fri Jun 28, 2013 2:45 pm

Re: LOVEDownloader - A download library

Post by MPQC »

Makes sense. Could be quite useful as an auto updater.
Kyle
Party member
Posts: 146
Joined: Sat Mar 16, 2013 9:46 pm

Re: LOVEDownloader - A download library

Post by Kyle »

Can it do image files?

Also, the HTTP lib you have for luasocket is included in LOVE, I think.
Joemag
Prole
Posts: 24
Joined: Sun Apr 14, 2013 5:42 pm

Re: LOVEDownloader - A download library

Post by Joemag »

Kyle wrote:Can it do image files?

Also, the HTTP lib you have for luasocket is included in LOVE, I think.
Yes, you can download images. Example:

Code: Select all

downFile = LOVEDownloader.download("http://example.com/image.png", "imgs/image.png")
The http lib is included in LÖVE, but I modified it to get the size without connecting twice.
Kyle
Party member
Posts: 146
Joined: Sat Mar 16, 2013 9:46 pm

Re: LOVEDownloader - A download library

Post by Kyle »

Ah, cool! I already have my HTTP connections threaded, but I'll check out your modification because that sounds like something I could use. I'll have approximately 200,000 512x512 images in my game and something tells me people won't want those all at once :P
User avatar
Mermersk
Party member
Posts: 108
Joined: Tue Dec 20, 2011 3:27 am

Re: LOVEDownloader - A download library

Post by Mermersk »

Very nice! I can see this being very useful in the future. Maybe this could be used when making a game with someone that doesn't live anywhere close to you.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 22 guests