33 mensajes Página 1 de 2
Imagen


Hi, as a ive recived lots of requests about Dropbox API for managing remote files, started coding a lua module for DropBox support using my .net integration. Module needs .net framework 4 to run as its required by official dropbox api. Also this module is compatible with any lua 5.1, luajit x86, not just AMS projects.

All methods return as first value an exception that will be nil in case of success or a text explaining the exception in case of failure.


Documentation of methods:
Load the module by using require.
Make sure you put DropBox.dll in your scripts path and the others in the exe path (cd_root)
require("DropBox")
Parsed in 0.002 seconds, using GeSHi 1.0.8.9


err = DropBox.Setup(token)
This function is needed to be called after anithing else, pass to it the oauth token generated on dropbox developer app.

err, id, country, email, name, avatar_url = DropBox.GetAccount()
This function returns info about the account.

err, files, count = DropBox.GetFolder(folder_path)
This function returns a table of files on some path. for home path use an empty string "" instead a slash "/".
The files table returned should have members string "Name", bool "isFolder", string "Path" for example, files[1].Name

err = DropBox.Delete(file)
This function deletes a file from dropbox

err = DropBox.Upload(local_file, remote_file)
This function uploads a local file to dropbox

err = DropBox.Download(remote_file, local_file)
This function downloads a file from dropbox to a local file

err = DropBox.CreateFolder(path)
This function created a folder on dropbox

err, link = DropBox.GetTempLink(path)
This function return a link for a dropbox file that can be downloaded.

err = DropBox.Rename(path_from, path_to)
This function renames a file or folder on dropbox

err = DropBox.Copy(path_source, path_dest)
This function copies a file on dropbox

err, files, count = DropBox.Search(path, search_query)
This function has same return as GetFolder, but allows to search by some text pattern.



:downvote-1417755753: DOWNLOAD + SOURCE CODE

Contenido Oculto: ON
	<br />Usted necesita responder en este tema para ver el contenido oculto.
ImagenImagenImagenImagen
We are waiting for this work from a long time .. We hope you complete the project
Thank you
I can not understand where I can sign in DropBox what is the Code Can be used ? :sorry:
Imagen
abood1987 escribió: I can not understand where I can sign in DropBox what is the Code Can be used ? :sorry:


Go to https://www.dropbox.com/developers

Create some app and give it permissions you want, read/write over some folders or all account and generate an oAuth token to use in Setup function
Imagen
Imagen
ImagenImagenImagenImagen
very very Good Pabloko
Gracias

what is the Meaning of remote_file ? is this String Path or What?
and Tell us more clarifications by the statement gave another example We look forward to further clarification :friends:
Imagen
dropbox has strange issues with paths, for example if you want to use GetFolder to get the root path just use "" instead "/" as i wrote on fisrts post, everithing else will need this slash for example

err=DropBox.Upload("c:\\f ile.ext", "/my_file.ext")
err=DropBox.Download("/my_file.ext", "c:\\copyfile.ext")
err,files,count=DropBox.GetFolder("")
if err==nil then
for key,file in pairs(files) do
if (file.isFolder) then
print("Folder: "..file.Name)
else
print("File: "..file.Name)
end
end
end
Parsed in 0.002 seconds, using GeSHi 1.0.8.9


its not very hard, also err will return a exception string if something bad occurs that will tell you waths going on.
ImagenImagenImagenImagen
This is very good I understand now
Gracias
Imagen
are you test that :

err=DropBox.Upload(_DesktopFolder.."\\abs.txt", "/abs.txt")

This does not work :hypno:
and what about app Crash if i used more another code in other button or if i clicked again to be do another Download or upload or ......etc
Imagen
Thanks
abood1987 escribió: are you test that :

err=DropBox.Upload(_DesktopFolder.."\abs.txt", "/abs.txt")

This does not work :hypno:
and what about app Crash if i used more another code in other button or if i clicked again to be do another Download or upload or ......etc


Did you checked the error string? it may have some info.

