diff options
Diffstat (limited to 'src')
3 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala b/src/plugins/media-export/rygel-media-export-media-cache.vala index b8912c08..603a5565 100644 --- a/src/plugins/media-export/rygel-media-export-media-cache.vala +++ b/src/plugins/media-export/rygel-media-export-media-cache.vala @@ -431,6 +431,7 @@ public class Rygel.MediaExport.MediaCache : Object { string filter, GLib.ValueArray args, long offset, + string sort_criteria, long max_count, bool add_all_container) throws Error { @@ -441,12 +442,20 @@ public class Rygel.MediaExport.MediaCache : Object { var data = new ArrayList<string> (); + var sql_sort_order = MediaCache.translate_sort_criteria (sort_criteria); + + // title here is actually the meta-data column, so if we had + // dc:title in the sort criteria, we need to change this + sql_sort_order = sql_sort_order.replace ("o.title", "_column"); + var sql = this.sql.make (SQLString.GET_META_DATA_COLUMN); if (add_all_container) { sql = "SELECT 'all_place_holder' AS _column UNION " + sql; } - var cursor = this.db.exec_cursor (sql.printf (column, filter), + var cursor = this.db.exec_cursor (sql.printf (column, + filter, + sql_sort_order), args.values); foreach (var statement in cursor) { data.add (statement.column_text (0)); @@ -461,6 +470,7 @@ public class Rygel.MediaExport.MediaCache : Object { public Gee.List<string> get_object_attribute_by_search_expression (string attribute, SearchExpression? expression, + string sort_criteria, long offset, uint max_count, bool add_all_container) @@ -479,6 +489,7 @@ public class Rygel.MediaExport.MediaCache : Object { filter, args, offset, + sort_criteria, max_objects, add_all_container); } diff --git a/src/plugins/media-export/rygel-media-export-node-query-container.vala b/src/plugins/media-export/rygel-media-export-node-query-container.vala index f5349101..9259b3e1 100644 --- a/src/plugins/media-export/rygel-media-export-node-query-container.vala +++ b/src/plugins/media-export/rygel-media-export-node-query-container.vala @@ -50,7 +50,7 @@ internal class Rygel.MediaExport.NodeQueryContainer : QueryContainer { var data = this.media_db.get_object_attribute_by_search_expression (this.attribute, this.expression, - // sort criteria + sort_criteria, offset, max_count, this.add_all_container ()); @@ -83,6 +83,7 @@ internal class Rygel.MediaExport.NodeQueryContainer : QueryContainer { var data = this.media_db.get_object_attribute_by_search_expression (this.attribute, this.expression, + "+dc:title", 0, -1, this.add_all_container ()); diff --git a/src/plugins/media-export/rygel-media-export-sql-factory.vala b/src/plugins/media-export/rygel-media-export-sql-factory.vala index ffd0064f..09b6cd41 100644 --- a/src/plugins/media-export/rygel-media-export-sql-factory.vala +++ b/src/plugins/media-export/rygel-media-export-sql-factory.vala @@ -185,7 +185,7 @@ internal class Rygel.MediaExport.SQLFactory : Object { private const string GET_META_DATA_COLUMN_STRING = "SELECT DISTINCT %s AS _column FROM meta_data AS m " + - "WHERE _column IS NOT NULL %s ORDER BY _column COLLATE CASEFOLD " + + "WHERE _column IS NOT NULL %s %s" + "LIMIT ?,?"; internal const string SCHEMA_VERSION = "15"; |