[totem-pl-parser] plparse: Enable videosite support even without quvi



commit 94872567cb0467ebc26554c79393d9feb88ff871
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Dec 19 10:48:00 2016 +0000

    plparse: Enable videosite support even without quvi
    
    There are now other helper scripts apart from quvi, so the videosite
    support should not be conditionalised on quvi being available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=776259

 plparse/totem-pl-parser-videosite.c |   29 +++++++++++++++--------------
 plparse/totem-pl-parser.c           |    2 --
 2 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/plparse/totem-pl-parser-videosite.c b/plparse/totem-pl-parser-videosite.c
index f830a54..61d4597 100644
--- a/plparse/totem-pl-parser-videosite.c
+++ b/plparse/totem-pl-parser-videosite.c
@@ -64,14 +64,13 @@ find_helper_script (void)
        }
 
 bail:
-       return g_strdup (LIBEXECDIR "/totem-pl-parser/99-totem-pl-parser-videosite");
+       return NULL;
 #endif
 }
 
 gboolean
 totem_pl_parser_is_videosite (const char *uri, gboolean debug)
 {
-#ifdef HAVE_QUVI
        const char *args[] = {
                NULL,
                "--check",
@@ -83,6 +82,11 @@ totem_pl_parser_is_videosite (const char *uri, gboolean debug)
        char *script;
 
        script = find_helper_script ();
+       if (script == NULL) {
+               if (debug)
+                       g_print ("Did not find a script to check whether '%s' is a videosite\n", uri);
+               return FALSE;
+       }
 
        args[0] = script;
        args[3] = uri;
@@ -103,9 +107,6 @@ totem_pl_parser_is_videosite (const char *uri, gboolean debug)
        g_free (script);
 
        return (g_strcmp0 (out, "TRUE") == 0);
-#else
-       return FALSE;
-#endif /* HAVE_QUVI */
 }
 
 #ifndef TOTEM_PL_PARSER_MINI
@@ -117,14 +118,13 @@ totem_pl_parser_add_videosite (TotemPlParser *parser,
                               TotemPlParseData *parse_data,
                               gpointer data)
 {
-#ifdef HAVE_QUVI
        const char *args[] = {
                NULL,
                "--url",
                NULL,
                NULL
        };
-       char *uri;
+       char *_uri;
        char *out = NULL;
        char **lines;
        guint i;
@@ -133,11 +133,15 @@ totem_pl_parser_add_videosite (TotemPlParser *parser,
        char *script;
        TotemPlParserResult ret;
 
-       uri = g_file_get_uri (file);
        script = find_helper_script ();
+       if (script == NULL) {
+               DEBUG (file, g_print ("Did not find a script to check whether '%s' is a videosite\n", uri));
+               return FALSE;
+       }
 
+       _uri = g_file_get_uri (file);
        args[0] = script;
-       args[2] = uri;
+       args[2] = _uri;
        g_spawn_sync (NULL,
                      (char **) args,
                      NULL,
@@ -149,7 +153,7 @@ totem_pl_parser_add_videosite (TotemPlParser *parser,
                      NULL,
                      NULL);
        if (totem_pl_parser_is_debugging_enabled (parser))
-               g_print ("Parsing videosite for URI '%s' returned '%s'\n", uri, out);
+               g_print ("Parsing videosite for URI '%s' returned '%s'\n", _uri, out);
 
        if (out != NULL) {
                if (g_str_equal (out, "TOTEM_PL_PARSER_RESULT_ERROR")) {
@@ -190,11 +194,8 @@ totem_pl_parser_add_videosite (TotemPlParser *parser,
 
 out:
        g_free (script);
-       g_free (uri);
+       g_free (_uri);
        return ret;
-#else
-       return TOTEM_PL_PARSER_RESULT_UNHANDLED;
-#endif /* !HAVE_QUVI */
 }
 
 #endif /* !TOTEM_PL_PARSER_MINI */
diff --git a/plparse/totem-pl-parser.c b/plparse/totem-pl-parser.c
index 527cfb4..727940d 100644
--- a/plparse/totem-pl-parser.c
+++ b/plparse/totem-pl-parser.c
@@ -1822,7 +1822,6 @@ totem_pl_parser_parse_internal (TotemPlParser *parser,
        if (!parse_data->recurse && parse_data->recurse_level > 0)
                return TOTEM_PL_PARSER_RESULT_UNHANDLED;
 
-#ifdef HAVE_QUVI
        /* Should we try to parse it with quvi? */
        if (g_file_has_uri_scheme (file, "http")) {
                char *url;
@@ -1834,7 +1833,6 @@ totem_pl_parser_parse_internal (TotemPlParser *parser,
                }
                g_free (url);
        }
-#endif /* HAVE_QUVI */
 
        /* In force mode we want to get the data */
        if (parse_data->force != FALSE) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]