By design this plugin is single threaded you may use lanes or multithread object to non-block the main thread or use concurrent requests
ImagenImagenImagenImagen
Pabloko escribió:
abood1987 escribió: are you test that :

err=DropBox.Upload(_DesktopFolder.."\\abs.txt", "/abs.txt")

This does not work :hypno:
and what about app Crash if i used more another code in other button or if i clicked again to be do another Download or upload or ......etc


Did you checked the error string? it may have some info.


nil is returned .
Imagen
Hoy abood, u were right, ive inserted a releasing of file after upload that seems to be wrongdoing the upload. Ive recompiled it. Tell me if everithing is good now.

Apart from that we could also do Async methods that call callback functions to allow concurrent stuff. I dont know if this could be useful at all.

Tell me if it works
Contenido Oculto: ON
	<br />Usted necesita responder en este tema para ver el contenido oculto.
ImagenImagenImagenImagen
that is Very good that is Very good :celeryman-1418247558: but if it have a call callback functions to View a Wait time 4 Compleate the Upload it is will be a very Good Compleate Plugin " Can You Do that ??? " callback functions 4 all Plugin functions Please. Such as if the user wants to View time through Progress or wants to do any thing through any Code He wants to Put it By himself
Gracias Pablo Imagen
Imagen
abood1987 escribió: that is Very good that is Very good :celeryman-1418247558: but if it have a call callback functions to View a Wait time 4 Compleate the Upload it is will be a very Good Compleate Plugin " Can You Do that ??? " callback functions 4 all Plugin functions Please. Such as if the user wants to View time through Progress or wants to do any thing through any Code He wants to Put it By himself
Gracias Pablo Imagen


As you know by design model for plugins is non thread safe and single threaded but i will try to make it async as you request as Eid present for you. stand by some days... i will come with new release
ImagenImagenImagenImagen
This is a beta of async events, please test it extensively until i can release it.

Now all methods except setup have an async version,
DropBox.asyncXxxxx(..., function(err,...) --[[...]] end)
where the last argument is always a callback function that arguments are the defailt return values, for example:

DropBox.asyncGetAccount(function(err, id, country, email, name, avatar)
        print(err, name)
end)

DropBox.asyncGetFolder("", function(err, files, count)
        print(err) --should be nil
end)
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.9


Each task will spawn an own thread and connect a Dropbox session so make sure its estable and dont crash while perform other tasks

Contenido Oculto: ON
	<br />Usted necesita responder en este tema para ver el contenido oculto.
ImagenImagenImagenImagen
crash Still Found is i used any function more than 1 time or if i used Different functions sequentially in different buttons

may be all dells Where is found in CD_Root needed to be ReUpload again ?? i do't Know :hypno:

and another question is this Code by this way is Right ?
function abood()
     Progress.SetCurrentPos("Progress1", 70);
end

DropBox.asyncUpload(_DesktopFolder.."\\Untitled.png", "/Untitled.png",abood);





if this Code have an CallBack Function what is arg ? or not have any arg

by any way all function is work very good Imagen only 1 code you can used on the run Application Mor time Or another Code will be crash app
Imagen
if this Code have an CallBack Function what is arg ? or not have any arg


The args are the normal results, of each method. In this case "err" should be an argument.

DropBox.Upload(x,y, function(err)
      --err will be nil if success, if not error msg
end)
Parsed in 0.002 seconds, using GeSHi 1.0.8.9


ive posted examples lately take a better look at the post.

The crashing stuff, idk its not happening to me but as im breaking the threadsafeness of the system i could expect it... maybe i will think about some fix to join spawned thread to main one...
ImagenImagenImagenImagen
Pabloko escribió:
The crashing stuff, idk its not happening to me but as im breaking the threadsafeness of the system i could expect it

i used windows 7
Imagen
Gracias Pablo, lo mejor es que soporta otros interpretes de lua aparte de ams :) :) :) :) :) :)
Imagen
Imagen

Si quieres puedes apoyar el chat de la comunidad de amsspecilist
is there any new news ?
Imagen
33 mensajes Página 1 de 2

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 2 invitados