lms: add dtime=0 condition to all queries involving files table
authorAlexander Kanavin <alex.kanavin@gmail.com>
Mon, 24 Mar 2014 14:08:03 +0000 (16:08 +0200)
committerAlexander Kanavin <alex.kanavin@gmail.com>
Tue, 25 Mar 2014 14:30:07 +0000 (16:30 +0200)
src/plugins/lms/rygel-lms-album.vala
src/plugins/lms/rygel-lms-albums.vala
src/plugins/lms/rygel-lms-all-images.vala
src/plugins/lms/rygel-lms-all-music.vala
src/plugins/lms/rygel-lms-all-videos.vala
src/plugins/lms/rygel-lms-image-year.vala

index 7898fa7..3c23dc3 100644 (file)
@@ -34,13 +34,13 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
         "ON audios.artist_id = audio_artists.id " +
         "LEFT JOIN audio_albums " +
         "ON audios.album_id = audio_albums.id " +
-        "WHERE audios.id = files.id AND audios.album_id = %s " +
+        "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s " +
         "LIMIT ? OFFSET ?;";
 
     private static const string SQL_COUNT_TEMPLATE =
         "SELECT COUNT(audios.id) " +
         "FROM audios, files " +
-        "WHERE audios.id = files.id AND audios.album_id = %s;";
+        "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s;";
 
     private static const string SQL_COUNT_WITH_FILTER_TEMPLATE =
         "SELECT COUNT(audios.id), audios.title as title, " +
@@ -51,7 +51,7 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
         "ON audios.artist_id = audio_artists.id " +
         "LEFT JOIN audio_albums " +
         "ON audios.album_id = audio_albums.id " +
-        "WHERE audios.id = files.id AND audios.album_id = %s;";
+        "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = %s;";
 
     private static const string SQL_FIND_OBJECT_TEMPLATE =
         "SELECT files.id, files.path, files.size, " +
@@ -63,7 +63,7 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
         "ON audios.artist_id = audio_artists.id " +
         "LEFT JOIN audio_albums " +
         "ON audios.album_id = audio_albums.id " +
