[PATCH 6/6] Use IntPair handling for disc number/total
- From: Santtu Lakkala <inz inz fi>
- To: easytag-list gnome org
- Subject: [PATCH 6/6] Use IntPair handling for disc number/total
- Date: Thu, 10 Apr 2014 08:32:33 +0300
Disc number and total should be as int pair.
---
src/mp4_tag.cc | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/mp4_tag.cc b/src/mp4_tag.cc
index df546e0..ebcd2c5 100644
--- a/src/mp4_tag.cc
+++ b/src/mp4_tag.cc
@@ -110,8 +110,11 @@ gboolean Mp4tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
/* Disc number. */
if (extra_tag.contains ("disk"))
{
- const TagLib::MP4::Item disc_number = extra_tag["DISCNUMBER"];
- FileTag->disc_number = et_disc_number_to_string (disc_number.toStringList ().front ().toInt ());
+ const TagLib::MP4::Item disc_number = extra_tag["disk"];
+ TagLib::MP4::Item::IntPair disc_num_tot = disc_number.toIntPair ();
+
+ FileTag->disc_number = et_disc_number_to_string (disc_num_tot.first);
+ FileTag->disc_total = et_disc_number_to_string (disc_num_tot.second);
}
/********
@@ -267,11 +270,8 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
/* Disc number. */
if (FileTag->disc_number && FileTag->disc_total)
{
- gchar *numtot = g_strdup_printf ("%s/%s", FileTag->disc_number, FileTag->disc_total);
- TagLib::String string (numtot, TagLib::String::UTF8);
- g_free(numtot);
-
- extra_tag.insert ("disk", TagLib::MP4::Item (string));
+ extra_tag.insert ("disk", TagLib::MP4::Item (atoi (FileTag->disc_number),
+ atoi (FileTag->disc_total)));
}
/********
--
1.8.3.2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]