[rygel] mediathek: Change default sort order
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] mediathek: Change default sort order
- Date: Fri, 17 Aug 2012 22:12:42 +0000 (UTC)
commit ee6cfa50bc7a38c73c4888217b2f1b694e784e22
Author: Jens Georg <mail jensge org>
Date: Fri Aug 17 23:39:37 2012 +0200
mediathek: Change default sort order
Sort by date, newest first
.../mediathek/rygel-mediathek-rss-container.vala | 1 +
.../rygel-mediathek-video-item-factory.vala | 20 ++++++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/mediathek/rygel-mediathek-rss-container.vala b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
index e60bd0b..ff9905a 100644
--- a/src/plugins/mediathek/rygel-mediathek-rss-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
@@ -38,6 +38,7 @@ public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
this.content_id = id;
this.feed_uri = uri_template.printf (id);
+ this.sort_criteria = "-dc:date,+dc:title";
this.update.begin ();
}
diff --git a/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala b/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala
index 2a4c51a..bae9432 100644
--- a/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala
+++ b/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala
@@ -45,9 +45,12 @@ internal class Rygel.Mediathek.VideoItemFactory : Object {
throws VideoItemError {
string title;
string playlist_url;
+ string date;
+
this.extract_data_from_xml (xml_item,
out title,
- out playlist_url);
+ out playlist_url,
+ out date);
var resolved_uris = yield playlist_parser.parse (playlist_url);
@@ -60,6 +63,7 @@ internal class Rygel.Mediathek.VideoItemFactory : Object {
item.mime_type = this.playlist_parser.mime_type;
item.author = "ZDF - Second German TV Channel Streams";
+ item.date = date;
if (this.video_format == VIDEO_FORMAT_WMV) {
item.dlna_profile = "WMVMED_FULL";
@@ -101,13 +105,14 @@ internal class Rygel.Mediathek.VideoItemFactory : Object {
}
}
- private bool namespace_ok (Xml.Node* node) {
- return node->ns != null && node->ns->prefix == "media";
+ private bool namespace_ok (Xml.Node* node, string prefix = "media") {
+ return node->ns != null && node->ns->prefix == prefix;
}
private void extract_data_from_xml (Xml.Node *item,
out string title,
- out string playlist_url)
+ out string playlist_url,
+ out string? date)
throws VideoItemError {
var title_node = XMLUtils.get_element (item, "title");
var group = XMLUtils.get_element (item, "group");
@@ -152,5 +157,12 @@ internal class Rygel.Mediathek.VideoItemFactory : Object {
}
title = title_node->get_content ();
+
+ var date_node = XMLUtils.get_element (item, "date");
+ if (date_node != null && this.namespace_ok (date_node, "dc")) {
+ date = date_node->get_content ();
+ } else {
+ date = null;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]