-        "WHERE files.id = ? AND audios.id = files.id AND audios.album_id = %s;";
+        "WHERE dtime = 0 AND files.id = ? AND audios.id = files.id AND audios.album_id = %s;";
 
     protected override MediaObject? object_from_statement (Statement statement) {
         var id = statement.column_int (0);
index d2b13cd..4f365d5 100644 (file)
@@ -60,7 +60,7 @@ public class Rygel.LMS.Albums : Rygel.LMS.CategoryContainer {
         "FROM audios, files, audio_albums " +
         "LEFT JOIN audio_artists " +
         "ON audios.artist_id = audio_artists.id " +
-        "WHERE audios.id = files.id AND audios.album_id = audio_albums.id %s;";
+        "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = audio_albums.id %s;";
 
     /* select songs inside albums */
     private static const string SQL_CHILD_ALL_WITH_FILTER_TEMPLATE =
@@ -71,7 +71,7 @@ public class Rygel.LMS.Albums : Rygel.LMS.CategoryContainer {
         "FROM audios, files, audio_albums " +
         "LEFT JOIN audio_artists " +
         "ON audios.artist_id = audio_artists.id " +
-        "WHERE audios.id = files.id AND audios.album_id = audio_albums.id %s " +
+        "WHERE dtime = 0 AND audios.id = files.id AND audios.album_id = audio_albums.id %s " +
         "LIMIT ? OFFSET ?;";
 
 
index d6f2624..1bf219d 100644 (file)
@@ -27,18 +27,18 @@ public class Rygel.LMS.AllImages : Rygel.LMS.CategoryContainer {
     private static const string SQL_ALL =
         "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
         "FROM images, files " +
-        "WHERE images.id = files.id " +
+        "WHERE dtime = 0 AND images.id = files.id " +
         "LIMIT ? OFFSET ?;";
 
     private static const string SQL_COUNT =
         "SELECT count(images.id) " +
         "FROM images, files " +
-        "WHERE images.id = files.id;";
+        "WHERE dtime = 0 AND images.id = files.id;";
 
     private static const string SQL_FIND_OBJECT =
         "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
         "FROM images, files " +
-        "WHERE files.id = ? AND images.id = files.id;";
+        "WHERE dtime = 0 AND files.id = ? AND images.id = files.id;";
 
     protected override MediaObject? object_from_statement (Statement statement) {
         var id = statement.column_int(0);
index 5791f1e..1af8c26 100644 (file)
@@ -38,13 +38,13 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
         "ON audios.album_id = audio_albums.id " +
         "LEFT JOIN audio_genres " +
         "ON audios.genre_id = audio_genres.id " +
-        "WHERE audios.id = files.id %s " +
+        "WHERE dtime = 0 AND audios.id = files.id %s " +
         "LIMIT ? OFFSET ?;";
 
     private static const string SQL_COUNT =
         "SELECT COUNT(audios.id) " +
         "FROM audios, files " +
-        "WHERE audios.id = files.id;";
+        "WHERE dtime = 0 AND audios.id = files.id;";
 
     private static const string SQL_COUNT_WITH_FILTER_TEMPLATE =
         "SELECT COUNT(audios.id), audios.title as title, " +
@@ -52,7 +52,7 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
         "FROM audios, files " +
         "LEFT JOIN audio_artists " +
         "ON audios.artist_id = audio_artists.id " +
-        "WHERE audios.id = files.id %s;";
+        "WHERE dtime = 0 AND audios.id = files.id %s;";
 
     private static const string SQL_FIND_OBJECT =
         "SELECT files.id, files.path, files.size, " +
@@ -68,7 +68,7 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
         "ON audios.album_id = audio_albums.id " +
         "LEFT JOIN audio_genres " +
         "ON audios.genre_id = audio_genres.id " +
-        "WHERE files.id = ? AND audios.id = files.id;";
+        "WHERE dtime = 0 AND files.id = ? AND audios.id = files.id;";
 
     protected override string get_sql_all_with_filter (string filter) {
         if (filter.length == 0) {
index 7f23be5..76084ae 100644 (file)
@@ -27,18 +27,18 @@ public class Rygel.LMS.AllVideos : Rygel.LMS.CategoryContainer {
     private static const string SQL_ALL =
         "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profile, dlna_mime " +
         "FROM videos, files " +
-        "WHERE videos.id = files.id " +
+        "WHERE dtime = 0 AND videos.id = files.id " +
         "LIMIT ? OFFSET ?;";
 
    private static const string SQL_COUNT =
         "SELECT count(videos.id) " +
         "FROM videos, files " +
-        "WHERE videos.id = files.id;";
+        "WHERE dtime = 0 AND videos.id = files.id;";
 
     private static const string SQL_FIND_OBJECT =
         "SELECT videos.id, title, artist, length, path, mtime, size, dlna_profile, dlna_mime " +
         "FROM videos, files " +
-        "WHERE files.id = ? AND videos.id = files.id;";
+        "WHERE dtime = 0 AND files.id = ? AND videos.id = files.id;";
 
     protected override MediaObject? object_from_statement (Statement statement) {
         var id = statement.column_int(0);
index baa0f76..b08cacd 100644 (file)
@@ -27,18 +27,18 @@ public class Rygel.LMS.ImageYear : Rygel.LMS.CategoryContainer {
     private static const string SQL_ALL_TEMPLATE =
         "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
         "FROM images, files " +
-        "WHERE images.id = files.id AND year = '%s' " +
+        "WHERE dtime = 0 AND images.id = files.id AND year = '%s' " +
         "LIMIT ? OFFSET ?;";
 
     private static const string SQL_COUNT_TEMPLATE =
         "SELECT count(images.id), strftime('%Y', date, 'unixepoch') as year " +
         "FROM images, files " +
-        "WHERE images.id = files.id AND year = '%s';";
+        "WHERE dtime = 0 AND images.id = files.id AND year = '%s';";
 
     private static const string SQL_FIND_OBJECT_TEMPLATE =
         "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
         "FROM images, files " +
-        "WHERE files.id = ? AND images.id = files.id AND year = '%s';";
+        "WHERE dtime = 0 AND files.id = ? AND images.id = files.id AND year = '%s';";
 
     protected override MediaObject? object_from_statement (Statement statement) {
         var id = statement.column_int(0);