private static LogLevel log_level = LogLevel.INVALID;
+ private static string plugin_path;
+
private static bool version;
[CCode (array_length = false, array_null_terminated = true)]
{ "log-level", 'g', 0, OptionArg.INT, ref log_level,
"Log level. 1=critical,2=error,3=warning,4=message/info,5=debug",
"N" },
+ { "plugin-path", 'u', 0, OptionArg.STRING, ref plugin_path,
+ "Plugin Path", "PLUGIN_PATH" },
{ "disable-plugin", 'd', 0, OptionArg.STRING_ARRAY,
ref disabled_plugins,
"Disable plugin", "PluginName" },
return log_level;
}
+ public string get_plugin_path () throws GLib.Error {
+ if (plugin_path == null) {
+ throw new ConfigurationError.NO_VALUE_SET ("No value available");
+ }
+
+ return plugin_path;
+ }
+
public bool get_enabled (string section) throws GLib.Error {
var disabled = false;
foreach (var plugin in disabled_plugins) {
public abstract LogLevel get_log_level () throws GLib.Error;
+ public abstract string get_plugin_path () throws GLib.Error;
+
public abstract bool get_enabled (string section) throws GLib.Error;
public abstract string get_title (string section) throws GLib.Error;
private static string MP2TS_TRANSCODING_ENV = RYGEL_PREFIX + "_MP2TS_TRANS";
private static string WMV_TRANSCODING_ENV = RYGEL_PREFIX + "_WMV_TRANS";
private static string LOG_LEVEL_ENV = RYGEL_PREFIX + "_LOG";
+ private static string PLUGIN_PATH_ENV = RYGEL_PREFIX + "_PLUGIN_PATH";
// Our singleton
private static EnvironmentConfig config;
LogLevel.DEBUG);
}
+ public string get_plugin_path () throws GLib.Error {
+ return this.get_string_variable (PLUGIN_PATH_ENV);
+ }
+
public bool get_enabled (string section) throws GLib.Error {
return get_bool (section, ENABLED_KEY);
}
return val;
}
+ public string get_plugin_path () throws GLib.Error {
+ string val = null;
+ bool unavailable = true;
+
+ foreach (var config in this.configs) {
+ try {
+ val = config.get_plugin_path ();
+ unavailable = false;
+ break;
+ } catch (GLib.Error err) {}
+ }
+
+ if (unavailable) {
+ throw new ConfigurationError.NO_VALUE_SET ("No value available");
+ }
+
+ return val;
+ }
+
public bool get_enabled (string section) throws GLib.Error {
bool val = true;
bool unavailable = true;
public void load_plugins () {
assert (Module.supported());
- File dir = File.new_for_path (BuildConfig.PLUGIN_DIR);
+ string path;
+ try {
+ var config = MetaConfig.get_default ();
+ path = config.get_plugin_path ();
+ } catch (Error error) {
+ path = BuildConfig.PLUGIN_DIR;
+ }
+
+ File dir = File.new_for_path (path);
assert (dir != null && is_dir (dir));
this.load_modules_from_dir.begin (dir);
"enable-lpcm-transcoder";
protected static const string WMV_TRANSCODER_KEY = "enable-wmv-transcoder";
protected static const string LOG_LEVEL_KEY = "log-level";
+ protected static const string PLUGIN_PATH_KEY = "plugin-path";
private const string DBUS_SERVICE = "org.freedesktop.DBus";
private const string DBUS_PATH = "/org/freedesktop/DBus";
LogLevel.DEBUG);
}
+ public string get_plugin_path () throws GLib.Error {
+ return this.get_string ("general", PLUGIN_PATH_KEY);
+ }
+
public static UserConfig get_default () throws Error {
if (config == null) {
config = new UserConfig ();