[rygel] data,media-export: Special variables for XDG dirs
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] data,media-export: Special variables for XDG dirs
- Date: Mon, 30 Aug 2010 13:47:11 +0000 (UTC)
commit c7359bd209eb6565867c9114b3264d6a572f0c2d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Aug 30 16:43:59 2010 +0300
data,media-export: Special variables for XDG dirs
Allow user to specify standard XDG media directories using variables.
data/rygel-default.conf | 9 ++++++-
data/rygel-maemo.conf | 9 ++++++-
.../rygel-media-export-root-container.vala | 21 +++++++++++++++++++-
3 files changed, 34 insertions(+), 5 deletions(-)
---
diff --git a/data/rygel-default.conf b/data/rygel-default.conf
index 1e5d973..31feb93 100644
--- a/data/rygel-default.conf
+++ b/data/rygel-default.conf
@@ -66,8 +66,13 @@ title= REALNAME@'s media
[MediaExport]
enabled=true
title= REALNAME@'s media
-# List of URIs to export; if list is empty, the XDG media directries are
-# exported.
+# List of URIs to export. Following variables are automatically substituted by
+# the appropriate XDG standar media folders by Rygel for you.
+#
+# * @MUSIC@: The standard music folder (typically ${HOME}/Music).
+# * @VIDEOS@: The standard videos folder (typically ${HOME}/Videos).
+# * @PICTURES@: The standard pictures folder (typically ${HOME}/Pictures).
+#
uris=
include-filter=.mp3;.oga;.ogv;.ogg;.mkv;.avi;.mp4;.m4v;m4a;.mpeg;.mpg;.ts;.flac;.jpeg;.jpg;.png;.wav;.wma;.wmv;.asf
extract-metadata=true
diff --git a/data/rygel-maemo.conf b/data/rygel-maemo.conf
index 85a4049..5707a4c 100644
--- a/data/rygel-maemo.conf
+++ b/data/rygel-maemo.conf
@@ -66,8 +66,13 @@ title= HOSTNAME@
[MediaExport]
enabled=false
title= HOSTNAME@
-# List of URIs to export; if list is empty, the XDG media directries are
-# exported.
+# List of URIs to export. Following variables are automatically substituted by
+# the appropriate XDG standar media folders by Rygel for you.
+#
+# * @MUSIC@: The standard music folder (typically ${HOME}/Music).
+# * @VIDEOS@: The standard videos folder (typically ${HOME}/Videos).
+# * @PICTURES@: The standard pictures folder (typically ${HOME}/Pictures).
+#
uris=
include-filter=.mp3;.oga;.ogv;.ogg;.mkv;.avi;.mp4;.m4v;m4a;.mpeg;.mpg;.ts;.flac;.jpeg;.jpg;.png;.wav;.wma;.wmv;.asf
extract-metadata=true
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index ffe1f92..9ef0520 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -171,6 +171,7 @@ public class Rygel.MediaExport.RootContainer : Rygel.MediaExport.DBContainer {
private ArrayList<string> get_uris () {
ArrayList<string> uris;
+ ArrayList<string> actual_uris;
var config = MetaConfig.get_default ();
@@ -184,7 +185,25 @@ public class Rygel.MediaExport.RootContainer : Rygel.MediaExport.DBContainer {
uris.add_all (this.media_db.get_flagged_uris ("DBUS"));
} catch (Error error) {}
- return uris;
+ actual_uris = new ArrayList<string> ();
+ foreach (var uri in uris) {
+ var actual_uri = uri;
+
+ var pictures_dir = Environment.get_user_special_dir
+ (UserDirectory.PICTURES);
+ var videos_dir = Environment.get_user_special_dir
+ (UserDirectory.VIDEOS);
+ var music_dir = Environment.get_user_special_dir
+ (UserDirectory.MUSIC);
+
+ actual_uri = actual_uri.replace ("@PICTURES@", pictures_dir);
+ actual_uri = actual_uri.replace ("@VIDEOS@", videos_dir);
+ actual_uri = actual_uri.replace ("@MUSIC@", music_dir);
+
+ actual_uris.add (actual_uri);
+ }
+
+ return actual_uris;
}
private QueryContainer? search_to_virtual_container (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]