mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
Quietly handle ranking gsetting change after app update
Do not print errors for everyone who updates Clapper from 0.3.0 version. How plugin ranking is stored in gsettings changed. Instead reset it quietly into new defaults to avoid problems. Also since now GstClapper API sets some default ranks based on installed GStreamer version, hopefully this ranking will be only an edge case for people who want to experiment or need to test/debug some GStreamer plugin.
This commit is contained in:
@@ -97,18 +97,24 @@ class ClapperPlayer extends GstClapper.Clapper
|
||||
set_all_plugins_ranks()
|
||||
{
|
||||
let data = {};
|
||||
let hadErr = false;
|
||||
|
||||
/* Set empty plugin list if someone messed it externally */
|
||||
try {
|
||||
data = JSON.parse(settings.get_string('plugin-ranking'));
|
||||
if(Array.isArray(data)) {
|
||||
data = {};
|
||||
throw new Error('plugin ranking data is not an object');
|
||||
hadErr = true;
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
debug(err);
|
||||
hadErr = true;
|
||||
}
|
||||
|
||||
if(hadErr) {
|
||||
settings.set_string('plugin-ranking', "{}");
|
||||
debug('restored plugin ranking to defaults');
|
||||
}
|
||||
|
||||
for(let plugin of Object.keys(data))
|
||||
|
Reference in New Issue
Block a user