[easytag] Improve MP4 empty field handling
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Improve MP4 empty field handling
- Date: Wed, 27 Apr 2016 05:58:01 +0000 (UTC)
commit dfb03abb2c5dd129e67e732139aa121384b6d7cc
Author: David King <amigadave amigadave com>
Date: Tue Apr 26 22:06:46 2016 +0100
Improve MP4 empty field handling
Do not copy fields which are empty, as this always results in the file
being marked as requiring saving.
https://bugzilla.gnome.org/show_bug.cgi?id=765385
src/tags/mp4_tag.cc | 36 +++++++++++++++++++++++++++++++-----
1 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/src/tags/mp4_tag.cc b/src/tags/mp4_tag.cc
index 441e9b0..52c2851 100644
--- a/src/tags/mp4_tag.cc
+++ b/src/tags/mp4_tag.cc
@@ -59,6 +59,7 @@ mp4tag_read_file_tag (GFile *file,
{
TagLib::MP4::Tag *tag;
guint year;
+ TagLib::String str;
g_return_val_if_fail (file != NULL && FileTag != NULL, FALSE);
@@ -105,17 +106,32 @@ mp4tag_read_file_tag (GFile *file,
/*********
* Title *
*********/
- FileTag->title = g_strdup (tag->title ().toCString (true));
+ str = tag->title ();
+
+ if (!str.isEmpty ())
+ {
+ et_file_tag_set_title (FileTag, str.toCString (true));
+ }
/**********
* Artist *
**********/
- FileTag->artist = g_strdup (tag->artist ().toCString (true));
+ str = tag->artist ();
+
+ if (!str.isEmpty ())
+ {
+ et_file_tag_set_artist (FileTag, str.toCString (true));
+ }
/*********
* Album *
*********/
- FileTag->album = g_strdup (tag->album ().toCString (true));
+ str = tag->album ();
+
+ if (!str.isEmpty ())
+ {
+ et_file_tag_set_album (FileTag, str.toCString (true));
+ }
const TagLib::PropertyMap extra_tag = tag->properties ();
@@ -164,12 +180,22 @@ mp4tag_read_file_tag (GFile *file,
/*********
* Genre *
*********/
- FileTag->genre = g_strdup (tag->genre ().toCString (true));
+ str = tag->genre ();
+
+ if (!str.isEmpty ())
+ {
+ et_file_tag_set_genre (FileTag, str.toCString (true));
+ }
/***********
* Comment *
***********/
- FileTag->comment = g_strdup (tag->comment ().toCString (true));
+ str = tag->comment ();
+
+ if (!str.isEmpty ())
+ {
+ et_file_tag_set_comment (FileTag, str.toCString (true));
+ }
/**********************
* Composer or Writer *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]