[rygel] lms: Fix style issues



commit 55d1bc4fefe874b2fede0675deb1122f8d873383
Author: Jens Georg <mail jensge org>
Date:   Sun Jan 17 22:24:27 2016 +0100

    lms: Fix style issues
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/plugins/lms/rygel-lms-album.vala              |   57 ++++++++++++--------
 src/plugins/lms/rygel-lms-albums.vala             |   14 +++---
 src/plugins/lms/rygel-lms-all-images.vala         |   46 +++++++++--------
 src/plugins/lms/rygel-lms-all-music.vala          |   58 ++++++++++++---------
 src/plugins/lms/rygel-lms-all-videos.vala         |   46 +++++++++--------
 src/plugins/lms/rygel-lms-artist.vala             |    4 +-
 src/plugins/lms/rygel-lms-artists.vala            |   11 ++--
 src/plugins/lms/rygel-lms-category-container.vala |   25 ++++++---
 src/plugins/lms/rygel-lms-database.vala           |    8 ++--
 src/plugins/lms/rygel-lms-dbus-interfaces.vala    |    3 +-
 src/plugins/lms/rygel-lms-image-year.vala         |   46 +++++++++--------
 src/plugins/lms/rygel-lms-image-years.vala        |   10 ++--
 src/plugins/lms/rygel-lms-music-root.vala         |    5 ++-
 src/plugins/lms/rygel-lms-plugin-factory.vala     |    8 ++--
 src/plugins/lms/rygel-lms-plugin.vala             |    8 ++-
 src/plugins/lms/rygel-lms-root-container.vala     |   19 +++++--
 16 files changed, 212 insertions(+), 156 deletions(-)
---
diff --git a/src/plugins/lms/rygel-lms-album.vala b/src/plugins/lms/rygel-lms-album.vala
index e567ee1..11cb56c 100644
--- a/src/plugins/lms/rygel-lms-album.vala
+++ b/src/plugins/lms/rygel-lms-album.vala
@@ -26,7 +26,9 @@ using Sqlite;
 public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
     private static const string SQL_ALL_TEMPLATE =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title as title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name as artist, " +
                "audio_albums.name " +
         "FROM audios, files " +
@@ -55,7 +57,9 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
 
     private static const string SQL_FIND_OBJECT_TEMPLATE =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name, " +
                "audio_albums.name " +
         "FROM audios, files " +
@@ -63,11 +67,14 @@ 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 dtime = 0 AND 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;";
 
     private static const string SQL_ADDED_TEMPLATE =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title as title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name as artist, " +
                "audio_albums.name " +
         "FROM audios, files " +
@@ -80,7 +87,9 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
 
     private static const string SQL_REMOVED_TEMPLATE =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title as title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name as artist, " +
                "audio_albums.name " +
         "FROM audios, files " +
@@ -91,33 +100,32 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
         "WHERE dtime <> 0 AND audios.id = files.id AND audios.album_id = %s " +
         "AND update_id > ? AND update_id <= ?;";
 
-    protected override MediaObject? object_from_statement (Statement statement) {
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
         var id = statement.column_int (0);
         var path = statement.column_text (1);
-        var mime_type = statement.column_text(10);
+        var mime_type = statement.column_text (10);
 
         if (mime_type == null || mime_type.length == 0) {
             /* TODO is this correct? */
-            debug ("Music item %d (%s) has no MIME type",
-                   id,
-                   path);
+            debug ("Music item %d (%s) has no MIME type", id, path);
         }
 
-        var title = statement.column_text(3);
+        var title = statement.column_text (3);
         var song_id = this.build_child_id (id);
         var song = new MusicItem (song_id, this, title);
         song.ref_id = this.build_reference_id (id);
-        song.size = statement.column_int(2);
-        song.track_number = statement.column_int(4);
-        song.duration = statement.column_int(5);
-        song.channels = statement.column_int(6);
-        song.sample_freq = statement.column_int(7);
-        song.bitrate = statement.column_int(8);
-        song.dlna_profile = statement.column_text(9);
+        song.size = statement.column_int (2);
+        song.track_number = statement.column_int (4);
+        song.duration = statement.column_int (5);
+        song.channels = statement.column_int (6);
+        song.sample_freq = statement.column_int (7);
+        song.bitrate = statement.column_int (8);
+        song.dlna_profile = statement.column_text (9);
         song.mime_type = mime_type;
-        song.artist = statement.column_text(11);
-        song.album = statement.column_text(12);
-        File file = File.new_for_path (path);
+        song.artist = statement.column_text (11);
+        song.album = statement.column_text (12);
+        var file = File.new_for_path (path);
         song.add_uri (file.get_uri ());
 
         return song;
@@ -143,7 +151,9 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
         if (filter.length == 0) {
             return this.sql_all;
         }
+
         var filter_str = "%s AND %s".printf (this.db_id, filter);
+
         return (SQL_ALL_TEMPLATE.printf (filter_str));
     }
 
