129 lines
5.3 KiB
Diff
129 lines
5.3 KiB
Diff
From 210de8e31e6c787d58b838fedf08e033ff6208a3 Mon Sep 17 00:00:00 2001
|
|
From: Bastien Nocera <hadess@hadess.net>
|
|
Date: Fri, 27 Jul 2018 12:34:42 +0200
|
|
Subject: [PATCH] podcasts: Remove gmime dependency
|
|
|
|
And use totem-pl-parser's helper function instead. totem-pl-parser
|
|
master has dropped that dependency on gmime.
|
|
---
|
|
configure.ac | 12 +++---------
|
|
meson.build | 3 +--
|
|
src/podcasts/grl-podcasts.c | 22 ++++++++++++----------
|
|
3 files changed, 16 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 6f7e6e0..7fbcb38 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 d15f50c..28bbf18 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) {
|
|
--
|
|
2.17.1
|
|
|