[rhythmbox] rhythmdb: add new property for storing podcast entry guids
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] rhythmdb: add new property for storing podcast entry guids
- Date: Mon, 17 Jan 2022 12:25:28 +0000 (UTC)
commit 3eef3f4d02c52ffe3499510bd979ca9f34e474c3
Author: Jonathan Matthew <jonathan d14n org>
Date: Thu Dec 30 18:02:52 2021 +1000
rhythmdb: add new property for storing podcast entry guids
podcast/rb-podcast-entry-types.c | 3 +++
rhythmdb/rhythmdb-private.h | 1 +
rhythmdb/rhythmdb-tree.c | 4 ++++
rhythmdb/rhythmdb.c | 12 ++++++++++++
rhythmdb/rhythmdb.h | 1 +
5 files changed, 21 insertions(+)
---
diff --git a/podcast/rb-podcast-entry-types.c b/podcast/rb-podcast-entry-types.c
index 87a0074db..f50b06d91 100644
--- a/podcast/rb-podcast-entry-types.c
+++ b/podcast/rb-podcast-entry-types.c
@@ -80,6 +80,7 @@ podcast_post_create (RhythmDBEntryType *entry_type, RhythmDBEntry *entry)
podcast->lang = rb_refstring_ref (empty);
podcast->copyright = rb_refstring_ref (empty);
podcast->image = rb_refstring_ref (empty);
+ podcast->guid = NULL;
rb_refstring_unref (empty);
}
@@ -92,6 +93,8 @@ podcast_data_destroy (RhythmDBEntryType *entry_type, RhythmDBEntry *entry)
rb_refstring_unref (podcast->lang);
rb_refstring_unref (podcast->copyright);
rb_refstring_unref (podcast->image);
+ if (podcast->guid != NULL)
+ rb_refstring_unref (podcast->guid);
}
/**
diff --git a/rhythmdb/rhythmdb-private.h b/rhythmdb/rhythmdb-private.h
index d6e0d7817..5eb2a8059 100644
--- a/rhythmdb/rhythmdb-private.h
+++ b/rhythmdb/rhythmdb-private.h
@@ -44,6 +44,7 @@ typedef struct {
RBRefString *lang;
RBRefString *copyright;
RBRefString *image;
+ RBRefString *guid;
gulong status; /* 0-99: downloading
100: Complete
101: Error
diff --git a/rhythmdb/rhythmdb-tree.c b/rhythmdb/rhythmdb-tree.c
index 18a486325..9da04c9f3 100644
--- a/rhythmdb/rhythmdb-tree.c
+++ b/rhythmdb/rhythmdb-tree.c
@@ -1131,6 +1131,10 @@ save_entry (RhythmDBTree *db,
if (podcast)
save_entry_ulong (ctx, elt_name, podcast->post_time, FALSE);
break;
+ case RHYTHMDB_PROP_PODCAST_GUID:
+ if (podcast && podcast->guid)
+ save_entry_string(ctx, elt_name, rb_refstring_get (podcast->guid));
+ break;
case RHYTHMDB_PROP_KEYWORD:
keywords = rhythmdb_entry_keywords_get (RHYTHMDB (db), entry);
diff --git a/rhythmdb/rhythmdb.c b/rhythmdb/rhythmdb.c
index 54c4294c9..f2d57ddf5 100644
--- a/rhythmdb/rhythmdb.c
+++ b/rhythmdb/rhythmdb.c
@@ -131,6 +131,7 @@ static const RhythmDBPropertyDef rhythmdb_properties[] = {
PROP_ENTRY(COPYRIGHT, G_TYPE_STRING, "copyright"),
PROP_ENTRY(IMAGE, G_TYPE_STRING, "image"),
PROP_ENTRY(POST_TIME, G_TYPE_ULONG, "post-time"),
+ PROP_ENTRY(PODCAST_GUID, G_TYPE_STRING, "podcast-guid"),
PROP_ENTRY(MUSICBRAINZ_TRACKID, G_TYPE_STRING, "mb-trackid"),
PROP_ENTRY(MUSICBRAINZ_ARTISTID, G_TYPE_STRING, "mb-artistid"),
@@ -3805,6 +3806,12 @@ rhythmdb_entry_set_internal (RhythmDB *db,
g_assert (podcast);
podcast->post_time = g_value_get_ulong (value);
break;
+ case RHYTHMDB_PROP_PODCAST_GUID:
+ g_assert (podcast);
+ if (podcast->guid != NULL)
+ rb_refstring_unref (podcast->guid);
+ podcast->guid = rb_refstring_new (g_value_get_string (value));
+ break;
case RHYTHMDB_NUM_PROPERTIES:
g_assert_not_reached ();
break;
@@ -5072,6 +5079,11 @@ rhythmdb_entry_get_string (RhythmDBEntry *entry,
return rb_refstring_get (podcast->image);
else
return NULL;
+ case RHYTHMDB_PROP_PODCAST_GUID:
+ if (podcast)
+ return rb_refstring_get (podcast->guid);
+ else
+ return NULL;
default:
g_assert_not_reached ();
diff --git a/rhythmdb/rhythmdb.h b/rhythmdb/rhythmdb.h
index 3b58d2334..9ee1fa849 100644
--- a/rhythmdb/rhythmdb.h
+++ b/rhythmdb/rhythmdb.h
@@ -147,6 +147,7 @@ typedef enum
RHYTHMDB_PROP_COPYRIGHT,
RHYTHMDB_PROP_IMAGE,
RHYTHMDB_PROP_POST_TIME,
+ RHYTHMDB_PROP_PODCAST_GUID,
RHYTHMDB_PROP_MUSICBRAINZ_TRACKID,
RHYTHMDB_PROP_MUSICBRAINZ_ARTISTID,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]