Skip to content
Browse files

actually tracking start/update times for contact/faves backup properl…

…y and 'fix' the duplicate keys for faves problem in the process
  • Loading branch information...
1 parent 0130c2a commit a5cd73306cdbbf4466710b469fe4228c06f7cfb4 straup committed Dec 8, 2011
Showing with 25 additions and 11 deletions.
  1. +0 −2 README.md
  2. +11 −6 www/include/lib_flickr_backups.php
  3. +14 −3 www/include/lib_flickr_photos_import.php
View
2 README.md
@@ -88,8 +88,6 @@ TO DO:
* search, see also: [parallel-flickr-solr](https://github.com/straup/parallel-flickr-solr)
-* duplicate key errors fetching faves
-
* better layout, tested in more than just Firefox
See also: [TODO.txt](https://github.com/straup/parallel-flickr/blob/master/TODO.txt)
View
17 www/include/lib_flickr_backups.php
@@ -210,15 +210,13 @@ function flickr_backups_get_faves(&$user){
$rsp = flickr_faves_import_for_nsid($flickr_user['nsid'], $more);
- if (($rsp['ok']) && (! $backup['date_firstupdate'])){
- $update['date_firstupdate'] = $update['date_lastupdate'];
- }
-
- #
-
if ($rsp['ok']){
$update['date_lastupdate'] = $start_time;
$update['details'] = "count: {$rsp['count_imported']}";
+
+ if (! $backup['date_firstupdate']){
+ $update['date_firstupdate'] = $update['date_lastupdate'];
+ }
}
else {
@@ -244,6 +242,9 @@ function flickr_backups_get_contacts(&$user){
);
}
+ $backup = $backups['contacts'];
+ $update = array();
+
$start_time = time();
$rsp = flickr_contacts_purge_contacts($user);
@@ -257,6 +258,10 @@ function flickr_backups_get_contacts(&$user){
if ($rsp['ok']){
$update['date_lastupdate'] = $start_time;
$update['details'] = "count: {$rsp['count_imported']}";
+
+ if (! $backup['date_firstupdate']){
+ $update['date_firstupdate'] = $update['date_lastupdate'];
+ }
}
else {
View
17 www/include/lib_flickr_photos_import.php
@@ -162,12 +162,18 @@ function flickr_photos_import_photo_files(&$photo, $more=array()){
$small = "{$root}_{$photo['secret']}_z.jpg";
+ $ext = ($photo["originalsecret"]) ? $photo["originalformat"] : "jpg";
+
if ($photo['originalsecret']){
- $orig = "{$root}_{$photo['originalsecret']}_o.{$photo['originalformat']}";
+
+ # This is probably really only necessary for
+ # Cal's account (20111208/straup)
+
+ $orig = ($ext) ? "{$root}_{$photo['originalsecret']}_o.{$ext}" : null;
}
else {
- $orig = "{$root}_{$photo['secret']}_b.jpg";
+ $orig = "{$root}_{$photo['secret']}_b.{$ext}";
}
if ($photo['media'] == 1){
@@ -207,7 +213,12 @@ function flickr_photos_import_photo_files(&$photo, $more=array()){
}
if (($more['force']) || (! file_exists($local_orig))){
- $req[] = array($orig, $local_orig);
+
+ # see above
+
+ if ($orig){
+ $req[] = array($orig, $local_orig);
+ }
}
# for now, just always fetch meta files because who knows

0 comments on commit a5cd733

Please sign in to comment.
Something went wrong with that request. Please try again.