summaryrefslogtreecommitdiff
path: root/kde-apps/kscd
diff options
context:
space:
mode:
Diffstat (limited to 'kde-apps/kscd')
-rw-r--r--kde-apps/kscd/Manifest5
-rw-r--r--kde-apps/kscd/files/kscd-17.08.3-musicbrainz5.patch626
-rw-r--r--kde-apps/kscd/kscd-17.08.3.ebuild (renamed from kde-apps/kscd/kscd-17.08.2.ebuild)4
3 files changed, 632 insertions, 3 deletions
diff --git a/kde-apps/kscd/Manifest b/kde-apps/kscd/Manifest
index 8cf67a402d74..e3a5f3733ac0 100644
--- a/kde-apps/kscd/Manifest
+++ b/kde-apps/kscd/Manifest
@@ -1,7 +1,8 @@
+AUX kscd-17.08.3-musicbrainz5.patch 17580 SHA256 ef35292b3cb4c43700049ab0ee03b47dd9b24f2d2d4a86cd37ad2efdf26b2714 SHA512 540d74451a7134451e05f7ecc84960fff0759e1dd4e5c8c5465bf88bd8691da248e5908f815ac8676524d17a3b18aa769a920c5121d9ce67f967583d73a595d9 WHIRLPOOL ea333c1c65f05c689aff5ebadd86e82ad5c6cd4f68e5b53e5fdcb8cccb70121250a41a20ad78c233739b53248454773bd819693f1662b0b7f16dd6a1dcffca61
DIST kscd-17.04.3.tar.xz 92800 SHA256 a69c30d44326ef8345ab9f34cad0a7a38625131ed847600818090850e52c5cb0 SHA512 0c969bcbd0d94d9cd724cb5d9777df2177d5aabcf163afb8f5a9e4e3a88e146847fc8835ab6b76200e6678604ffbe28a785cd5c04f799a2a724861e9fce495ed WHIRLPOOL 2eab2ccc513337e81cc2bb3a1036c395ea19da4fb8070aae11d05bfe8f1ce525739e437a6d9eee443effa105d6652c5bed59fe927423dddeca72577f3f29e542
-DIST kscd-17.08.2.tar.xz 92532 SHA256 1ed1017911ec2b3d7bcef0f789f404fa67889867b7c1563e74aef1072e6fe9dc SHA512 08bfcebee0215adb2e0ebe958c557b9279d629a138facd9e0dc82ef742b22d98925028a148cc7b232bf0354b45e0ece08f11c457f1a15a70033a80141247391f WHIRLPOOL 0fc0129754efb2bc94ac157e8140a880bda59ac73dd7e1cd9ad7b18a204bae79058b4fffa9c6ecbda993f3373b24c9697095e39d1dd4296c0c77beb89ecf3015
+DIST kscd-17.08.3.tar.xz 92564 SHA256 a0ee95fbb31e1e0b54b31eb196e495194bbf4ba51b9a127d44ae9f762efc2923 SHA512 96f8d5e0f00c82f40276ba3ddcc6920e2a076d761c88454e9cddb52f62bbcf06ede63c04f9b5315882a3d33aa9f8297bfbd1c8be94ac5f24bf639cf8f9b13bbc WHIRLPOOL b5b2ca00dd5ca1585aa8988322c4ceb8b014cade4e90dab7b6277717d77cbc9104af4a97930754088261b195bc737f7fcbcc0044d80143f50181cb2d63b293a8
EBUILD kscd-17.04.3.ebuild 340 SHA256 a05703e9475ccd0e2afa42740d30d4ab619997790a8c0bee0a1d95bcd06ea1ee SHA512 afe08faa97c28729da5783e6fbce4aadc8df252a8d145bbcd94a726327816f337bd36d8a9aa923e3020dafaa9cf51b13305881c17bf160258fb9d9079fcf1e14 WHIRLPOOL 9520a8ca8829c3ee11e1edf35cd85f3647428a1d8fefc45c380e2a62f21f3a47bcd1bf02f1a16dc10d826bd98890178ae8a6825b3c456f1f5a6461d5b152f365
-EBUILD kscd-17.08.2.ebuild 342 SHA256 17c8a921dd310cbcf38b4731ebd384351f89ecbf197f13b5a9b64c6bd64eccad SHA512 ca41e39f57f878ad4848211c575d0ac36ecb167a5f246e024fafdbf7349cba608260385456398f173a74e1bda4edbed1b306dea0aa33384391e0e9c8732adcef WHIRLPOOL 0d570000ec6fd83bd621a5c9c7ae681aa2b74ba2dd86e34edfe4da19cfd9f2b8b72c8e6acdd919321eb10003ef3148f45501dfd696d6c217fcb35a237ed2344b
+EBUILD kscd-17.08.3.ebuild 393 SHA256 deaf309968a07ebacdc4c76e0f610738a6dfad3aa1682d9012a6839dce69112f SHA512 c97bc77164454bf537ddc1bf9bb4f5b4144c66597899bda4a10dec65f2f351df232d8775efd4040b3376073bfba7bb6d49e79f00a5d9095fe05baa2d4d9e3eab WHIRLPOOL b35dc6b6f9ea8260901a143a7a94e4bdfcd84e51b0689109487fd2b1be7175d6365b49bfbe478988eef140114fb25565438c10f0a994f2cf098c2bb6eb25c716
MISC ChangeLog 8532 SHA256 31059b71b0279cceb1ed5f41818c0729ab0d4d55fd09dcd9b5efbee13921e7a1 SHA512 c7f3209b0acade46c2fa6026b6af474a921040c90c12fffef3d5fa55013d332a7daa2374346dcac9dc343e91709b1c12f8d8d0320dd3810d2f41f3ce54ae8cb2 WHIRLPOOL 49d9aa9dc4959b95cf5b82f207d7c23a78f4c8f96ed760686194a6c58ecb996ebc163f1afe2d6feab92e3a37d89d86a8fd6fe15ad3dff5d9afed45c837cd01ac
MISC ChangeLog-2015 38203 SHA256 9a95c3dfc7e8dfbfc4ecb78c67935ed519fe38f90f7bd4a55fb9e7be9df4c36c SHA512 e5388dd5c16512fc68b7676ee049b6b5f859f3fb3d41282eca5e608780d3355f438feec5c15bafae74e97578e539302147d0a896b976b2455e4b645229530996 WHIRLPOOL cbe009f99961782f794f5736dcf7233d66edca8ef6e6bf45dbbed16059bdda1f6d676df0b4e6d2c10326c1c02d0f9cb272f4eb54186872836c267e6ff9a2656e
MISC metadata.xml 249 SHA256 584f1dcf51866dc24a9abf7a89bfba0fad11dde81ae1c1b715da41770d233c99 SHA512 76a5a340b13f0053ca3c5e94ed24380ea8d29b45ac8655419e22eaadb1e4a827c04d2e7e36b65145c4964e6526f656618fc6ac144e277ef53cb7373e6239e3c3 WHIRLPOOL 200c07a8bf7c55b11b7936d5cd30e991a511684913334e72f59def66c0ced5fed0b4a8754e2d98bffbab631cb90d4e17fcccc59d5dcc5a8e988f69e47c85518c
diff --git a/kde-apps/kscd/files/kscd-17.08.3-musicbrainz5.patch b/kde-apps/kscd/files/kscd-17.08.3-musicbrainz5.patch
new file mode 100644
index 000000000000..645450c3d595
--- /dev/null
+++ b/kde-apps/kscd/files/kscd-17.08.3-musicbrainz5.patch
@@ -0,0 +1,626 @@
+Combining the following upstream commits to migrate to musibrainz5:
+
+ 536b679d8a0e4d3c470366b5bdfe142edb1c9307
+ 908815f9fc7a0d7ebeae68c14a02026464b6c935
+ 86128bdfef49d241e6aa71f968c614b8b07462de
+ c3c68d6015f967b07bf6fd66f8fcb5d65b9122e4
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f1a9462..32c7656 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,13 +8,15 @@ include(KDE4Defaults)
+ include(MacroLibrary)
+ include_directories(${QT_INCLUDES} ${KDE4_INCLUDES})
+
+-find_package(MusicBrainz3 REQUIRED)
++find_package(MusicBrainz5 REQUIRED)
++find_package(DiscId REQUIRED)
+
+ include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/gui
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_BINARY_DIR}
+- ${MUSICBRAINZ3_INCLUDE_DIR}
++ ${MUSICBRAINZ5_INCLUDE_DIR}
++ ${DISCID_INCLUDE_DIR}
+ )
+ add_subdirectory(tests)
+ ########### next target ###############
+@@ -112,7 +114,8 @@ target_link_libraries(kscd
+ ${KDE4_KIO_LIBS}
+ ${KDE4_SOLID_LIBS}
+ ${KDE4_PHONON_LIBS}
+- ${MUSICBRAINZ3_LIBRARIES}
++ ${MUSICBRAINZ5_LIBRARIES}
++ ${DISCID_LIBRARIES}
+ )
+
+ ########### install files ###############
+diff --git a/cmake/FindDiscId.cmake b/cmake/FindDiscId.cmake
+new file mode 100644
+index 0000000..6de59f5
+--- /dev/null
++++ b/cmake/FindDiscId.cmake
+@@ -0,0 +1,20 @@
++# Module to find the discid library
++# It can be found at http://musicbrainz.org/doc/libdiscid
++#
++# It defines
++# DISCID_INCLUDE_DIR - the include dir
++# DISCID_LIBRARIES - the required libraries
++# DISCID_FOUND - true if both of the above have been found
++
++# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
++# Copyright (c) 2010 Gerd Fleischer
++#
++# Redistribution and use is allowed according to the terms of the BSD license.
++
++FIND_PATH(DISCID_INCLUDE_DIR discid/discid.h)
++
++FIND_LIBRARY(DISCID_LIBRARIES NAMES discid)
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args( DiscId DEFAULT_MSG
++ DISCID_INCLUDE_DIR DISCID_LIBRARIES)
+diff --git a/cmake/FindMusicBrainz3.cmake b/cmake/FindMusicBrainz3.cmake
+deleted file mode 100644
+index 2d11e36..0000000
+--- a/cmake/FindMusicBrainz3.cmake
++++ /dev/null
+@@ -1,40 +0,0 @@
+-# Module to find the musicbrainz-3 library
+-#
+-# It defines
+-# MUSICBRAINZ3_INCLUDE_DIR - the include dir
+-# MUSICBRAINZ3_LIBRARIES - the required libraries
+-# MUSICBRAINZ3_FOUND - true if both of the above have been found
+-
+-# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
+-#
+-# Redistribution and use is allowed according to the terms of the BSD license.
+-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+-
+-if(MUSICBRAINZ3_INCLUDE_DIR AND MUSICBRAINZ3_LIBRARIES)
+- set(MUSICBRAINZ3_FIND_QUIETLY TRUE)
+-endif(MUSICBRAINZ3_INCLUDE_DIR AND MUSICBRAINZ3_LIBRARIES)
+-
+-# use pkg-config to get the directories and then use these values
+-# in the FIND_PATH() and FIND_LIBRARY() calls
+-find_package(PkgConfig)
+-pkg_check_modules(PC_LIBMUSICBRAINZ3 QUIET libmusicbrainz3)
+-
+-FIND_PATH(MUSICBRAINZ3_INCLUDE_DIR musicbrainz3/musicbrainz.h
+- HINTS
+- ${PC_LIBMUSICBRAINZ3_INCLUDEDIR}
+- ${PC_LIBMUSICBRAINZ3_INCLUDE_DIRS}
+-)
+-
+-FIND_LIBRARY( MUSICBRAINZ3_LIBRARIES NAMES musicbrainz3
+- HINTS
+- ${PC_LIBMUSICBRAINZ3_LIBDIR}
+- ${PC_LIBMUSICBRAINZ3_LIB_DIRS}
+-)
+-
+-include(FindPackageHandleStandardArgs)
+-find_package_handle_standard_args( MusicBrainz3 DEFAULT_MSG
+- MUSICBRAINZ3_INCLUDE_DIR MUSICBRAINZ3_LIBRARIES)
+-
+-MARK_AS_ADVANCED(MUSICBRAINZ3_INCLUDE_DIR MUSICBRAINZ3_LIBRARIES)
+-
+-
+diff --git a/cmake/FindMusicBrainz5.cmake b/cmake/FindMusicBrainz5.cmake
+new file mode 100644
+index 0000000..0f78342
+--- /dev/null
++++ b/cmake/FindMusicBrainz5.cmake
+@@ -0,0 +1,33 @@
++# Module to find the musicbrainz-5 library
++#
++# It defines
++# MUSICBRAINZ5_INCLUDE_DIR - the include dir
++# MUSICBRAINZ5_LIBRARIES - the required libraries
++# MUSICBRAINZ5_FOUND - true if both of the above have been found
++
++# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
++#
++# Redistribution and use is allowed according to the terms of the BSD license.
++# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
++
++if(MUSICBRAINZ5_INCLUDE_DIR AND MUSICBRAINZ5_LIBRARIES)
++ set(MUSICBRAINZ5_FIND_QUIETLY TRUE)
++endif()
++
++find_path(MUSICBRAINZ5_INCLUDE_DIR musicbrainz5/Disc.h)
++
++find_library(MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5cc)
++if (NOT MUSICBRAINZ5_LIBRARIES)
++ find_library(MUSICBRAINZ5_LIBRARIES NAMES musicbrainz5)
++endif()
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(MusicBrainz5 DEFAULT_MSG MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES)
++
++add_library(musicbrainz SHARED IMPORTED)
++set_target_properties(musicbrainz PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${MUSICBRAINZ5_INCLUDE_DIR}"
++ IMPORTED_LOCATION "${MUSICBRAINZ5_LIBRARIES}"
++)
++
++mark_as_advanced(MUSICBRAINZ5_INCLUDE_DIR MUSICBRAINZ5_LIBRARIES)
+diff --git a/kscd.cpp b/kscd.cpp
+index 3bcb8f6..2c6d1a4 100644
+--- a/kscd.cpp
++++ b/kscd.cpp
+@@ -114,7 +114,7 @@ void KSCD::setupActions()
+ m_uploadAction = m_actions->addAction( QLatin1String( "Upload Info" ));
+ m_uploadAction->setText(i18n("Upload Info"));
+ addAction(m_uploadAction);
+- connect(m_uploadAction, SIGNAL(triggered()), m_MBManager, SLOT(discUpload()));
++ connect(m_uploadAction, SIGNAL(triggered()), this, SLOT(discUpload()));
+
+ //play/pause
+ m_playPauseAction = m_actions->addAction( QLatin1String( "Play/Pause" ));
+@@ -248,6 +248,11 @@ void KSCD::discLookup()
+ m_MBManager->discLookup(devices->getMedia()->currentSource().deviceName());
+ }
+
++void KSCD::discUpload()
++{
++ m_MBManager->discUpload(devices->getMedia()->currentSource().deviceName());
++}
++
+ void KSCD::discLookupFinished()
+ {
+ // If the track dialog is open, refresh it
+diff --git a/kscd.h b/kscd.h
+index 43fd653..83f8287 100644
+--- a/kscd.h
++++ b/kscd.h
+@@ -130,6 +130,7 @@ public slots:
+ void configureKeys();
+
+ void discLookup();
++ void discUpload();
+ void discLookupFinished();
+
+ private:
+diff --git a/mbmanager.cpp b/mbmanager.cpp
+index 4df3803..f3fd67f 100644
+--- a/mbmanager.cpp
++++ b/mbmanager.cpp
+@@ -34,86 +34,239 @@
+
+ #include <ktoolinvocation.h>
+
+-#include <musicbrainz3/musicbrainz.h>
+-#include <musicbrainz3/query.h>
++#include <musicbrainz5/Query.h>
++#include <musicbrainz5/Artist.h>
++#include <musicbrainz5/ArtistCredit.h>
++#include <musicbrainz5/Disc.h>
++#include <musicbrainz5/HTTPFetch.h>
++#include <musicbrainz5/Medium.h>
++#include <musicbrainz5/NameCredit.h>
++#include <musicbrainz5/NameCreditList.h>
++#include <musicbrainz5/Recording.h>
++#include <musicbrainz5/Release.h>
++#include <musicbrainz5/Track.h>
+
+ MBManager::MBManager():m_validInfo(true)
+ {
+-
++ m_discid = discid_new();
+ }
+
+ MBManager::~MBManager()
+ {
++ discid_free(m_discid);
++}
++
++static QString getTitle(MusicBrainz5::CRelease *release, MusicBrainz5::CMedium *medium)
++{
++ QString title;
++ if (!release)
++ {
++ return title;
++ }
++
++ title = QString::fromUtf8(release->Title().c_str());
++ if (medium && release->MediumList()->NumItems() > 1)
++ {
++ title = i18n("%1 (disc %2)", title, medium->Position());
++ }
+
++ return title;
+ }
+
+-void MBManager::discLookup(const QString &device)
++static QString getArtistFromArtistCredit(MusicBrainz5::CArtistCredit *artistCredit)
+ {
+- m_validInfo = true;
++ QString artist;
++ MusicBrainz5::CNameCreditList *artistList = artistCredit->NameCreditList();
++
++ if (!artistList)
++ {
++ return artist;
++ }
+
+- MusicBrainz::WebService* ws = new MusicBrainz::WebService();
++ for (int i = 0; i < artistList->NumItems(); i++)
++ {
++ MusicBrainz5::CNameCredit* name = artistList->Item(i);
++ MusicBrainz5::CArtist* itemArtist = name->Artist();
++
++ if (!name->Name().empty())
++ {
++ artist += QString::fromUtf8(name->Name().c_str());
++ }
++ else
++ {
++ artist += QString::fromUtf8(itemArtist->Name().c_str());
++ }
++
++ artist += QString::fromUtf8(name->JoinPhrase().c_str());
++ }
++
++ return artist;
++}
+
+- // Set the proper server to use. Defaults to mm.musicbrainz.org:80
+- if (!qgetenv("MB_SERVER").isNull())
++static QString getArtist(MusicBrainz5::CRelease *release)
++{
++ QString artist;
++ if (!release)
+ {
+- std::string server(qgetenv("MB_SERVER"));
+- ws->setHost(server);
+- //kDebug() << "!! set server !!" ;
++ return artist;
+ }
+- else
++
++ MusicBrainz5::CArtistCredit *artistCredit = release->ArtistCredit();
++ return getArtistFromArtistCredit(artistCredit);
++}
++
++static QList<MBTrackInfo> unknownTracks(QString &discArtist, DiscId *m_discid)
++{
++ QList<MBTrackInfo> tracks;
++ MBTrackInfo track;
++ for (int j = 1; j < discid_get_first_track_num(m_discid); j++)
++ {
++ track.Title = i18n("Unknown title");
++ track.Artist = discArtist;
++ // Not an audio track
++ track.Duration = 0;
++
++ tracks << track;
++ }
++ for (int j = discid_get_first_track_num(m_discid); j <= discid_get_last_track_num(m_discid); j++)
++ {
++ track.Title = i18n("Unknown title");
++ track.Artist = discArtist;
++ // time from mb library in sectors, 75 sectors = 1 second
++ track.Duration = discid_get_track_length(m_discid, j) * 1000 / 75;
++
++ tracks << track;
++ }
++
++ return tracks;
++}
++
++static QList<MBTrackInfo> getTracks(MusicBrainz5::CMedium *medium, QString &discArtist, DiscId *m_discid)
++{
++ QList<MBTrackInfo> tracks;
++ if (!medium)
++ {
++ return tracks;
++ }
++
++ MusicBrainz5::CTrackList *trackList = medium->TrackList();
++ if (!trackList)
++ {
++ return unknownTracks(discArtist, m_discid);
++ }
++
++ MBTrackInfo track;
++ for (int i = 0; i < trackList->NumItems(); i++)
++ {
++ MusicBrainz5::CTrack *itemTrack = trackList->Item(i);
++ MusicBrainz5::CRecording *recording = itemTrack->Recording();
++ if (recording && !itemTrack->ArtistCredit())
++ {
++ track.Artist = getArtistFromArtistCredit(recording->ArtistCredit());
++ }
++ else
++ {
++ track.Artist = getArtistFromArtistCredit(itemTrack->ArtistCredit());
++ }
++
++ if(recording && itemTrack->Title().empty())
++ {
++ track.Title = QString::fromUtf8(recording->Title().c_str());
++ }
++ else
++ {
++ track.Title = QString::fromUtf8(itemTrack->Title().c_str());
++ }
++
++ track.Duration = itemTrack->Length();
++
++ tracks << track;
++ }
++
++ return tracks;
++}
++
++static MusicBrainz5::CRelease *getRelease(MusicBrainz5::CQuery &query, std::string &discId, MusicBrainz5::CMetadata &metadata, MusicBrainz5::CMetadata &fullMetadata)
++{
++ metadata = query.Query("discid", discId);
++ // Check to see how many items were returned from the server
++ if (!metadata.Disc() || !metadata.Disc()->ReleaseList())
++ {
++ return 0;
++ }
++
++ MusicBrainz5::CReleaseList *results = metadata.Disc()->ReleaseList();
++
++ // TODO if multiple entries found
++ if (results->NumItems() > 1)
++ {
++ kDebug() << results->NumItems() << " entries found";
++ }
++
++ MusicBrainz5::CRelease *release;
++ for (int i = 0; i < results->NumItems(); i++)
+ {
+- //kDebug() << "no server";
++ MusicBrainz5::CRelease *result = results->Item(i);
++ MusicBrainz5::CQuery::tParamMap params;
++ params["inc"] = "artists labels recordings release-groups url-rels "
++ "discids artist-credits";
++ fullMetadata = query.Query("release", result->ID(), "", params);
++
++ release = fullMetadata.Release();
++ if (release)
++ {
++ break;
++ }
++ }
++
++ return release;
++}
++
++static MusicBrainz5::CMedium *getMedium(MusicBrainz5::CRelease *release, std::string &discId, MusicBrainz5::CMediumList &mediaList)
++{
++ if (!release)
++ {
++ return 0;
+ }
+
+- // If you need to use a proxy, uncomment/edit the following line
+- // as appropriate
+- //ws->setProxyHost("proxy.mydomain.com");
+- //ws->setProxyPort(80);
++ // Find the specific media in the release
++ mediaList = release->MediaMatchingDiscID(discId);
++ MusicBrainz5::CMedium* medium = 0;
+
+- try
++ for (int i = 0; i < mediaList.NumItems(); i++)
+ {
+- MusicBrainz::Disc *disc = MusicBrainz::readDisc(qPrintable(device));
++ medium = mediaList.Item(i);
++ if (medium)
++ {
++ break;
++ }
++ }
+
+- MusicBrainz::Query q(ws);
+- MusicBrainz::ReleaseResultList results;
++ return medium;
++}
+
++void MBManager::discLookup(const QString &device)
++{
++ m_validInfo = true;
++ MusicBrainz5::CQuery query("kscd");
++ int discid_ok = discid_read_sparse(m_discid, qPrintable(device), 0);
++ if (discid_ok)
++ {
++ std::string discId(discid_get_id(m_discid));
+ try
+ {
+- MusicBrainz::ReleaseFilter f = MusicBrainz::ReleaseFilter().discId(disc->getId());
+- results = q.getReleases(&f);
++ MusicBrainz5::CMetadata metadata, fullMetadata;
++ MusicBrainz5::CMediumList mediaList;
++ MusicBrainz5::CRelease *release = getRelease(query, discId, metadata, fullMetadata);
++ MusicBrainz5::CMedium *medium = getMedium(release, discId, mediaList);
+
+- // Check to see how many items were returned from the server
+- if (!results.empty())
++ if (release && medium)
+ {
+- // TODO if multiple entries found
+- if (results.size() > 1)
+- {
+- kDebug() << results.size() << " entries found";
+- }
+-
+- MusicBrainz::ReleaseResult *result = results.front();
+- MusicBrainz::Release *release = q.getReleaseById(result->getRelease()->getId(),
+- &MusicBrainz::ReleaseIncludes().tracks().artist());
+ // Sets info
+- m_discInfo.Title = QString::fromUtf8(release->getTitle().c_str());
+- m_discInfo.Artist = QString::fromUtf8(release->getArtist()->getName().c_str());
+-
+- m_trackList.clear();
+- MBTrackInfo track;
+- for (MusicBrainz::TrackList::iterator j = release->getTracks().begin();
+- j != release->getTracks().end(); j++)
+- {
+- MusicBrainz::Track *t = *j;
+- MusicBrainz::Artist *artist = t->getArtist();
+- if (!artist)
+- artist = release->getArtist();
+-
+- track.Title = QString::fromUtf8(t->getTitle().c_str());
+- track.Artist = QString::fromUtf8(artist->getName().c_str());
+- track.Duration = t->getDuration();
+-
+- m_trackList << track;
+- }
++ m_discInfo.Title = getTitle(release, medium);
++ m_discInfo.Artist = getArtist(release);
++
++ m_trackList = getTracks(medium, m_discInfo.Artist, m_discid);
+ }
+ else
+ {
+@@ -121,75 +274,57 @@ void MBManager::discLookup(const QString &device)
+ m_validInfo = false;
+ }
+
+-
+ }
+- catch (const MusicBrainz::WebServiceError &e)
+- {
+- kDebug() << "Error: " << e.what();
++ catch (MusicBrainz5::CExceptionBase& error)
++ {
++ kDebug() << "Connection Exception: '" << error.what() << "'";
++ kDebug() << "LastResult: " << query.LastResult();
++ kDebug() << "LastHTTPCode: " << query.LastHTTPCode();
++ kDebug() << "LastErrorMessage: " << QString::fromUtf8(query.LastErrorMessage().c_str());
++
+ m_validInfo = false;
+- }
++ }
+ catch (...)
+ {
+ kDebug() << "Caught Unknown Exception:";
+ m_validInfo = false;
+ }
+-
+- if (!m_validInfo)
+- {
+- // If invalid data, fill the information with something
+- // Sets info
+- m_discInfo.Title = i18n("Unknown album");
+- m_discInfo.Artist = i18n("Unknown artist");
+-
+- m_trackList.clear();
+- MBTrackInfo track;
+- for (MusicBrainz::Disc::TrackList::iterator j = disc->getTracks().begin(); j != disc->getTracks().end(); j++)
+- {
+- track.Title = i18n("Unknown title");
+- track.Artist = m_discInfo.Artist;
+- // time from mb library in sectors, 75 sectors = 1 second
+- track.Duration = (*j).second*1000/75;
+-
+- m_trackList << track;
+- }
+- }
+- delete disc;
+ }
+- // FIXME Doesn't seem to get caught, why?
+- catch (const MusicBrainz::DiscError &e)
+- {
+- kDebug() << "Error: " << e.what();
+- m_discInfo.Title = i18n("Unknown album");
+- m_discInfo.Artist = i18n("Unknown artist");
+- m_discInfo.Artist = i18n( "No Disc" );
+- m_trackList.clear();
+- }
+- catch(...)
++ else
++ {
++ m_validInfo = false;
++ }
++
++ if (!m_validInfo)
+ {
++ // If invalid data, fill the information with something
++ // Sets info
+ m_discInfo.Title = i18n("Unknown album");
+ m_discInfo.Artist = i18n("Unknown artist");
+- m_discInfo.Artist = i18n( "No Disc" );
++
+ m_trackList.clear();
++ if (discid_ok)
++ {
++ m_trackList = unknownTracks(m_discInfo.Artist, m_discid);
++ }
+ }
+-
++
+ emit discLookupFinished();
+ }
+
+-void MBManager::discUpload()
++void MBManager::discUpload(const QString &device)
+ {
+ showArtistLabel(m_discInfo.Artist);
++ const char *discid_device = device.isEmpty()? NULL : qPrintable(device);
+
+- try
++ int ok = discid_read_sparse(m_discid, discid_device, 0);
++ if (ok)
+ {
+- MusicBrainz::Disc *disc = MusicBrainz::readDisc();
+- std::string url = MusicBrainz::getSubmissionUrl(disc);
+- delete disc;
+-
+- KToolInvocation::invokeBrowser(QString::fromUtf8(url.c_str()));
++ QString url = QString::fromUtf8(discid_get_submission_url(m_discid));
++ KToolInvocation::invokeBrowser(url);
+ }
+- catch (MusicBrainz::DiscError &e)
++ else
+ {
+- kDebug() << "Error: " << e.what();
++ kDebug() << "Error: " << discid_get_error_msg(m_discid);
+ }
+ }
+-
+diff --git a/mbmanager.h b/mbmanager.h
+index 6b07e95..ea04153 100644
+--- a/mbmanager.h
++++ b/mbmanager.h
+@@ -42,6 +42,9 @@
+ #include <qstring.h>
+ #include <qlist.h>
+
++// musicbrainz discid
++#include <discid/discid.h>
++
+ struct DiscInfo
+ {
+ QString Title;
+@@ -64,6 +67,7 @@ private:
+ QList <MBTrackInfo> m_trackList; /// List of tracks information
+
+ bool m_validInfo; /// Tells whether the lookup query succeeded
++ DiscId *m_discid;
+
+ public:
+ MBManager();
+@@ -82,11 +86,11 @@ public slots:
+ void discLookup(const QString& device);
+
+ /** Uploads information */
+- void discUpload();
++ void discUpload(const QString& device=QString());
+
+ signals:
+ void showArtistLabel(QString&);
+-
++
+ void discLookupFinished();
+ };
+
diff --git a/kde-apps/kscd/kscd-17.08.2.ebuild b/kde-apps/kscd/kscd-17.08.3.ebuild
index f18eb8b5dedd..2f1018555dae 100644
--- a/kde-apps/kscd/kscd-17.08.2.ebuild
+++ b/kde-apps/kscd/kscd-17.08.3.ebuild
@@ -11,7 +11,9 @@ KEYWORDS="~amd64 ~x86"
IUSE="debug"
DEPEND="
- media-libs/musicbrainz:3
+ media-libs/musicbrainz:5
media-libs/phonon[qt4]
"
RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-musicbrainz5.patch" )