Page 4 of 6

Re: Dropbox Livecode Library

Posted: Wed Jun 08, 2016 1:12 pm
by gpb01
Ops ... in the previous post I linked an incorrect versions of the library. Thanks to Mike for reporting :)

Enclosed the correct one ... I hope :D

Guglielmo

Re: Dropbox Livecode Library

Posted: Thu Jun 09, 2016 8:33 pm
by Mikey
All,
Another tweak to fix a typo, taking us to v. 1.11.

I am now maintaining all of this at
https://github.com/macMikey/phxDropboxLib

Note that in the phxdropboxlib folder there is a script file (plaintext), and another phxdropboxlib, which is the stack/documentation distribution folder.

Re: Dropbox Livecode Library

Posted: Thu Jun 09, 2016 9:12 pm
by sphere
Thanks for sharing!

Re: Dropbox Livecode Library

Posted: Thu Jun 09, 2016 9:33 pm
by Mikey
NOTE: There was a change in the way dropbox is handling error messages, so v. 1.12 is now up on github...

Re: Dropbox Livecode Library

Posted: Thu Jun 09, 2016 9:45 pm
by sphere
thx for the update!

Re: Dropbox Livecode Library

Posted: Mon Aug 22, 2016 3:07 pm
by trevix
Great library. Thank you very much Guglielmo and others.

Is it possible to upload and download stacks and other kind of files to DropBox using this library?
I tried using "application/octet-stream" for the file type but the only thing that happens is creating a text file with the chosen file path text in it.

Thanks

Re: Dropbox Livecode Library

Posted: Mon Aug 22, 2016 3:10 pm
by Mikey
Yes, it sure is. Make sure you base64convert the files going up, and reverse it coming back. You have to read the contents of the file, encode it, then send that to db, using the library. I don't remember there being a "copy file" function in the library.

Re: Dropbox Livecode Library

Posted: Mon Aug 22, 2016 7:43 pm
by trevix
Thanks for the fast response.
I think you meant something like this:

Code: Select all

on mouseUp
   -- upload
   if (the uTokenKey of this stack) is empty then
      exit mouseUp
   end if
   put empty into field "flAnswer"
   answer file "Choose a file to upload" --the name of the file is "ProvaBeep.livecode"
   if it is empty then exit mouseup
   set the itemdelimiter to slash
   put last item of it into tname
   
   put URL ("binfile:" & it) into tFile
   put base64Encode(tFile) into tFile
   
   put phx_DropboxWriteFile("sandbox", tname, "application/octet-stream", true, tFile) into field "flAnswer"
end mouseUp
and this

Code: Select all

on mouseUp
    -- download
    if (the uTokenKey of this stack) is empty then
        exit mouseUp
    end if
    put empty into field "flAnswer"
    
    put phx_DropboxReadFile("sandbox", "ProvaBeep.livecode") into tFile
    if "Err: " is  in tFile then
        put tFile  into field "flAnswer"
        exit mouseup
    end if
    set the defaultFolder to specialFolderPath("desktop")
    ask File "Save the file:" with  "ProvaBeep.livecode"
    if it is not empty then
        put  base64Decode(tFile) into URL ("binfile:" & it)
    end if
end mouseUp
Do you think data should be encrypted or checkout for integrity and security ? And how?
May be using the md5Digest function.. but I wouldn't know how to use it. Any help?
Thanks again

Re: Dropbox Livecode Library

Posted: Mon Aug 22, 2016 8:03 pm
by Mikey
I normally encrypt everything. The md5digest is just a checksum. You can keep that to ensure that the file has not changed, but you can't use it to fix a file that has.

Re: Dropbox Livecode Library

Posted: Sun Aug 28, 2016 7:25 pm
by sphere
Hi Guys,

it seems like this great library is becoming obsolete....if i'm correct.
look at the images on this page https://livecode.com/cross-platform-app ... en-easier/

It looks like to be included in lc8.1

cheers,
Sphere

Re: Dropbox Livecode Library

Posted: Sun Aug 28, 2016 7:31 pm
by Mikey
Mergdropbox is only for iOS.

Re: Dropbox Livecode Library

Posted: Sun Aug 28, 2016 8:08 pm
by sphere
Ah yes i've overseen that

Re: Dropbox Livecode Library

Posted: Wed Aug 31, 2016 5:12 pm
by trevix
This library is fantastic. Thank you very much indeed.

I have a problem downloading several files in a row.
I have around 10 300KB-2MG mp4 files, that works fine both manually copying it from DropBox or on the DropBox folder (MacOSX 10.10.5 LC7.4.1)
But when I download them with the library, some files get saved as 0KB (no icon either). And the library doesn't report any error.

My code is something like this:

Code: Select all

repeat
...
put  Drop_Download(tPAthFrom, tPathTo)
..
end repeat

function Drop_Download pPAthFrom, pPathTo
    if (the uTokenKey of stack "phxDropboxLib") is empty then
        return "Err: not authorized"
    end if
    --the actual download
    put phx_DropboxReadFile("sandbox", pPAthFrom) into tFile
    --tFile AT THIS POINT HAS DATA INTO IT (PROBABLY NOT WELL FORMATTED?)
    if "Err: " is  in tFile  then
        return tFile
    end if
    if "can't open file" is in tFile then
        return "Err: " & tFile
    end if
    if pPathTo is not empty then
        try
            put  base64Decode(tFile) into URL ("binfile:" & pPathTo)
        catch tErr
            answer tErr
        end try
    end if
end Drop_Download
I don't get any error report (with the Try End Try)

With few file repetitions I don't have this problem.

Any help is appreciated. Thanks
Trevix

Re: Dropbox Livecode Library

Posted: Thu Sep 01, 2016 10:46 am
by trevix
I found the problem. Not the solution or the reason why...

If I upload the video using the library (MIME "video/mp4" or "application/octet-stream"), then the download, using the library, is fine.

If I upload the video in the Finder, dragging the video file to the dropbox folder, then the download won't work.
Note that in this last case the video will hold its icon and finder info, while uploading it with the library (MIME "video/mp4" or "application/octet-stream") the icon turns into generic and the finder info are lost.

Re: Dropbox Livecode Library

Posted: Thu Sep 01, 2016 4:49 pm
by trevix
Also there is a problem with capitalized chars in path