Permalink
Browse files

Change album sort ordering by date.

Change base date to filemtime instead of ctime of folder, which
works a bit better.
  • Loading branch information...
sofar committed Oct 8, 2012
1 parent 8e23a22 commit 18a7bb019edabc249fefed5a51f05b35a0a1235b
Showing with 5 additions and 9 deletions.
  1. +0 −4 TODO
  2. +2 −2 album.js
  3. +3 −3 db.php
View
4 TODO
@@ -4,7 +4,3 @@
- Replace album-watch with a C-based inotify daemon
-Index caching:
-- Create cache indices for each album based on folder modification dates
-- Cache EXIF date info into album data
-- Generate DB from cached components
View
@@ -679,14 +679,14 @@ for (x = 0; x < albums.length; x++) {
// and now sort the indices.
albums.sort(function(a, b) {
- return ((a.name < b.name) ? 1 : -1);
+ return ((a.date < b.date) ? 1 : -1);
});
for (x = 0; x < albums.length; x++) {
if (!albums[x].images)
continue;
albums[x].images.sort(function(a, b) {
- return ((a.name > b.name) ? 1 : -1);
+ return ((a.date > b.date) ? 1 : -1);
});
}
View
6 db.php
@@ -80,8 +80,8 @@
# generate and store cache
$a .= "{ name: '" . $album . "', owner: '" . $users[$x] . "', images: [\n";
- # assume the album's date is its ctime timestamp.
- $albumdate = filectime($d . "/" . $album);
+ # assume the album's date is its mtime timestamp.
+ $albumdate = filemtime($d . "/" . $album);
$ih = opendir($d . "/" . $album);
$image = readdir($ih);
@@ -113,7 +113,7 @@
}
if (!isset($date)) {
- $date = filectime($d . "/" . $album . "/" . $image);
+ $date = filemtime($d . "/" . $album . "/" . $image);
}
if (isset($date)) {

0 comments on commit 18a7bb0

Please sign in to comment.