@@ -151,7 +161,9 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
         if (filter.length == 0) {
             return this.sql_count;
         }
+
         var filter_str = "%s AND %s".printf (this.db_id, filter);
+
         return (SQL_COUNT_WITH_FILTER_TEMPLATE.printf (filter_str));
     }
 
@@ -167,7 +179,6 @@ public class Rygel.LMS.Album : Rygel.LMS.CategoryContainer {
               get_sql_find_object (db_id),
               get_sql_count (db_id),
               get_sql_added (db_id),
-              get_sql_removed (db_id)
-             );
+              get_sql_removed (db_id));
     }
 }
diff --git a/src/plugins/lms/rygel-lms-albums.vala b/src/plugins/lms/rygel-lms-albums.vala
index ef8f7b5..89d9323 100644
--- a/src/plugins/lms/rygel-lms-albums.vala
+++ b/src/plugins/lms/rygel-lms-albums.vala
@@ -95,8 +95,7 @@ public class Rygel.LMS.Albums : Rygel.LMS.CategoryContainer {
     }
 
     protected override uint get_child_count_with_filter (string     where_filter,
-                                                        ValueArray args)
-    {
+                                                         ValueArray args) {
 
         /* search the children (albums) as usual */
         var count = base.get_child_count_with_filter (where_filter, args);
@@ -119,11 +118,12 @@ public class Rygel.LMS.Albums : Rygel.LMS.CategoryContainer {
         return count;
     }
 
-    protected override MediaObjects? get_children_with_filter (string     where_filter,
-                                                               ValueArray args,
-                                                               string     sort_criteria,
-                                                               uint       offset,
-                                                               uint       max_count) {
+    protected override MediaObjects? get_children_with_filter
+                                            (string     where_filter,
+                                             ValueArray args,
+                                             string     sort_criteria,
+                                             uint       offset,
+                                             uint       max_count) {
         var children = base. get_children_with_filter (where_filter,
                                                        args,
                                                        sort_criteria,
diff --git a/src/plugins/lms/rygel-lms-all-images.vala b/src/plugins/lms/rygel-lms-all-images.vala
index 0b54c7f..5231fd3 100644
--- a/src/plugins/lms/rygel-lms-all-images.vala
+++ b/src/plugins/lms/rygel-lms-all-images.vala
@@ -25,7 +25,8 @@ using Sqlite;
 
 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 " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+            "dlna_profile, dlna_mime " +
         "FROM images, files " +
         "WHERE dtime = 0 AND images.id = files.id " +
         "LIMIT ? OFFSET ?;";
@@ -36,45 +37,47 @@ public class Rygel.LMS.AllImages : Rygel.LMS.CategoryContainer {
         "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 " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+            "dlna_profile, dlna_mime " +
         "FROM images, files " +
         "WHERE dtime = 0 AND files.id = ? AND images.id = files.id;";
 
     private static const string SQL_ADDED =
-        "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+            "dlna_profile, dlna_mime " +
         "FROM images, files " +
         "WHERE dtime = 0 AND images.id = files.id " +
         "AND update_id > ? AND update_id <= ?;";
 
     private static const string SQL_REMOVED =
-        "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+        "dlna_profile, dlna_mime " +
         "FROM images, files " +
         "WHERE dtime <> 0 AND images.id = files.id " +
         "AND update_id > ? AND update_id <= ?;";
 
-    protected override MediaObject? object_from_statement (Statement statement) {
-        var id = statement.column_int(0);
-        var path = statement.column_text(6);
-        var mime_type = statement.column_text(9);
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
+        var id = statement.column_int (0);
+        var path = statement.column_text (6);
+        var mime_type = statement.column_text (9);
 
         if (mime_type == null || mime_type.length == 0){
             /* TODO is this correct? */
-            debug ("Image item %d (%s) has no MIME type",
-                   id,
-                   path);
+            debug ("Image item %d (%s) has no MIME type", id, path);
         }
 
-        var title = statement.column_text(1);
-        var image = new ImageItem(this.build_child_id (id), this, title);
-        image.creator = statement.column_text(2);
-        TimeVal tv = { (long) statement.column_int(3), (long) 0 };
+        var title = statement.column_text (1);
+        var image = new ImageItem (this.build_child_id (id), this, title);
+        image.creator = statement.column_text (2);
+        TimeVal tv = { (long) statement.column_int (3), (long) 0 };
         image.date = tv.to_iso8601 ();
-        image.width = statement.column_int(4);
-        image.height = statement.column_int(5);
-        image.size = statement.column_int(7);
+        image.width = statement.column_int (4);
+        image.height = statement.column_int (5);
+        image.size = statement.column_int (7);
         image.mime_type = mime_type;
-        image.dlna_profile = statement.column_text(8);
-        File file = File.new_for_path(path);
+        image.dlna_profile = statement.column_text (8);
+        var file = File.new_for_path (path);
         image.add_uri (file.get_uri ());
 
         return image;
@@ -89,7 +92,6 @@ public class Rygel.LMS.AllImages : Rygel.LMS.CategoryContainer {
               AllImages.SQL_FIND_OBJECT,
               AllImages.SQL_COUNT,
               AllImages.SQL_ADDED,
-              AllImages.SQL_REMOVED
-             );
+              AllImages.SQL_REMOVED);
     }
 }
diff --git a/src/plugins/lms/rygel-lms-all-music.vala b/src/plugins/lms/rygel-lms-all-music.vala
index 027dbeb..770e933 100644
--- a/src/plugins/lms/rygel-lms-all-music.vala
+++ b/src/plugins/lms/rygel-lms-all-music.vala
@@ -26,7 +26,9 @@ using Sqlite;
 public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
     private static const string SQL_ALL_TEMPLATE =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title as title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name as artist, " +
                "audio_albums.name, " +
                "files.mtime, " +
@@ -56,7 +58,9 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
 
     private static const string SQL_FIND_OBJECT =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name, " +
                "audio_albums.name, " +
                "files.mtime, " +
@@ -72,7 +76,9 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
 
     private static const string SQL_ADDED =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title as title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name as artist, " +
                "audio_albums.name, " +
                "files.mtime, " +
@@ -89,7 +95,9 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
 
     private static const string SQL_REMOVED =
         "SELECT files.id, files.path, files.size, " +
-               "audios.title as title, audios.trackno, audios.length, audios.channels, audios.sampling_rate, 
audios.bitrate, audios.dlna_profile, audios.dlna_mime, " +
+               "audios.title as title, audios.trackno, audios.length, " +
+               "audios.channels, audios.sampling_rate, audios.bitrate, " +
+               "audios.dlna_profile, audios.dlna_mime, " +
                "audio_artists.name as artist, " +
                "audio_albums.name, " +
                "files.mtime, " +
@@ -108,7 +116,9 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
         if (filter.length == 0) {
             return this.sql_all;
         }
+
         var filter_str = "AND %s".printf (filter);
+
         return (AllMusic.SQL_ALL_TEMPLATE.printf (filter_str));
     }
 
@@ -116,39 +126,40 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
         if (filter.length == 0) {
             return this.sql_count;
         }
+
         var filter_str = "AND %s".printf (filter);
+
         return (AllMusic.SQL_COUNT_WITH_FILTER_TEMPLATE.printf (filter_str));
     }
 
-    protected override MediaObject? object_from_statement (Statement statement) {
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
         var id = statement.column_int (0);
         var path = statement.column_text (1);
-        var mime_type = statement.column_text(10);
+        var mime_type = statement.column_text (10);
 
         if (mime_type == null || mime_type.length == 0) {
             /* TODO is this correct? */
-            debug ("Music item %d (%s) has no MIME type",
-                   id,
-                   path);
+            debug ("Music item %d (%s) has no MIME type", id, path);
         }
 
-        var title = statement.column_text(3);
+        var title = statement.column_text (3);
         var song_id = this.build_child_id (id);
         var song = new MusicItem (song_id, this, title);
-        song.size = statement.column_int(2);
-        song.track_number = statement.column_int(4);
-        song.duration = statement.column_int(5);
-        song.channels = statement.column_int(6);
-        song.sample_freq = statement.column_int(7);
-        song.bitrate = statement.column_int(8);
-        song.dlna_profile = statement.column_text(9);
+        song.size = statement.column_int (2);
+        song.track_number = statement.column_int (4);
+        song.duration = statement.column_int (5);
+        song.channels = statement.column_int (6);
+        song.sample_freq = statement.column_int (7);
+        song.bitrate = statement.column_int (8);
+        song.dlna_profile = statement.column_text (9);
         song.mime_type = mime_type;
-        song.artist = statement.column_text(11);
-        song.album = statement.column_text(12);
-        TimeVal tv = { (long) statement.column_int(13), (long) 0 };
+        song.artist = statement.column_text (11);
+        song.album = statement.column_text (12);
+        TimeVal tv = { (long) statement.column_int (13), (long) 0 };
         song.date = tv.to_iso8601 ();
-        song.genre = statement.column_text(14);
-        File file = File.new_for_path (path);
+        song.genre = statement.column_text (14);
+        var file = File.new_for_path (path);
         song.add_uri (file.get_uri ());
 
         return song;
@@ -163,7 +174,6 @@ public class Rygel.LMS.AllMusic : Rygel.LMS.CategoryContainer {
              AllMusic.SQL_FIND_OBJECT,
              AllMusic.SQL_COUNT,
              AllMusic.SQL_ADDED,
-             AllMusic.SQL_REMOVED
-            );
+             AllMusic.SQL_REMOVED);
     }
 }
