solving incomplete camera upload#925
Conversation
danielvandenberg95
left a comment
There was a problem hiding this comment.
Looks great overall, I would love to have this merged and my files backed up again!
| // wait for TransferService to connect | ||
| // Log.d(DEBUG_TAG, "waiting for transfer service"); | ||
| int timeout = 1000; // wait up to a second | ||
| int timeout = 10000; // wait up to a second |
There was a problem hiding this comment.
10 seconds, comment is wrong.
There was a problem hiding this comment.
Sorry..., I forget to modify the comments. I will fix it in the next version.
| int file_num = cursor.getCount(); | ||
| int file_iter = cursor.getPosition(); | ||
| while (!isCancelled() && cursor.moveToNext()) { | ||
| file_iter += 1; |
There was a problem hiding this comment.
Amy reason to keep this comment line?
There was a problem hiding this comment.
filter_iter is to help us to check whether the camera uploading service has uploaded all images.
| continue; | ||
| } | ||
| file = new File(Utils.getRealPathFromURI(SeadroidApplication.getAppContext(), image_uri, media)); | ||
| // file = new File(Utils.getRealPathFromURI(SeadroidApplication.getAppContext(), image_uri, media)); |
There was a problem hiding this comment.
Any reason to keep this line?
There was a problem hiding this comment.
Reducing IO times. Only access the photo until the photo is needed to upload to the server.
| continue; | ||
| } | ||
| file = new File(Utils.getRealPathFromURI(SeadroidApplication.getAppContext(), video_uri, media)); | ||
| // file = new File(Utils.getRealPathFromURI(SeadroidApplication.getAppContext(), video_uri, media)); |
There was a problem hiding this comment.
Any reason to keep this line?
There was a problem hiding this comment.
(multiple times in this commit.)
There was a problem hiding this comment.
Reducing IO times. Only access the photo until the photo is needed to upload to the server.
There was a problem hiding this comment.
Keep this line just to help others change the code as they want.
| public boolean isInRepo(String bucketName, String filename, long filelength){ | ||
| String prefix = filename.substring(0, filename.lastIndexOf(".")); | ||
| String suffix = filename.substring(filename.lastIndexOf(".")); | ||
| // Cursor c = database.query( |
There was a problem hiding this comment.
There are two search patterns. This search pattern is the same as the original code. Another we use in L196 is more strict than the original code, but faster.
The branch solves the problem of #911. It uses SQLite to faster the speed of checking whether the photo is in the server. And if the sync service is canceled, this code can continue to scan the photos in the next time. It ignore some exception to ensure that the synchronization of other photos is not affected.