GList *features, *tmp;
gint i;
gboolean first = TRUE;
+ GError *err = NULL;
- g_assert (argc >= 2);
+ g_assert (argc >= 3);
setlocale (LC_ALL, "");
setlocale (LC_NUMERIC, "C");
gst_init (NULL, NULL);
json = g_string_new ("{");
- for (i = 1; i < argc; i++) {
+ for (i = 2; i < argc; i++) {
gchar *basename;
libfile = argv[i];
plugin = gst_plugin_load_file (libfile, &error);
}
g_string_append_c (json, '}');
- g_print ("%s", json->str);
+ if (!g_file_set_contents (argv[1], json->str, -1, &err)) {
+ g_printerr ("Could not set json to %s: %s", argv[1], err->message);
+ g_clear_error (&err);
+
+ return -1;
+ }
+ g_string_free (json, TRUE);
return 0;
}
import os
import sys
import subprocess
+import tempfile
from collections import OrderedDict
try:
except FileNotFoundError:
pass
- cmd = [os.path.join(os.path.dirname(os.path.realpath(__file__)), 'gst-hotdoc-plugins-scanner')]
+ out = output_filename + '.tmp'
+ cmd = [os.path.join(os.path.dirname(os.path.realpath(__file__)), 'gst-hotdoc-plugins-scanner'), out]
gst_plugins_paths = []
for plugin_path in sys.argv[3:]:
cmd.append(plugin_path)
with open(stderrlogfile, 'r') as f:
print(f.read(), file=sys.stderr)
raise
- try:
- plugins = json.loads(data.decode(), object_pairs_hook=OrderedDict)
- except json.decoder.JSONDecodeError:
- print("Could not decode:\n%s" % data.decode(), file=sys.stderr)
- raise
+
+ with open(out, 'r') as jfile:
+ try:
+ plugins = json.load(jfile, object_pairs_hook=OrderedDict)
+ except json.decoder.JSONDecodeError:
+ print("Could not decode:\n%s" % jfile.read(), file=sys.stderr)
+ raise
modified = dict_recursive_update(cache, plugins)