-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solving incomplete camera upload #925
base: master
Are you sure you want to change the base?
solving incomplete camera upload #925
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall, I would love to have this merged and my files backed up again!
@@ -302,7 +306,7 @@ public void onPerformSync(android.accounts.Account account, | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 seconds, comment is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry..., I forget to modify the comments. I will fix it in the next version.
while (!isCancelled() && cursor.moveToNext()) { | ||
file_iter += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amy reason to keep this comment line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filter_iter is to help us to check whether the camera uploading service has uploaded all images.
if (image_uri == null) { | ||
syncResult.stats.numSkippedEntries++; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to keep this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reducing IO times. Only access the photo until the photo is needed to upload to the server.
if (video_uri == null) { | ||
syncResult.stats.numSkippedEntries++; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to keep this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(multiple times in this commit.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reducing IO times. Only access the photo until the photo is needed to upload to the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.