summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG1
-rw-r--r--phpfspot.class.php32
2 files changed, 29 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c0befcb..e6fee40 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@ phpfspot (1.5)
* feature, display tag-selection with preview-icons in photo index.
* feature, support for Nikon's NEF RAW photo format (via dcraw and ImageMagick).
* feature, auto-scroll in photo index if thumbnails are out of sight.
+ * feature, support F-Spot's rating values.
* bug, if tag added to hide-tags, don't show up in photo-details box (single-photo).
* bug, if tag added to hide-tags, don't allow adding to selected-tags list.
* bug, if tag added to hide-tags, random-photo needs to take care of it.
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 1d20ab1..e6c4aff 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -157,6 +157,7 @@ class PHPFSPOT {
");
}
+ /* get F-Spot database version */
$this->dbver = $this->getFspotDBVersion();
if(!is_writeable($this->cfg->base_path ."/templates_c")) {
@@ -203,6 +204,14 @@ class PHPFSPOT {
$this->tmpl->assign('web_path', $this->cfg->web_path);
+ /* Starting with F-Spot 0.4.2, the rating-feature was available */
+ if($this->dbver > 10) {
+ $this->sort_orders = array_merge($this->sort_orders, array(
+ 'rate_asc' => 'Rate ↑',
+ 'rate_desc' => 'Rate ↓',
+ ));
+ }
+
/* check if all necessary indices exist */
$this->checkDbIndices();
@@ -425,10 +434,19 @@ class PHPFSPOT {
";
}
else {
- $query_str = "
- SELECT p.id, p.uri, p.time, p.description
- FROM photos p
- ";
+ /* till F-Spot version 0.4.1 */
+ if($this->dbver < 11) {
+ $query_str = "
+ SELECT p.id, p.uri, p.time, p.description
+ FROM photos p
+ ";
+ }
+ else {
+ $query_str = "
+ SELECT p.id, p.uri, p.time, p.description, p.rating
+ FROM photos p
+ ";
+ }
}
/* if show_tags is set, only return details for photos which
@@ -2538,6 +2556,12 @@ class PHPFSPOT {
case 'tags_desc':
return " ORDER BY t.name DESC ,p.time ASC";
break;
+ case 'rate_asc':
+ return " ORDER BY t.name ASC, p.rating ASC";
+ break;
+ case 'rate_desc':
+ return " ORDER BY t.name DESC, p.rating DESC";
+ break;
}
} // get_sort_order()