[sound-juicer] mb-test: Handle missing release date
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer] mb-test: Handle missing release date
- Date: Mon, 2 Mar 2015 13:58:41 +0000 (UTC)
commit d608266412407b0002d0e01f06159e0d9e6497a7
Author: Phillip Wood <phillip wood dunelm org uk>
Date: Wed Feb 25 11:19:57 2015 +0000
mb-test: Handle missing release date
Check that there is a release date before trying to use it.
tests/mb-test.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/tests/mb-test.c b/tests/mb-test.c
index 345cf9a..54f0ac7 100644
--- a/tests/mb-test.c
+++ b/tests/mb-test.c
@@ -60,7 +60,7 @@ metadata_cb (SjMetadataGetter *metadata, GList *albums, const GError *error)
AlbumDetails *album;
album = (AlbumDetails*)albums->data;
char *disc_number;
- char *release_date;
+ char *release_date = NULL;
g_print ("Source: %s\n", source_to_str(album->metadata_source));
if (album->metadata_source == SOURCE_MUSICBRAINZ)
g_print ("Album ID: %s\n", album->album_id);
@@ -73,9 +73,15 @@ metadata_cb (SjMetadataGetter *metadata, GList *albums, const GError *error)
if (album->is_spoken_word)
g_print ("Is spoken word\n");
disc_number = g_strdup_printf (" (Disc %d)", album->disc_number);
- release_date = gst_date_time_to_iso8601_string (album->release_date);
- g_print ("'%s', by %s%s, released %s\n", album->title, album->artist, album->disc_number ? disc_number :
"",
- release_date);
+ if (album->release_date) {
+ gchar *date;
+ date = gst_date_time_to_iso8601_string (album->release_date);
+ release_date = g_strdup_printf (", released %s\n", date);
+ g_free (date);
+ }
+ g_print ("'%s', by %s%s%s\n", album->title, album->artist,
+ album->disc_number ? disc_number : "",
+ release_date ? release_date : "");
g_free (release_date);
g_free (disc_number);
while (album->tracks) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]