# Set it to 'false' if you want to disable WMV transcoding support.
enable-wmv-transcoder=true
+# Where video files should be saved if allow-upload is true.
+# Defaults to @VIDEOS@, the standard videos folder (typically ${HOME}/Videos).
+video-upload-folder=@VIDEOS@
+
+# Where music files should be saved if allow-upload is true
+# Defaults to @MUSIC@, the standard music folder (typically ${HOME}/Music).
+music-upload-folder=@MUSIC@
+
+# Where picture files should be saved if allow-upload is true
+# Defaults to @PICTURES@, the standard picture folder (typically ${HOME}/Pictures).
+picture-upload-folder=@PICTURES@
+
# The network interface to attach rygel to. You can also use network IP or even
# ESSID for wireless networks if you are using NetworkManager. Leave it blank
# for dynamic configuration.
<para>Allow remote media file deletion via UPnP.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>video-upload-folder</option>
+ </term>
+ <listitem>
+ <para>If <option>allow-upload</option> is <userinput>true</userinput>, use this folder to store uploaded videos. It defaults to <userinput>@VIDEOS@</userinput> which expands to the default directory for video files (usually <filename><envar>$HOME</envar>/Videos</filename>).</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>music-upload-folder</option>
+ </term>
+ <listitem>
+ <para>If <option>allow-upload</option> is <userinput>true</userinput>, use this folder to store uploaded music files. It defaults to <userinput>@MUSIC@</userinput> which expands to the default directory for music files (usually <filename><envar>$HOME</envar>/Music</filename>).</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>picture-upload-folder</option>
+ </term>
+ <listitem>
+ <para>If <option>allow-upload</option> is <userinput>true</userinput>, use this folder to store uploaded pictures. It defaults to <userinput>@PICTURES@</userinput> which expands to the default directory for picture files (usually <filename><envar>$HOME</envar>/Pictures</filename>).</para>
+ </listitem>
+ </varlistentry>
</variablelist>
<para>Sections for plugins are denoted with <option>[PluginName]</option>
and can contain options specific to a plugin (see below) as well these common options:
"temp/nmm#MusicPiece";
public MusicItemFactory () {
- base (CATEGORY,
- CATEGORY_IRI,
- MusicItem.UPNP_CLASS,
- Environment.get_user_special_dir (UserDirectory.MUSIC));
+ var upload_folder = Environment.get_user_special_dir
+ (UserDirectory.MUSIC);
+ try {
+ var config = MetaConfig.get_default ();
+ upload_folder = config.get_music_upload_folder ();
+ } catch (Error error) {};
+
+ base (CATEGORY, CATEGORY_IRI, MusicItem.UPNP_CLASS, upload_folder);
// These must be the same order as enum MusicMetadata
this.properties.add ("res@duration");
"temp/nmm#Photo";
public PictureItemFactory () {
- base (CATEGORY,
- CATEGORY_IRI,
- PhotoItem.UPNP_CLASS,
- Environment.get_user_special_dir (UserDirectory.PICTURES));
+ var upload_folder = Environment.get_user_special_dir
+ (UserDirectory.PICTURES);
+ try {
+ var config = MetaConfig.get_default ();
+ upload_folder = config.get_picture_upload_folder ();
+ } catch (Error error) {};
+
+ base (CATEGORY, CATEGORY_IRI, PhotoItem.UPNP_CLASS, upload_folder);
// These must be in the same order as enum PictureMetadata
this.properties.add ("height");
"temp/nmm#Video";
public VideoItemFactory () {
- base (CATEGORY,
- CATEGORY_IRI,
- VideoItem.UPNP_CLASS,
- Environment.get_user_special_dir (UserDirectory.VIDEOS));
+ var upload_folder = Environment.get_user_special_dir
+ (UserDirectory.VIDEOS);
+ try {
+ var config = MetaConfig.get_default ();
+ upload_folder = config.get_video_upload_folder ();
+ } catch (Error error) {};
+
+ base (CATEGORY, CATEGORY_IRI, VideoItem.UPNP_CLASS, upload_folder);
// These must be in the same order as enum VideoMetadata
this.properties.add ("height");
return config_file;
}
+ public string get_video_upload_folder () throws GLib.Error {
+ throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
+ }
+
+ public string get_music_upload_folder () throws GLib.Error {
+ throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
+ }
+
+ public string get_picture_upload_folder () throws GLib.Error {
+ throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
+ }
+
// Dynamic options
// FIXME: How to handle them?
public string get_string (string section,
public abstract string get_plugin_path () throws GLib.Error;
+ public abstract string get_video_upload_folder () throws GLib.Error;
+
+ public abstract string get_music_upload_folder () throws GLib.Error;
+
+ public abstract string get_picture_upload_folder () throws GLib.Error;
+
public abstract bool get_enabled (string section) throws GLib.Error;
public abstract string get_title (string section) throws GLib.Error;
return this.get_string_variable (PLUGIN_PATH_ENV);
}
+ public string get_video_upload_folder () throws GLib.Error {
+ throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
+ }
+
+ public string get_music_upload_folder () throws GLib.Error {
+ throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
+ }
+
+ public string get_picture_upload_folder () throws GLib.Error {
+ throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
+ }
+
public bool get_enabled (string section) throws GLib.Error {
return get_bool (section, ENABLED_KEY);
}
return val;
}
+ public string get_video_upload_folder () throws GLib.Error {
+ unowned string default = Environment.get_user_special_dir
+ (UserDirectory.VIDEOS);
+ var value = default;
+
+ foreach (var config in this.configs) {
+ try {
+ value = config.get_video_upload_folder ();
+ } catch (GLib.Error err) { }
+ }
+
+ return value.replace ("@VIDEOS@", default);
+ }
+
+ public string get_music_upload_folder () throws GLib.Error {
+ unowned string default = Environment.get_user_special_dir
+ (UserDirectory.MUSIC);
+
+ var value = default;
+
+ foreach (var config in this.configs) {
+ try {
+ value = config.get_music_upload_folder ();
+ } catch (GLib.Error err) {};
+ }
+
+ return value.replace ("@MUSIC@", default);
+ }
+
+ public string get_picture_upload_folder () throws GLib.Error {
+ unowned string default = Environment.get_user_special_dir
+ (UserDirectory.PICTURES);
+ var value = default;
+
+ foreach (var config in this.configs) {
+ try {
+ value = config.get_picture_upload_folder ();
+ } catch (GLib.Error err) {};
+ }
+
+ return value.replace ("@PICTURES@", default);
+ }
+
+
public bool get_enabled (string section) throws GLib.Error {
bool val = true;
bool unavailable = true;
public static const string ALLOW_DELETION_KEY = "allow-deletion";
public static const string LOG_LEVELS_KEY = "log-level";
public static const string PLUGIN_PATH_KEY = "plugin-path";
+ public static const string UPLOAD_FOLDER_KEY = "upload-folder";
+ public static const string VIDEO_UPLOAD_DIR_PATH_KEY =
+ "video-" + UPLOAD_FOLDER_KEY;
+ public static const string MUSIC_UPLOAD_DIR_PATH_KEY =
+ "music-" + UPLOAD_FOLDER_KEY;
+ public static const string PICTURE_UPLOAD_DIR_PATH_KEY =
+ "picture-" + UPLOAD_FOLDER_KEY;
// Our singleton
private static UserConfig config;
return this.get_string ("general", PLUGIN_PATH_KEY);
}
+ public string get_video_upload_folder () throws GLib.Error {
+ return this.get_string ("general", VIDEO_UPLOAD_DIR_PATH_KEY);
+ }
+
+ public string get_music_upload_folder () throws GLib.Error {
+ return this.get_string ("general", MUSIC_UPLOAD_DIR_PATH_KEY);
+ }
+
+ public string get_picture_upload_folder () throws GLib.Error {
+ return this.get_string ("general", PICTURE_UPLOAD_DIR_PATH_KEY);
+ }
+
public static UserConfig get_default () throws Error {
if (config == null) {
var path = Path.build_filename