Skip to content
This repository
Browse code

always pass more (read: min_date) down the stack; check to see if the…

…re are any new comments to store
  • Loading branch information...
commit e8caa2850ac49f8a7d47da6736c709d6dbf196c2 1 parent 1b26fad
straup authored

Showing 1 changed file with 23 additions and 7 deletions. Show diff stats Hide diff stats

  1. +23 7 www/include/lib_flickr_photos_import.php
30 www/include/lib_flickr_photos_import.php
@@ -57,7 +57,7 @@ function flickr_photos_import_for_nsid($nsid){
57 57
58 58 foreach ($photos as $photo){
59 59
60   - flickr_photos_import_photo($photo);
  60 + flickr_photos_import_photo($photo, $more);
61 61 }
62 62
63 63 $args['page'] += 1;
@@ -158,9 +158,9 @@ function flickr_photos_import_photo_files(&$photo, $more=array()){
158 158 $local_info = str_replace("_o.{$photo['originalformat']}", "_i.json", $local_orig);
159 159 $local_comments = str_replace("_o.{$photo['originalformat']}", "_c.json", $local_orig);
160 160
161   - # god how I wished we had implemented a system to pass back
162   - # to the API *what* had actually changed; for now we'll just
163   - # assume that the photo hasn't been rotated or replaced...
  161 + # god how I wished we had implemented a system to records and pass back
  162 + # to the API *what* had actually changed when a photo was updated; for
  163 + # now we'll just assume that the photo hasn't been rotated or replaced...
164 164 # (2011115/straup)
165 165
166 166 $req = array();
@@ -174,7 +174,10 @@ function flickr_photos_import_photo_files(&$photo, $more=array()){
174 174 }
175 175
176 176 # for now, just always fetch meta files because who knows
177   - # whether anything has changed...
  177 + # whether anything has changed; note the "json:foo:path"
  178 + # syntax which are hints to tell the code to handle http_multi
  179 + # responses (below) whether to inspect the contents of the
  180 + # data returned by the flickr API
178 181
179 182 if (! isset($more['skip_meta'])){
180 183
@@ -195,12 +198,25 @@ function flickr_photos_import_photo_files(&$photo, $more=array()){
195 198
196 199 $req[] = array($api_call, "json:info:{$local_info}");
197 200
198   - # fetch comments
  201 + # fetch comments, which is to say check to see if there
  202 + # are any new photos worth storing
199 203
200 204 $fetch_comments = 1;
201 205
202   - if ($more['min_comment_date']){
  206 + if ($more['min_date']){
  207 +
  208 + $method = 'flickr.photos.comments.getList';
203 209
  210 + $args = array(
  211 + 'photo_id' => $photo['id'],
  212 + 'min_comment_date' => $more['min_date'],
  213 + );
  214 +
  215 + $rsp = flickr_api_call($method, $args);
  216 +
  217 + if (($rsp['ok']) && (! isset($rsp['rsp']['comments']['comment']))){
  218 + $fetch_comments = 0;
  219 + }
204 220 }
205 221
206 222 if ($fetch_comments){

0 comments on commit e8caa28

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