Permalink
Browse files

add hooks to prefetch places data on photo import

  • Loading branch information...
1 parent 648d66d commit a4de17165e8fce819cc2091432234c099eb07d04 straup committed Nov 21, 2011
Showing with 17 additions and 0 deletions.
  1. +3 −0 www/include/config.php.example
  2. +14 −0 www/include/lib_flickr_photos_import.php
@@ -92,6 +92,9 @@
# Hey look! Things that require Solr.
$GLOBALS['cfg']['enable_feature_places'] = 0;
+ $GLOBALS['cfg']['places_prefetch_data'] = 1;
+
+ #
$GLOBALS['cfg']['rewrite_static_urls'] = array(
# '/foo' => '/bar/',
@@ -3,6 +3,7 @@
#################################################################
loadlib("flickr_photos");
+ loadlib("flickr_places");
loadlib("flickr_photos_lookup");
loadlib("flickr_photos_search");
loadlib("flickr_api");
@@ -114,6 +115,13 @@ function flickr_photos_import_photo($photo, $more=array()){
flickr_photos_search_index_photo($photo);
}
+ if (($GLOBALS['cfg']['enable_feature_solr']) && ($GLOBALS['cfg']['enable_feature_places'])){
+
+ if (($photo['woeid']) && ($GLOBALS['cfg']['places_prefetch_data'])){
+ flickr_places_get_by_woeid($photo['woeid']);
+ }
+ }
+
return array(
'ok' => 1,
'photo' => $photo
@@ -440,6 +448,9 @@ function _flickr_photos_import_prepare_photo(&$user, $photo){
$photo['media'] = ($photo['media'] == 'photo') ? 0 : 1;
unset($photo['media_status']);
+ # Strictly speaking, I am probably most responsible for
+ # the need to do this. I'm sorry... (20111121/straup)
+
$photo['hasgeo'] = ($photo['accuracy']) ? 1 : 0;
if (! $photo['hasgeo']){
@@ -487,6 +498,9 @@ function _flickr_photos_import_prepare_photo(&$user, $photo){
unset($photo['date_faved']);
}
+ # TO DO: check for EXIF data and set $photo['hasexif']
+ # required db alter (20111121/straup)
+
return $photo;
}

0 comments on commit a4de171

Please sign in to comment.