Open alexbw opened 11 years ago
This shouldn't be crazy hard. For whoever wants to do this in the future, I'd recommend using the Dropbox DataStore API in conjunction with the Dropbox Core API (which we're already using to transfer files one-way).
When you create a recording file, make an entry for it with the DataStore API in a pre-specified table. Then, upload the file. Mark in the table when the upload is complete. When you try to populate the BBFileListTableView, check the DataStore API for existing files, verify that they're in the Backyard Brains Dropbox App folder with the Core API, and then build BBFiles with them all.
There's two cases of mismatch, and I think this should be the first attempt at how to deal with them:
1) There's metadata, but no file. If this is the case, and the file has been marked as uploaded via the DataStore API, then ignore the entry, and delete the item in the DataStore. This is probably an indication that the user has deleted the file by hand from the dropbox folder.
2) There's a file, but no metadata. If this is the case, and the file is of an appropriate data-type (m4a), then make an entry for it in the DataStore, and allow the user to check it out. This could mean that the user added extra datafiles to her app folder in order to view them on another device. I don't know if there's security concerns here, but I think it's fair to trust the files that come into the App folder, at least for now.
This can be added when we make our filetype that will be universal across all platforms (Android, PC, iOS, Mac, Linux). Our filetype will be one zip file that contains signal, events, spikes, metadata and any other experiment specific files.
Would be nice to have two-way Dropbox sync. That way, multiple devices could share the same recordings.