Dropbox Livecode Library

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm
Location: Switzerland

Re: Dropbox Livecode Library

Post by gpb01 » Wed Jun 08, 2016 1:12 pm

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
Attachments
phxDropboxLib.zip
(14.37 KiB) Downloaded 360 times

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Thu Jun 09, 2016 8:33 pm

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.
Last edited by Mikey on Thu Jun 09, 2016 9:21 pm, edited 1 time in total.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Thu Jun 09, 2016 9:12 pm

Thanks for sharing!

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Thu Jun 09, 2016 9:33 pm

NOTE: There was a change in the way dropbox is handling error messages, so v. 1.12 is now up on github...

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Thu Jun 09, 2016 9:45 pm

thx for the update!

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Dropbox Livecode Library

Post by trevix » Mon Aug 22, 2016 3:07 pm

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Mon Aug 22, 2016 3:10 pm

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.

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Dropbox Livecode Library

Post by trevix » Mon Aug 22, 2016 7:43 pm

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Mon Aug 22, 2016 8:03 pm

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.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Sun Aug 28, 2016 7:25 pm

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

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Dropbox Livecode Library

Post by Mikey » Sun Aug 28, 2016 7:31 pm

Mergdropbox is only for iOS.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Dropbox Livecode Library

Post by sphere » Sun Aug 28, 2016 8:08 pm

Ah yes i've overseen that

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Dropbox Livecode Library

Post by trevix » Wed Aug 31, 2016 5:12 pm

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
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Dropbox Livecode Library

Post by trevix » Thu Sep 01, 2016 10:46 am

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.
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

trevix
Posts: 958
Joined: Sat Feb 24, 2007 11:25 pm
Location: Italy
Contact:

Re: Dropbox Livecode Library

Post by trevix » Thu Sep 01, 2016 4:49 pm

Also there is a problem with capitalized chars in path
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>

Post Reply

Return to “Announcements”