[grilo-plugins/wip/hadess/remove-gmime-dep: 2/2] podcasts: Remove gmime dependency



commit 14643ae6e1a1b508f93ec6f7e4f47ae7afa1ec54
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jul 27 12:34:42 2018 +0200

    podcasts: Remove gmime dependency
    
    And use totem-pl-parser's helper function instead. totem-pl-parser
    master has dropped that dependency on gmime.

 .gitlab-ci.yml              |  2 +-
 configure.ac                | 12 +++---------
 meson.build                 |  3 +--
 src/podcasts/grl-podcasts.c | 22 ++++++++++++----------
 4 files changed, 17 insertions(+), 22 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a0adf9f..7fb9a53 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ variables:
   DEPENDENCIES: intltool sqlite-devel libgcrypt-devel itstool lua-devel
                 libsoup-devel gperf libarchive-devel json-glib-devel
                 avahi-gobject-devel totem-pl-parser-devel rest-devel
-                tracker-devel gmime30-devel libdmapsharing-devel libmediaart-devel
+                tracker-devel libdmapsharing-devel libmediaart-devel
                 gom-devel gnome-online-accounts-devel libgdata-devel
                 gstreamer1-plugins-good gstreamer1-plugins-bad-free-extras
 
diff --git a/configure.ac b/configure.ac
index d830de9..7a38fee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,8 +167,6 @@ fi
 
 PKG_CHECK_MODULES([JSON], [json-glib-1.0], HAVE_JSON_GLIB=yes, HAVE_JSON_GLIB=no)
 
-PKG_CHECK_MODULES(GMIME, [gmime-3.0], HAVE_GMIME=yes, HAVE_GMIME=no)
-
 PKG_CHECK_MODULES(AVAHI, [avahi-gobject avahi-glib avahi-client], HAVE_AVAHI=yes, HAVE_AVAHI=no)
 
 PKG_CHECK_MODULES(MEDIAART, [libmediaart-2.0], HAVE_MEDIAART=yes, HAVE_MEDIAART=no)
@@ -488,17 +486,13 @@ AC_ARG_ENABLE(podcasts,
                         if test "x$HAVE_SQLITE" = "xno"; then
                            AC_MSG_ERROR([sqlite3 not found, install it or use --disable-podcasts])
                         fi
-                        if test "x$HAVE_GMIME" = "xno"; then
-                           AC_MSG_ERROR([gmime-3.0 not found, install it or use --disable-podcasts])
-                        fi
                         ;;
                 esac
         ],
         [
                 if test "x$HAVE_GRLNET" = "xyes" -a \
                         "x$HAVE_XML" = "xyes" -a \
-                        "x$HAVE_SQLITE" = "xyes" -a \
-                        "x$HAVE_GMIME" = "xyes"; then
+                        "x$HAVE_SQLITE" = "xyes"; then
                    enable_podcasts=yes
                 else
                    enable_podcasts=no
@@ -516,9 +510,9 @@ PODCASTS_PLUGIN_ID="grl-podcasts"
 AC_SUBST(PODCASTS_PLUGIN_ID)
 AC_DEFINE_UNQUOTED([PODCASTS_PLUGIN_ID], ["$PODCASTS_PLUGIN_ID"], [Podcasts plugin ID])
 
-DEPS_PODCASTS_CFLAGS="$DEPS_CFLAGS $GRLNET_CFLAGS $XML_CFLAGS $SQLITE_CFLAGS $GMIME_CFLAGS"
+DEPS_PODCASTS_CFLAGS="$DEPS_CFLAGS $GRLNET_CFLAGS $XML_CFLAGS $SQLITE_CFLAGS"
 AC_SUBST(DEPS_PODCASTS_CFLAGS)
-DEPS_PODCASTS_LIBS="$DEPS_LIBS $GRLNET_LIBS $XML_LIBS $SQLITE_LIBS $GMIME_LIBS"
+DEPS_PODCASTS_LIBS="$DEPS_LIBS $GRLNET_LIBS $XML_LIBS $SQLITE_LIBS"
 AC_SUBST(DEPS_PODCASTS_LIBS)
 
 # ----------------------------------------------------------
diff --git a/meson.build b/meson.build
index 287e636..893d997 100644
--- a/meson.build
+++ b/meson.build
@@ -41,7 +41,6 @@ avahi_glib_dep = dependency('avahi-glib', required: false)
 avahi_gobject_dep = dependency('avahi-gobject', required: false)
 gio_dep = dependency('gio-2.0', required: false)
 gio_unix_dep = dependency('gio-unix-2.0', required: false)
-gmime_dep = dependency('gmime-3.0', required: false)
 goa_dep = dependency('goa-1.0', version: '>= 3.17.91', required: false)
 gom_dep = dependency('gom-1.0', version: '>= 0.3.2', required: false)
 grilo_net_dep = dependency('grilo-net-0.3', version: '>= 0.3.0', required: false)
@@ -105,7 +104,7 @@ plugins = [ # NAME, REQ_DEPS, OPT_DEPS
     ['metadata-store', [sqlite3_dep], []],
     ['opensubtitles', [gio_dep, libsoup_dep], []],
     ['optical-media', [totem_plparser_dep], []],
-    ['podcasts', [grilo_net_dep, libxml_dep, sqlite3_dep, gmime_dep], []],
+    ['podcasts', [grilo_net_dep, libxml_dep, sqlite3_dep, totem_plparser_dep], []],
     ['raitv', [grilo_net_dep, libxml_dep], []],
     ['shoutcast', [grilo_net_dep, libxml_dep], []],
     ['thetvdb', [grilo_net_dep, libxml_dep, libarchive_dep, gom_dep], []],
diff --git a/src/podcasts/grl-podcasts.c b/src/podcasts/grl-podcasts.c
index 0ab414c..a9e045e 100644
--- a/src/podcasts/grl-podcasts.c
+++ b/src/podcasts/grl-podcasts.c
@@ -32,7 +32,7 @@
 #include <libxml/xpath.h>
 #include <sqlite3.h>
 #include <string.h>
-#include <gmime/gmime-utils.h>
+#include <totem-pl-parser.h>
 
 #include "grl-podcasts.h"
 
@@ -631,10 +631,14 @@ build_media (GrlMedia *content,
 
     grl_media_set_id (media, url);
     if (date) {
-      GDateTime *date_time;
-      date_time = g_mime_utils_header_decode_date (date);
-      grl_media_set_publication_date (media, date_time);
-      g_date_time_unref (date_time);
+      guint64 epoch;
+      epoch = totem_pl_parser_parse_date (date, FALSE);
+      if (epoch != -1) {
+        GDateTime *time;
+        time = g_date_time_new_from_unix_utc (epoch);
+        grl_media_set_publication_date (media, time);
+        g_date_time_unref (time);
+      }
     }
     if (desc)
       grl_media_set_description (media, desc);
@@ -1268,11 +1272,9 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error)
   /* Check podcast pubDate (if available), if it has not been updated
      recently then we can use the cache and avoid parsing the feed */
   if (podcast_data->published != NULL) {
-    GDateTime *date_time =
-      g_mime_utils_header_decode_date (podcast_data->published);
-    gint64 pub_time = g_date_time_to_unix (date_time);
-    g_date_time_unref (date_time);
-    if (pub_time == 0) {
+    guint64 pub_time;
+    pub_time = totem_pl_parser_parse_date (podcast_data->published, FALSE);
+    if (pub_time != -1) {
       GRL_DEBUG ("Invalid podcast pubDate: '%s'", podcast_data->published);
       /* We will parse the feed again just in case */
     } else if (os->last_refreshed >= pub_time) {


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