diff --git a/src/plugins/lms/rygel-lms-all-videos.vala b/src/plugins/lms/rygel-lms-all-videos.vala
index dbde0db..0cc0731 100644
--- a/src/plugins/lms/rygel-lms-all-videos.vala
+++ b/src/plugins/lms/rygel-lms-all-videos.vala
@@ -52,11 +52,12 @@ public class Rygel.LMS.AllVideos : Rygel.LMS.CategoryContainer {
         "WHERE dtime <> 0 AND videos.id = files.id " +
         "AND update_id > ? AND update_id <= ?;";
 
-    protected override MediaObject? object_from_statement (Statement statement) {
-        var id = statement.column_int(0);
-        var mime_type = statement.column_text(8);
-        var path = statement.column_text(4);
-        var file = File.new_for_path(path);
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
+        var id = statement.column_int (0);
+        var mime_type = statement.column_text (8);
+        var path = statement.column_text (4);
+        var file = File.new_for_path (path);
 
         /* TODO: Temporary code to extract the MIME TYPE.  LMS does not seem
            to compute the mime type of videos.  Don't know why. */
@@ -75,16 +76,16 @@ public class Rygel.LMS.AllVideos : Rygel.LMS.CategoryContainer {
             debug ("Video item %d (%s) has no MIME type",
                    id,
                    path);
-            }
+        }
 
-        var title = statement.column_text(1);
-        var video = new VideoItem(this.build_child_id (id), this, title);
-        video.creator = statement.column_text(2);
-        video.duration = statement.column_int(3);
-        TimeVal tv = { (long) statement.column_int(5), (long) 0 };
+        var title = statement.column_text (1);
+        var video = new VideoItem (this.build_child_id (id), this, title);
+        video.creator = statement.column_text (2);
+        video.duration = statement.column_int (3);
+        TimeVal tv = { (long) statement.column_int (5), (long) 0 };
         video.date = tv.to_iso8601 ();
-        video.size = statement.column_int(6);
-        video.dlna_profile = statement.column_text(7);
+        video.size = statement.column_int (6);
+        video.dlna_profile = statement.column_text (7);
         video.mime_type = mime_type;
         video.add_uri (file.get_uri ());
 
@@ -94,13 +95,13 @@ public class Rygel.LMS.AllVideos : Rygel.LMS.CategoryContainer {
             "from videos, videos_audios, videos_videos where videos.id = ? " +
             "and videos.id = videos_audios.video_id and videos.id = videos_videos.video_id;";
         try {
-            var stmt = this.lms_db.prepare(video_data);
-            Rygel.LMS.Database.find_object("%d".printf(id), stmt);
-            video.bitrate = stmt.column_int(0) / 8; //convert bits per second into bytes per second
-            video.width = stmt.column_int(1);
-            video.height = stmt.column_int(2);
-            video.channels = stmt.column_int(3);
-            video.sample_freq = stmt.column_int(4);
+            var stmt = this.lms_db.prepare (video_data);
+            Rygel.LMS.Database.find_object ("%d".printf (id), stmt);
+            video.bitrate = stmt.column_int (0) / 8; //convert bits per second into bytes per second
+            video.width = stmt.column_int (1);
+            video.height = stmt.column_int (2);
+            video.channels = stmt.column_int (3);
+            video.sample_freq = stmt.column_int (4);
         } catch (DatabaseError e) {
             warning ("Query failed: %s", e.message);
         }
@@ -108,7 +109,10 @@ public class Rygel.LMS.AllVideos : Rygel.LMS.CategoryContainer {
         return video;
     }
 
-    public AllVideos (string id, MediaContainer parent, string title, LMS.Database lms_db){
+    public AllVideos (string         id,
+                      MediaContainer parent,
+                      string         title,
+                      LMS.Database   lms_db){
         base (id,
               parent,
               title,
diff --git a/src/plugins/lms/rygel-lms-artist.vala b/src/plugins/lms/rygel-lms-artist.vala
index 31e9070..3a5ebc0 100644
--- a/src/plugins/lms/rygel-lms-artist.vala
+++ b/src/plugins/lms/rygel-lms-artist.vala
@@ -50,9 +50,11 @@ public class Rygel.LMS.Artist : Rygel.LMS.CategoryContainer {
         return (SQL_COUNT_TEMPLATE.printf (id));
     }
 
-    protected override MediaObject? object_from_statement (Statement statement) {
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
         var db_id = "%d".printf (statement.column_int (0));
         var title = statement.column_text (1);
+
         return new LMS.Album (db_id, this, title, this.lms_db);
     }
 
diff --git a/src/plugins/lms/rygel-lms-artists.vala b/src/plugins/lms/rygel-lms-artists.vala
index a00b2ce..7201099 100644
--- a/src/plugins/lms/rygel-lms-artists.vala
+++ b/src/plugins/lms/rygel-lms-artists.vala
@@ -38,16 +38,17 @@ public class Rygel.LMS.Artists : Rygel.LMS.CategoryContainer {
         "FROM audio_artists " +
         "WHERE audio_artists.id = ?;";
 
-    protected override MediaObject? object_from_statement (Statement statement) {
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
         var db_id = "%d".printf (statement.column_int (0));
         var title = statement.column_text (1);
 
         return new LMS.Artist (db_id, this, title, this.lms_db);
     }
 
-    public Artists (string id,
+    public Artists (string         id,
                     MediaContainer parent,
-                    string title,
+                    string         title,
                     LMS.Database   lms_db) {
         base (id,
               parent,
@@ -56,7 +57,7 @@ public class Rygel.LMS.Artists : Rygel.LMS.CategoryContainer {
               Artists.SQL_ALL,
               Artists.SQL_FIND_OBJECT,
               Artists.SQL_COUNT,
-              null, null
-             );
+              null,
+              null);
     }
 }
diff --git a/src/plugins/lms/rygel-lms-category-container.vala 
b/src/plugins/lms/rygel-lms-category-container.vala
index fed3183..8a07f48 100644
--- a/src/plugins/lms/rygel-lms-category-container.vala
+++ b/src/plugins/lms/rygel-lms-category-container.vala
@@ -205,18 +205,21 @@ public abstract class Rygel.LMS.CategoryContainer : Rygel.MediaContainer,
             if (stmt.step () != Sqlite.ROW) {
                 return 0;
             }
+
             return stmt.column_int (0);
         } catch (DatabaseError e) {
             warning ("Query failed: %s", e.message);
+
             return 0;
         }
     }
 
-    protected virtual MediaObjects? get_children_with_filter (string     where_filter,
-                                                              ValueArray args,
-                                                              string     sort_criteria,
-                                                              uint       offset,
-                                                              uint       max_count) {
+    protected virtual MediaObjects? get_children_with_filter
+                                        (string     where_filter,
+                                         ValueArray args,
+                                         string     sort_criteria,
+                                         uint       offset,
+                                         uint       max_count) {
         var children = new MediaObjects ();
         GLib.Value v = max_count;
         args.append (v);
@@ -259,6 +262,7 @@ public abstract class Rygel.LMS.CategoryContainer : Rygel.MediaContainer,
             if (max_count == 0) {
                 max_count = uint.MAX;
             }
+
             return this.get_children_with_filter (filter,
                                                   args,
                                                   sort_criteria,
@@ -266,6 +270,7 @@ public abstract class Rygel.LMS.CategoryContainer : Rygel.MediaContainer,
                                                   max_count);
         } catch (Error e) {
             debug ("  Falling back to simple_search(): %s", e.message);
+
             return yield this.simple_search (expression,
                                              offset,
                                              max_count,
@@ -295,7 +300,7 @@ public abstract class Rygel.LMS.CategoryContainer : Rygel.MediaContainer,
 
     public async override MediaObject? find_object (string id,
                                                     Cancellable? cancellable)
-                                        throws Error {
+                                                    throws Error {
         if (!id.has_prefix (this.child_prefix)) {
             /* can't match anything in this container */
             return null;
@@ -359,14 +364,16 @@ public abstract class Rygel.LMS.CategoryContainer : Rygel.MediaContainer,
                                                        old_id,
                                                        new_id);
             while (Database.get_children_step (this.stmt_added)) {
-                this.add_child_tracked.begin(this.object_from_statement (this.stmt_added));
+                var object = this.object_from_statement (this.stmt_added);
+                this.add_child_tracked.begin (object);
             }
 
             Database.get_children_with_update_id_init (this.stmt_removed,
                                                        old_id,
                                                        new_id);
             while (Database.get_children_step (this.stmt_removed)) {
-                this.remove_child_tracked.begin(this.object_from_statement (this.stmt_removed));
+                var object = this.object_from_statement (this.stmt_removed);
+                this.remove_child_tracked.begin (object);
             }
 
         } catch (DatabaseError e) {
@@ -419,7 +426,7 @@ public abstract class Rygel.LMS.CategoryContainer : Rygel.MediaContainer,
             if (this.sql_added != null && this.sql_removed != null) {
                 this.stmt_added = this.lms_db.prepare (this.sql_added);
                 this.stmt_removed = this.lms_db.prepare (this.sql_removed);
-                lms_db.db_updated.connect(this.on_db_updated);
+                lms_db.db_updated.connect (this.on_db_updated);
             }
         } catch (DatabaseError e) {
             warning ("Container %s: %s", this.title, e.message);
diff --git a/src/plugins/lms/rygel-lms-database.vala b/src/plugins/lms/rygel-lms-database.vala
index f7d6ca6..8749006 100644
--- a/src/plugins/lms/rygel-lms-database.vala
+++ b/src/plugins/lms/rygel-lms-database.vala
@@ -51,11 +51,11 @@ public class Rygel.LMS.Database {
             debug ("Got db path %s from LMS over dbus", db_path);
             update_id = lms_proxy.update_id;
             debug ("Got updated id %lld from LMS over dbus", update_id);
-            lms_proxy.g_properties_changed.connect (this.on_lms_properties_changed);
-
+            lms_proxy.g_properties_changed.connect
+                                        (this.on_lms_properties_changed);
         } catch (IOError e) {
-            warning("Couldn't get LMS Dbus proxy: %s", e.message);
-            db_path = Environment.get_user_config_dir() +
+            warning ("Couldn't get LMS Dbus proxy: %s", e.message);
+            db_path = Environment.get_user_config_dir () +
                       "/lightmediascannerd/db.sqlite3";
             debug  ("Using default sqlite database location %s", db_path);
         }
diff --git a/src/plugins/lms/rygel-lms-dbus-interfaces.vala b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
index 13f00cb..1b08d7b 100644
--- a/src/plugins/lms/rygel-lms-dbus-interfaces.vala
+++ b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
@@ -23,8 +23,9 @@
 [DBus (name = "org.lightmediascanner.Scanner1")]
 interface Rygel.LMS.DBus : DBusProxy {
     public abstract string data_base_path { owned get; }
+
     [DBus (name = "UpdateID")]
     public abstract uint64 update_id { get; }
 
     //TODO: add all the other API items which are currently unused
-}
\ No newline at end of file
+}
diff --git a/src/plugins/lms/rygel-lms-image-year.vala b/src/plugins/lms/rygel-lms-image-year.vala
index a7768f0..9ea5c71 100644
--- a/src/plugins/lms/rygel-lms-image-year.vala
+++ b/src/plugins/lms/rygel-lms-image-year.vala
@@ -25,7 +25,8 @@ using Sqlite;
 
 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 " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+        "dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
         "FROM images, files " +
         "WHERE dtime = 0 AND images.id = files.id AND year = '%s' " +
         "LIMIT ? OFFSET ?;";
@@ -36,46 +37,48 @@ public class Rygel.LMS.ImageYear : Rygel.LMS.CategoryContainer {
         "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 " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+        "dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
         "FROM images, files " +
         "WHERE dtime = 0 AND files.id = ? AND images.id = files.id AND year = '%s';";
 
     private static const string SQL_ADDED_TEMPLATE =
-        "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, 
strftime('%Y', date, 'unixepoch') as year " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+        "dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
         "FROM images, files " +
         "WHERE dtime = 0 AND images.id = files.id AND year = '%s' " +
         "AND update_id > ? AND update_id <= ?;";
 
     private static const string SQL_REMOVED_TEMPLATE =
-        "SELECT images.id, title, artist, date, width, height, path, size, dlna_profile, dlna_mime, 
strftime('%Y', date, 'unixepoch') as year " +
+        "SELECT images.id, title, artist, date, width, height, path, size, " +
+        "dlna_profile, dlna_mime, strftime('%Y', date, 'unixepoch') as year " +
         "FROM images, files " +
         "WHERE dtime <> 0 AND images.id = files.id AND year = '%s' " +
         "AND update_id > ? AND update_id <= ?;";
 
-    protected override MediaObject? object_from_statement (Statement statement) {
-        var id = statement.column_int(0);
-        var path = statement.column_text(6);
-        var mime_type = statement.column_text(9);
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
+        var id = statement.column_int (0);
+        var path = statement.column_text (6);
+        var mime_type = statement.column_text (9);
 
         if (mime_type == null || mime_type.length == 0){
             /* TODO is this correct? */
-            debug ("Image item %d (%s) has no MIME type",
-                   id,
-                   path);
+            debug ("Image item %d (%s) has no MIME type", id, path);
         }
 
-        var title = statement.column_text(1);
-        var image = new ImageItem(this.build_child_id (id), this, title);
+        var title = statement.column_text (1);
+        var image = new ImageItem (this.build_child_id (id), this, title);
         image.ref_id = this.build_reference_id (id);
-        image.creator = statement.column_text(2);
-        TimeVal tv = { (long) statement.column_int(3), (long) 0 };
+        image.creator = statement.column_text (2);
+        TimeVal tv = { (long) statement.column_int (3), (long) 0 };
         image.date = tv.to_iso8601 ();
-        image.width = statement.column_int(4);
-        image.height = statement.column_int(5);
-        image.size = statement.column_int(7);
+        image.width = statement.column_int (4);
+        image.height = statement.column_int (5);
+        image.size = statement.column_int (7);
         image.mime_type = mime_type;
-        image.dlna_profile = statement.column_text(8);
-        File file = File.new_for_path(path);
+        image.dlna_profile = statement.column_text (8);
+        var file = File.new_for_path (path);
         image.add_uri (file.get_uri ());
 
         return image;
@@ -108,7 +111,6 @@ public class Rygel.LMS.ImageYear : Rygel.LMS.CategoryContainer {
               get_sql_find_object (year),
               get_sql_count (year),
               get_sql_added (year),
-              get_sql_removed (year)
-             );
+              get_sql_removed (year));
     }
 }
diff --git a/src/plugins/lms/rygel-lms-image-years.vala b/src/plugins/lms/rygel-lms-image-years.vala
index 665b431..efac0e9 100644
--- a/src/plugins/lms/rygel-lms-image-years.vala
+++ b/src/plugins/lms/rygel-lms-image-years.vala
@@ -35,13 +35,15 @@ public class Rygel.LMS.ImageYears : Rygel.LMS.CategoryContainer {
 
     /* actually returns multiple times the same result (because no DISTINCT) */
     /* Casting the year is a workaround so we can keep using
-     * Database.find_object() without making the argument a variant or something like it*/
+     * Database.find_object() without making the argument a variant or
+     * something like it */
     private static const string SQL_FIND_OBJECT =
         "SELECT strftime('%Y', images.date, 'unixepoch') as year " +
         "FROM images " +
         "WHERE year = CAST(? AS TEXT)";
 
-    protected override MediaObject? object_from_statement (Statement statement) {
+    protected override MediaObject? object_from_statement
+                                        (Statement statement) {
         return new LMS.ImageYear (this, statement.column_text (0), this.lms_db);
     }
 
@@ -53,7 +55,7 @@ public class Rygel.LMS.ImageYears : Rygel.LMS.CategoryContainer {
               ImageYears.SQL_ALL,
               ImageYears.SQL_FIND_OBJECT,
               ImageYears.SQL_COUNT,
-              null, null
-             );
+              null,
+              null);
     }
 }
diff --git a/src/plugins/lms/rygel-lms-music-root.vala b/src/plugins/lms/rygel-lms-music-root.vala
index 7b1eb0f..51ff326 100644
--- a/src/plugins/lms/rygel-lms-music-root.vala
+++ b/src/plugins/lms/rygel-lms-music-root.vala
@@ -30,7 +30,10 @@ public class Rygel.LMS.MusicRoot : Rygel.SimpleContainer {
         base (id, parent, title);
 
         this.add_child_container (new AllMusic (this, lms_db));
-        this.add_child_container (new Artists ("artists", this, _("Artists"), lms_db));
+        this.add_child_container (new Artists ("artists",
+                                               this,
+                                               _("Artists"),
+                                               lms_db));
         this.add_child_container (new Albums (this, lms_db));
     }
 }
diff --git a/src/plugins/lms/rygel-lms-plugin-factory.vala b/src/plugins/lms/rygel-lms-plugin-factory.vala
index 9fa8ccd..39fbc0c 100644
--- a/src/plugins/lms/rygel-lms-plugin-factory.vala
+++ b/src/plugins/lms/rygel-lms-plugin-factory.vala
@@ -24,17 +24,17 @@ using Rygel;
 
 private Rygel.LMS.PluginFactory plugin_factory;
 
-public void module_init(PluginLoader loader) {
-        plugin_factory = new Rygel.LMS.PluginFactory(loader);
+public void module_init (PluginLoader loader) {
+    plugin_factory = new Rygel.LMS.PluginFactory (loader);
 }
 
 public class Rygel.LMS.PluginFactory {
 
     PluginLoader loader;
 
-    public PluginFactory(PluginLoader loader) {
+    public PluginFactory (PluginLoader loader) {
         this.loader = loader;
-        this.loader.add_plugin(new LMS.Plugin());
+        this.loader.add_plugin (new LMS.Plugin ());
     }
 
 }
diff --git a/src/plugins/lms/rygel-lms-plugin.vala b/src/plugins/lms/rygel-lms-plugin.vala
index 8bf1284..1c3b613 100644
--- a/src/plugins/lms/rygel-lms-plugin.vala
+++ b/src/plugins/lms/rygel-lms-plugin.vala
@@ -27,9 +27,11 @@ public class Rygel.LMS.Plugin : Rygel.MediaServerPlugin {
 
     private static RootContainer root;
 
-    public Plugin() {
-        if (root == null)
+    public Plugin () {
+        if (root == null) {
             root = new RootContainer();
-        base(root, Plugin.NAME, null, PluginCapabilities.TRACK_CHANGES);
+        }
+
+        base (root, Plugin.NAME, null, PluginCapabilities.TRACK_CHANGES);
     }
 }
diff --git a/src/plugins/lms/rygel-lms-root-container.vala b/src/plugins/lms/rygel-lms-root-container.vala
index 1623fa3..de832a2 100644
--- a/src/plugins/lms/rygel-lms-root-container.vala
+++ b/src/plugins/lms/rygel-lms-root-container.vala
@@ -28,7 +28,7 @@ public class Rygel.LMS.RootContainer : Rygel.SimpleContainer {
 
     private LMS.Database lms_db = null;
 
-    public RootContainer() {
+    public RootContainer () {
         var config = MetaConfig.get_default ();
 
         var title = _("Shared media");
@@ -36,14 +36,23 @@ public class Rygel.LMS.RootContainer : Rygel.SimpleContainer {
             title = config.get_string ("LightMediaScanner", "title");
         } catch (GLib.Error error) {}
 
-        base.root(title);
+        base.root (title);
 
         try {
             this.lms_db = new LMS.Database ();
 
-            this.add_child_container (new MusicRoot ("music", this, _("Music"), this.lms_db));
-            this.add_child_container (new AllVideos ("all-videos", this, _("Videos"), this.lms_db));
-            this.add_child_container (new ImageRoot ("images", this, _("Pictures"), this.lms_db));
+            this.add_child_container (new MusicRoot ("music",
+                                                     this,
+                                                     _("Music"),
+                                                     this.lms_db));
+            this.add_child_container (new AllVideos ("all-videos",
+                                                     this,
+                                                     _("Videos"),
+                                                     this.lms_db));
+            this.add_child_container (new ImageRoot ("images",
+                                                     this,
+                                                     _("Pictures"),
+                                                     this.lms_db));
 
         } catch (DatabaseError e) {
             warning ("%s\n", e.message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]