Commit dbba586e authored by Dirk Mueller's avatar Dirk Mueller

musicbrainz 0.4.x support. not tested.

svn path=/trunk/KDE/kdemultimedia/juk/; revision=499320
parent 5a1996b8
......@@ -35,7 +35,9 @@ if test "x$with_tunepimp" != xno; then
fi
if test "x$have_tunepimp" = xyes; then
AC_DEFINE(HAVE_TUNEPIMP, 1, [have TunePimp])
AC_CHECK_LIB(tunepimp, tp_SetFileNameEncoding,
AC_DEFINE(HAVE_TUNEPIMP, 4, [have MusicBrainz 0.4.x]),
AC_DEFINE(HAVE_TUNEPIMP, 1, [have MusicBrainz]))
else
AC_DEFINE(HAVE_TUNEPIMP, 0, [have TunePimp])
fi
......
......@@ -42,7 +42,11 @@ class KTRMLookup;
extern "C"
{
#if HAVE_TUNEPIMP >= 4
static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId, TPFileStatus status);
#else
static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId);
#endif
}
/**
......@@ -66,7 +70,11 @@ public:
int id;
if(!m_fileMap.contains(lookup->file())) {
#if HAVE_TUNEPIMP >= 4
id = tp_AddFile(m_pimp, QFile::encodeName(lookup->file()), 0);
#else
id = tp_AddFile(m_pimp, QFile::encodeName(lookup->file()));
#endif
m_fileMap.insert(lookup->file(), id);
}
else {
......@@ -120,7 +128,11 @@ protected:
tp_SetAutoSaveThreshold(m_pimp, -1);
tp_SetMoveFiles(m_pimp, false);
tp_SetRenameFiles(m_pimp, false);
#if HAVE_TUNEPIMP >= 4
tp_SetFileNameEncoding(m_pimp, "UTF-8");
#else
tp_SetUseUTF8(m_pimp, true);
#endif
tp_SetNotifyCallback(m_pimp, TRMNotifyCallback, 0);
if(KProtocolManager::useProxy()) {
......@@ -243,14 +255,19 @@ protected:
/**
* Callback fuction for TunePimp lookup events.
*/
static void TRMNotifyCallback(tunepimp_t pimp, void *, TPCallbackEnum type, int fileId)
#if HAVE_TUNEPIMP >= 4
static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId, TPFileStatus status)
#else
static void TRMNotifyCallback(tunepimp_t pimp, void *data, TPCallbackEnum type, int fileId)
#endif
{
if(type != tpFileChanged)
return;
track_t track = tp_GetTrack(pimp, fileId);
#if HAVE_TUNEPIMP < 4
TPFileStatus status = tr_GetStatus(track);
#endif
switch(status) {
case eRecognized:
......@@ -460,10 +477,16 @@ void KTRMLookup::collision()
KTRMResult result;
result.d->title = QString::fromUtf8(tracks[i]->name);
#if HAVE_TUNEPIMP >= 4
result.d->artist = QString::fromUtf8(tracks[i]->artist.name);
result.d->album = QString::fromUtf8(tracks[i]->album.name);
result.d->year = tracks[i]->album.releaseYear;
#else
result.d->artist = QString::fromUtf8(tracks[i]->artist->name);
result.d->album = QString::fromUtf8(tracks[i]->album->name);
result.d->track = tracks[i]->trackNum;
result.d->year = tracks[i]->album->releaseYear;
#endif
result.d->track = tracks[i]->trackNum;
result.d->relevance = tracks[i]->relevance;
d->results.append(result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment