File fix-taglib2-compatibility.patch of Package musique

From 7277d40defe9cde40f947a81d624195ddf683f44 Mon Sep 17 00:00:00 2001
From: letsfindaway <me@letsfindaway.de>
Date: Wed, 20 Mar 2024 07:19:11 +0100
Subject: [PATCH] fix: compatibility with TagLib 2.0

- replace MP4::ItemListMap by TagLib::MP4::ItemMap
- replace MP4::Tag::itemListMap() by MP4::Tag::itemMap()
- add version requirement for TagLib >= 1.10 in README.md
---
 README.md           | 2 +-
 src/coverutils.cpp  | 2 +-
 src/mainwindow.cpp  | 3 +++
 src/tags/mp4utils.h | 4 ++--
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index a1e08a5..8b28cf8 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Translations are done at https://www.transifex.com/flaviotordini/musique/
 Just register and apply for a language team. Please don't request translation merges on GitHub.

 ## Build instructions
-To compile Musique you need at least Qt 6.0. The following Qt modules are needed: core, gui, widgets, network, sql (using the Sqlite plugin), declarative, dbus. You also need TagLib: http://taglib.github.io and MPV >= 0.29.0: https://mpv.io/
+To compile Musique you need at least Qt 6.0. The following Qt modules are needed: core, gui, widgets, network, sql (using the Sqlite plugin), declarative, dbus. You also need TagLib: http://taglib.github.io >= 1.10 and MPV >= 0.29.0: https://mpv.io/

 To be able to build on a Debian (or derivative) system:

diff --git a/src/coverutils.cpp b/src/coverutils.cpp
index ae89330..4ba717e 100644
--- a/src/coverutils.cpp
+++ b/src/coverutils.cpp
@@ -158,7 +158,7 @@ bool CoverUtils::coverFromMP4(const QString &filename, Album *album) {
     TagLib::MP4::Tag *tag = static_cast<TagLib::MP4::Tag *>(f.tag());
     if (!tag) return false;

-    TagLib::MP4::ItemListMap itemsListMap = tag->itemListMap();
+    TagLib::MP4::ItemMap itemsListMap = tag->itemMap();
     TagLib::MP4::Item coverItem = itemsListMap["covr"];
     TagLib::MP4::CoverArtList coverArtList = coverItem.toCoverArtList();
     TagLib::MP4::CoverArt coverArt = coverArtList.front();
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index dac2bd8..6587591 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -46,6 +46,9 @@ along with Musique.  If not, see <http://www.gnu.org/licenses/>.
 #include "view.h"
 #include "zoomableui.h"

+#include <iostream>
+
+
 #if defined(APP_MAC_SEARCHFIELD) && !defined(APP_MAC_QMACTOOLBAR)
 #include "searchlineedit_mac.h"
 #else
diff --git a/src/tags/mp4utils.h b/src/tags/mp4utils.h
index 138c5b5..6b4bcef 100644
--- a/src/tags/mp4utils.h
+++ b/src/tags/mp4utils.h
@@ -9,7 +9,7 @@
 namespace Mp4Utils {

 void load(TagLib::MP4::Tag *tag, Tags *tags) {
-    const TagLib::MP4::ItemListMap &map = tag->itemListMap();
+    const TagLib::MP4::ItemMap &map = tag->itemMap();

     if (map.contains("trkn")) {
         TagLib::MP4::Item::IntPair intPair = map["trkn"].toIntPair();
@@ -31,7 +31,7 @@ void load(TagLib::MP4::Tag *tag, Tags *tags) {
         tags->setComposerSort(v);
     }

-    TagLib::MP4::ItemListMap::ConstIterator it = map.find("aART");
+    TagLib::MP4::ItemMap::ConstIterator it = map.find("aART");
     if (it != map.end()) {
         TagLib::StringList sl = it->second.toStringList();
         if (!sl.isEmpty())
openSUSE Build Service is sponsored by