[rhythmbox] podcast: handle duration parsing errors
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] podcast: handle duration parsing errors
- Date: Mon, 17 Jan 2022 12:25:28 +0000 (UTC)
commit c2442dec0c38d4de69d9d45db30ce15aa1980c67
Author: Jonathan Matthew <jonathan d14n org>
Date: Thu Jan 6 20:35:28 2022 +1000
podcast: handle duration parsing errors
totem-pl-parser returns -1 if it can't parse the duration, so we should
ignore that rather than converting it to an unsigned number of seconds.
podcast/rb-podcast-manager.c | 12 +++++++-----
podcast/rb-podcast-manager.h | 2 +-
podcast/rb-podcast-parse.h | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/podcast/rb-podcast-manager.c b/podcast/rb-podcast-manager.c
index b479f7120..1b2571f3c 100644
--- a/podcast/rb-podcast-manager.c
+++ b/podcast/rb-podcast-manager.c
@@ -918,7 +918,7 @@ rb_podcast_manager_add_post (RhythmDB *db,
const char *description,
const char *guid,
gulong date,
- gulong duration,
+ gint64 duration,
gulong position,
guint64 filesize)
{
@@ -1028,10 +1028,12 @@ rb_podcast_manager_add_post (RhythmDB *db,
rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_FIRST_SEEN, &val);
g_value_unset (&val);
- g_value_init (&val, G_TYPE_ULONG);
- g_value_set_ulong (&val, duration);
- rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_DURATION, &val);
- g_value_unset (&val);
+ if (duration > 0) {
+ g_value_init (&val, G_TYPE_ULONG);
+ g_value_set_ulong (&val, duration);
+ rhythmdb_entry_set (db, entry, RHYTHMDB_PROP_DURATION, &val);
+ g_value_unset (&val);
+ }
g_value_init (&val, G_TYPE_DOUBLE);
g_value_set_double (&val, 0.0);
diff --git a/podcast/rb-podcast-manager.h b/podcast/rb-podcast-manager.h
index 806be9f75..be170c6ec 100644
--- a/podcast/rb-podcast-manager.h
+++ b/podcast/rb-podcast-manager.h
@@ -85,7 +85,7 @@ RhythmDBEntry * rb_podcast_manager_add_post (RhythmDB *db,
const char *description,
const char *guid,
gulong date,
- gulong duration,
+ gint64 duration,
gulong position,
guint64 filesize);
diff --git a/podcast/rb-podcast-parse.h b/podcast/rb-podcast-parse.h
index 87665840e..a894f2230 100644
--- a/podcast/rb-podcast-parse.h
+++ b/podcast/rb-podcast-parse.h
@@ -57,7 +57,7 @@ typedef struct
char* author;
char* guid;
guint64 pub_date;
- gulong duration;
+ gint64 duration;
guint64 filesize;
} RBPodcastItem;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]