Posted 21 September 2012 - 04:59 AM
I had access issues with Pastebin, so I couldn't use it. Therefore I wrote a little program to download files from Dropbox, mostly for convenience sakes.
So far, it has been tested on 1.33 and above.
Source:
Changelog:
[indent=1]- Released.[/indent]
[indent=1]- Added some extra error checking and made it so it uses https if on the correct version of ComputerCraft.[/indent]
[indent=1]- Added some more error checking, mainly cause I keep forgetting to update the iDropboxUser variable and then it crashes.[/indent]Usage: dropbox [remote filename] [filename].
Requirements: HTTP API needs to be enabled.
Download (or copy from above): https://dl.dropbox.c...ode/dropbox.lua
So far, it has been tested on 1.33 and above.
Source:
Spoiler
local tVarargs = {...}
local sDropboxFilename = tVarargs[1]
local sLocalFilename = tVarargs[2]
local iDropboxUser = 0
--[[ Enter your dropbox user ID on the line above.
To get your ID copy a public link and it's the long
number after the /u/. ]]
if #tVarargs ~= 2 then
print("Usage: dropbox [remote filename] [filename]")
return
elseif not http then
print("Please enable the HTTP API to used this program.")
return
elseif iDropboxUser == 0 then
print("Please edit this program and change the Dropbox ID on line 4 to your own ID.")
return
end
local sVersion = string.sub(os.version(), -3)
local fileGet = {}
if sVersion == "1.4" then
fileGet = http.get("https://dl.dropbox.com/u/" .. iDropboxUser .. "/" .. sDropboxFilename)
else
fileGet = http.get("http://dl.dropbox.com/u/" .. iDropboxUser .. "/" .. sDropboxFilename)
end
if fs.exists(sLocalFilename) == true then
fs.delete(sLocalFilename)
end
local tFile = fs.open(sLocalFilename, "w")
tFile.write(fileGet.readAll())
tFile.close()
fileGet.close()
Changelog:
Spoiler
I know this isn't "standard" but oh well.[indent=1]- Released.[/indent]
[indent=1]- Added some extra error checking and made it so it uses https if on the correct version of ComputerCraft.[/indent]
[indent=1]- Added some more error checking, mainly cause I keep forgetting to update the iDropboxUser variable and then it crashes.[/indent]
Requirements: HTTP API needs to be enabled.
Download (or copy from above): https://dl.dropbox.c...ode/dropbox.lua