1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00

- Update to 0.8.1

PR:		ports/106111
Submitted by:	Max Brazhnikov<makc@issp.ac.ru> (maintainer)
This commit is contained in:
Martin Wilke 2006-12-02 00:08:53 +00:00
parent a67c56803d
commit 4debeb3ac0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=178533
30 changed files with 14 additions and 2108 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= kid3
PORTVERSION= 0.7
PORTREVISION= 1
PORTVERSION= 0.8.1
CATEGORIES= audio kde
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}

View File

@ -1,3 +1,3 @@
MD5 (kid3-0.7.tar.gz) = e5f8262e3456d9b0bdba4e4b56ca3aee
SHA256 (kid3-0.7.tar.gz) = 05d01593f3b5cfd94fb4404cf7cc384a45b133595d6b9abc6cc43f67fe628a2b
SIZE (kid3-0.7.tar.gz) = 897741
MD5 (kid3-0.8.1.tar.gz) = df03e94061330e3ec088911727f85059
SHA256 (kid3-0.8.1.tar.gz) = fe922e75078d608df0b69c05b3130c03ffffab226ff1723271bf9dd8f9c3c3ba
SIZE (kid3-0.8.1.tar.gz) = 871390

View File

@ -1,232 +0,0 @@
--- ./configure.orig Tue Jun 27 22:55:03 2006
+++ ./configure Sat Sep 23 01:27:55 2006
@@ -31630,22 +31630,146 @@
fi;
if test "$with_musicbrainz" != "no"; then
+ if test "${ac_cv_header_tunepimp_0_5_tp_c_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for tunepimp-0.5/tp_c.h" >&5
+echo $ECHO_N "checking for tunepimp-0.5/tp_c.h... $ECHO_C" >&6
+if test "${ac_cv_header_tunepimp_0_5_tp_c_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_tunepimp_0_5_tp_c_h" >&5
+echo "${ECHO_T}$ac_cv_header_tunepimp_0_5_tp_c_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking tunepimp-0.5/tp_c.h usability" >&5
+echo $ECHO_N "checking tunepimp-0.5/tp_c.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <tunepimp-0.5/tp_c.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+# Is the header present?
+echo "$as_me:$LINENO: checking tunepimp-0.5/tp_c.h presence" >&5
+echo $ECHO_N "checking tunepimp-0.5/tp_c.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <tunepimp-0.5/tp_c.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
- kde_safe_cppflags=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS $all_includes"
- ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for tunepimp-0.5/tp_c.h" >&5
+echo $ECHO_N "checking for tunepimp-0.5/tp_c.h... $ECHO_C" >&6
+if test "${ac_cv_header_tunepimp_0_5_tp_c_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_tunepimp_0_5_tp_c_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_tunepimp_0_5_tp_c_h" >&5
+echo "${ECHO_T}$ac_cv_header_tunepimp_0_5_tp_c_h" >&6
- if test "${ac_cv_header_tunepimp_tp_c_h+set}" = set; then
+fi
+if test $ac_cv_header_tunepimp_0_5_tp_c_h = yes; then
+ build_musicbrainz="yes"
+else
+ if test "${ac_cv_header_tunepimp_tp_c_h+set}" = set; then
echo "$as_me:$LINENO: checking for tunepimp/tp_c.h" >&5
echo $ECHO_N "checking for tunepimp/tp_c.h... $ECHO_C" >&6
if test "${ac_cv_header_tunepimp_tp_c_h+set}" = set; then
@@ -31788,19 +31912,14 @@
fi
- CPPFLAGS=$kde_safe_cppflags
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+fi
fi
if test "$build_musicbrainz" = "yes"; then
- echo "$as_me:$LINENO: checking for tp_SetPUIDCollisionThreshold in -ltunepimp" >&5
-echo $ECHO_N "checking for tp_SetPUIDCollisionThreshold in -ltunepimp... $ECHO_C" >&6
-if test "${ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold+set}" = set; then
+ echo "$as_me:$LINENO: checking for tr_GetPUID in -ltunepimp" >&5
+echo $ECHO_N "checking for tr_GetPUID in -ltunepimp... $ECHO_C" >&6
+if test "${ac_cv_lib_tunepimp_tr_GetPUID+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -31818,11 +31937,11 @@
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char tp_SetPUIDCollisionThreshold ();
+char tr_GetPUID ();
int
main ()
{
-tp_SetPUIDCollisionThreshold ();
+tr_GetPUID ();
;
return 0;
}
@@ -31848,20 +31967,20 @@
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold=yes
+ ac_cv_lib_tunepimp_tr_GetPUID=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold=no
+ac_cv_lib_tunepimp_tr_GetPUID=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold" >&5
-echo "${ECHO_T}$ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold" >&6
-if test $ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_tunepimp_tr_GetPUID" >&5
+echo "${ECHO_T}$ac_cv_lib_tunepimp_tr_GetPUID" >&6
+if test $ac_cv_lib_tunepimp_tr_GetPUID = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_TUNEPIMP 5
@@ -31977,6 +32096,7 @@
fi;
if test "$with_vorbis" != "no"; then
+

View File

@ -1,101 +0,0 @@
+++ ./kid3/freedbclient.cpp 2006-05-28 15:05:28.000000000 +0200
+++ ./kid3/freedbclient.cpp 2006-10-07 21:32:21.000000000 +0200
@@ -21,6 +21,7 @@
#include <qregexp.h>
#include <qsocket.h>
#include <qstatusbar.h>
+#include <qurl.h>
#include "freedbconfig.h"
#include "freedbclient.h"
@@ -34,7 +35,8 @@
*
* @param sb status bar to display progress information.
*/
-FreedbClient::FreedbClient(QStatusBar *sb) : statusBar(sb)
+FreedbClient::FreedbClient(QStatusBar *sb) :
+ statusBar(sb), m_requestType(RT_None)
{
sock = new QSocket();
connect(sock, SIGNAL(hostFound()),
@@ -158,7 +160,39 @@
}
#endif
sock->connectToHost(dest, destPort);
- isAlbumRequest = false;
+ m_requestType = RT_FindFreedbSearch;
+
+ statusBar->message(i18n("Connecting..."));
+}
+
+/**
+ * Find keyword in freedb with "cddb album" command of freedb2.org.
+ *
+ * @param cfg freedb configuration
+ * @param what string with words to search
+ */
+void FreedbClient::findCddbAlbum(const FreedbConfig *cfg, QString what)
+{
+ QString destNamePort(getProxyOrDest(cfg, cfg->server));
+ QString dest;
+ int destPort;
+ splitNamePort(destNamePort, dest, destPort);
+ what.replace(QRegExp(" +"), " "); // collapse spaces
+ QUrl::encode(what);
+ what.replace("%20", "+"); // replace spaces by '+'
+ request = "GET http://" + cfg->server + cfg->cgiPath +
+ "?cmd=cddb+album+" + what + "&hello=noname+localhost+" +
+ "Kid3+" VERSION "&proto=1 HTTP/1.1\r\nHost: " + cfg->server +
+ "\r\nConnection: close\r\n\r\n";
+#if defined WIN32 && QT_VERSION < 300
+ int err = hostnameToAddress(dest);
+ if (err) {
+ statusBar->message(QString("WinSock error %1").arg(err));
+ return;
+ }
+#endif
+ sock->connectToHost(dest, destPort);
+ m_requestType = RT_FindCddbAlbum;
statusBar->message(i18n("Connecting..."));
}
@@ -186,14 +220,23 @@
*/
void FreedbClient::slotConnectionClosed()
{
- rcvStr = "";
- while (sock->canReadLine()) {
- rcvStr += sock->readLine();
- }
- if (isAlbumRequest) {
- emit albumFinished(rcvStr);
- } else {
- emit findFinished(rcvStr);
+ Q_ULONG len = sock->bytesAvailable();
+ QCString s;
+ s.resize(len + 1);
+ sock->readBlock(s.data(), len);
+ rcvStr = QString::fromUtf8(s.data());
+ switch (m_requestType) {
+ case RT_Album:
+ emit albumFinished(rcvStr);
+ break;
+ case RT_FindFreedbSearch:
+ emit findFinished(rcvStr);
+ break;
+ case RT_FindCddbAlbum:
+ emit findCddbAlbumFinished(rcvStr);
+ break;
+ default:
+ qWarning("Unknown freedb request type");
}
sock->close();
statusBar->message(i18n("Ready."));
@@ -256,6 +299,6 @@
}
#endif
sock->connectToHost(dest, destPort);
- isAlbumRequest = true;
+ m_requestType = RT_Album;
statusBar->message(i18n("Connecting..."));
}

View File

@ -1,44 +0,0 @@
+++ ./kid3/freedbclient.h 2006-01-05 19:15:21.000000000 +0100
+++ ./kid3/freedbclient.h 2006-10-07 16:06:53.000000000 +0200
@@ -44,6 +44,13 @@
*/
void find(const FreedbConfig *cfg, QString what);
/**
+ * Find keyword in freedb with "cddb album" command of freedb2.org.
+ *
+ * @param cfg freedb configuration
+ * @param what string with words to search
+ */
+ void findCddbAlbum(const FreedbConfig *cfg, QString what);
+ /**
* Request track list from freedb server.
*
* @param cfg freedb configuration
@@ -92,6 +99,11 @@
*/
void findFinished(QString);
/**
+ * Emitted when findCddbAlbum request finished.
+ * Parameter: text containing result of findCddbAlbum request
+ */
+ void findCddbAlbumFinished(QString);
+ /**
* Emitted when album track data request finished.
* Parameter: text containing result of album request
*/
@@ -105,8 +117,13 @@
QString request;
/** buffer for received data */
QString rcvStr;
- /** true if last request was album track data request */
- bool isAlbumRequest;
+ /** type of current request */
+ enum RequestType {
+ RT_None,
+ RT_FindFreedbSearch,
+ RT_FindCddbAlbum,
+ RT_Album
+ } m_requestType;
};
#endif

View File

@ -1,96 +0,0 @@
+++ ./kid3/freedbdialog.cpp 2006-02-23 22:48:14.000000000 +0100
+++ ./kid3/freedbdialog.cpp 2006-10-07 21:31:43.000000000 +0200
@@ -24,6 +24,7 @@
#include <qlistbox.h>
#include <qlabel.h>
#include <qstatusbar.h>
+#include <qregexp.h>
#include "freedbconfig.h"
#include "freedbclient.h"
#include "freedbdialog.h"
@@ -109,6 +110,7 @@
if (serverLayout && serverLabel && serverComboBox &&
cgiLabel && cgiLineEdit) {
static const char *serverList[] = {
+ "freedb2.org:80",
"freedb.freedb.org:80",
"at.freedb.org:80",
"au.freedb.org:80",
@@ -155,6 +157,8 @@
client = new FreedbClient(statusBar);
connect(client, SIGNAL(findFinished(QString)),
this, SLOT(slotFindFinished(QString)));
+ connect(client, SIGNAL(findCddbAlbumFinished(QString)),
+ this, SLOT(slotFindCddbAlbumFinished(QString)));
connect(client, SIGNAL(albumFinished(QString)),
this, SLOT(slotAlbumFinished(QString)));
}
@@ -315,7 +319,8 @@
{
FreedbConfig cfg;
getFreedbConfig(&cfg);
- client->find(&cfg, findLineEdit->currentText());
+// client->find(&cfg, findLineEdit->currentText());
+ client->findCddbAlbum(&cfg, findLineEdit->currentText());
}
/**
@@ -364,6 +369,58 @@
}
/**
+ * Process finished findCddbAlbum request.
+ *
+ * @param searchStr search data received
+ */
+void FreedbDialog::slotFindCddbAlbumFinished(QString searchStr)
+{
+/*
+210 exact matches found
+categ discid dtitle
+(more matches...)
+.
+or
+211 close matches found
+rock 920b810c Catharsis / Imago
+.
+theoretically, but never seen
+200 categ discid dtitle
+*/
+ QRegExp catIdTitleRe("([a-z]+)\\s+([0-9a-f]+)\\s+([^/]+ / .+)");
+ QStringList lines = QStringList::split(QRegExp("[\\r\\n]+"), searchStr);
+ bool inEntries = false;
+ albumListBox->clear();
+ for (QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it) {
+ if (*it == ".") {
+ break;
+ }
+ if (inEntries) {
+ if (catIdTitleRe.exactMatch(*it)) {
+ new AlbumListItem(
+ albumListBox,
+ catIdTitleRe.cap(3),
+ catIdTitleRe.cap(1),
+ catIdTitleRe.cap(2));
+ }
+ } else {
+ if ((*it).startsWith("21") && (*it).find(" match") != -1) {
+ inEntries = true;
+ } else if ((*it).startsWith("200 ")) {
+ if (catIdTitleRe.exactMatch((*it).mid(4))) {
+ new AlbumListItem(
+ albumListBox,
+ catIdTitleRe.cap(3),
+ catIdTitleRe.cap(1),
+ catIdTitleRe.cap(2));
+ }
+ }
+ }
+ }
+ albumListBox->setFocus();
+}
+
+/**
* Process finished album data.
*
* @param albumStr album track data received

View File

@ -1,15 +0,0 @@
+++ ./kid3/freedbdialog.h 2006-02-23 22:39:28.000000000 +0100
+++ ./kid3/freedbdialog.h 2006-10-07 17:19:08.000000000 +0200
@@ -117,6 +117,12 @@
*/
void slotFindFinished(QString searchStr);
/**
+ * Process finished findCddbAlbum request.
+ *
+ * @param searchStr search data received
+ */
+ void slotFindCddbAlbumFinished(QString searchStr);
+ /**
* Process finished album data.
*
* @param albumStr album track data received

View File

@ -1,11 +0,0 @@
--- ./kid3/genres.cpp.orig Thu May 25 19:58:19 2006
+++ ./kid3/genres.cpp Sat Sep 23 01:28:25 2006
@@ -385,7 +385,7 @@
* @return genre number, 255 for unknown index.
*/
-int Genres::getNumber(QString &str)
+int Genres::getNumber(const QString &str)
{
for (int i = 0; i < Genres::count + 1; i++) {
if (QString(genre[i]) == str) {

View File

@ -1,11 +0,0 @@
--- ./kid3/genres.h.orig Thu Jan 5 21:15:20 2006
+++ ./kid3/genres.h Sat Sep 23 01:28:25 2006
@@ -46,7 +46,7 @@
*
* @return genre number, 255 for unknown index.
*/
- static int getNumber(QString &str);
+ static int getNumber(const QString &str);
/** Number of genres */
#if defined _WIN32 || defined WIN32
enum { count = 148 };

View File

@ -1,11 +0,0 @@
--- ./kid3/id3form.cpp.orig Sat Jun 17 14:46:00 2006
+++ ./kid3/id3form.cpp Sat Sep 23 01:28:25 2006
@@ -588,7 +588,7 @@
st->track = trackV2CheckBox->isChecked() ? trackV2SpinBox->value()
: -1;
st->genre = genreV2CheckBox->isChecked() ?
- Genres::getNumber(genreV2ComboBox->currentItem()) : -1;
+ Genres::getNumber(genreV2ComboBox->currentText()) : -1;
st->genreStr = st->genre == 0xff ? genreV2ComboBox->currentText()
: QString::null;
}

View File

@ -1,14 +0,0 @@
--- ./kid3/mp3file.cpp.orig Thu Jan 5 21:15:21 2006
+++ ./kid3/mp3file.cpp Sat Sep 23 01:28:25 2006
@@ -365,6 +365,11 @@
if (!ok || n > 0xff) {
n = 0xff;
}
+ } else {
+ // ID3v2 genres can be stored as "(9)", "(9)Metal" or "Metal".
+ // If the string does not start with '(', try to get the genre number
+ // from a string containing a genre text.
+ n = Genres::getNumber(str);
}
return n;
}

View File

@ -1,356 +0,0 @@
--- ./kid3/musicbrainzclient.cpp.orig Tue Jun 6 00:18:36 2006
+++ ./kid3/musicbrainzclient.cpp Sat Sep 23 01:27:55 2006
@@ -17,10 +17,161 @@
#define I18N_NOOP(s) QT_TR_NOOP(s)
#endif
#include <qfile.h>
+#if HAVE_TUNEPIMP >= 5
+#include <qsocket.h>
+#include <qdom.h>
+#endif
#include "musicbrainzconfig.h"
#include "freedbclient.h"
#include "importtrackdata.h"
+#if HAVE_TUNEPIMP >= 5
+/**
+ * Constructor.
+ *
+ * @param numFiles number of files to be queried
+ * @param serverName server name
+ * @param serverPort server port
+ * @param proxyName proxy name, empty if no proxy
+ * @param proxyPort proxy port
+ */
+LookupQuery::LookupQuery(int numFiles,
+ const QString& serverName, Q_UINT16 serverPort,
+ const QString& proxyName, Q_UINT16 proxyPort) :
+ m_numFiles(numFiles), m_serverName(serverName), m_serverPort(serverPort),
+ m_proxyName(proxyName), m_proxyPort(proxyPort),
+ m_currentFile(-1), m_fileQueries(new FileQuery[numFiles]),
+ m_sock(new QSocket)
+{
+ for (int i = 0; i < m_numFiles; ++i) {
+ m_fileQueries[i].requested = false;
+ m_fileQueries[i].puid = "";
+ }
+ connect(m_sock, SIGNAL(connected()),
+ this, SLOT(socketConnected()));
+ connect(m_sock, SIGNAL(error(int)),
+ this, SLOT(socketError()));
+ connect(m_sock, SIGNAL(connectionClosed()),
+ this, SLOT(socketConnectionClosed()));
+}
+
+/**
+ * Destructor.
+ */
+LookupQuery::~LookupQuery()
+{
+ m_sock->close();
+ m_sock->disconnect();
+ delete m_sock;
+ delete [] m_fileQueries;
+}
+
+/**
+ * Connect to server to query information about the current file.
+ */
+void LookupQuery::socketQuery()
+{
+ if (m_currentFile >= 0 && m_currentFile < m_numFiles) {
+ QString destName = m_proxyName.isEmpty() ? m_serverName : m_proxyName;
+ Q_UINT16 destPort = m_proxyName.isEmpty() ? m_serverPort : m_proxyPort;
+ m_request = "GET http://";
+ m_request += m_serverName;
+ if (m_serverPort != 80) {
+ m_request += ':';
+ m_request += QString::number(m_serverPort);
+ }
+ m_request += "/ws/1/track/?type=xml&puid=";
+ m_request += m_fileQueries[m_currentFile].puid;
+ m_request += " HTTP/1.0\r\nHost: ";
+ m_request += m_serverName;
+ m_request += "\r\nUser-agent: Kid3/" VERSION "\r\n\r\n";
+ m_sock->connectToHost(destName, destPort);
+ m_fileQueries[m_currentFile].requested = true;
+ }
+}
+
+/**
+ * Query the next file.
+ */
+void LookupQuery::queryNext()
+{
+ // handle the first pending query
+ for (int i = 0; i < m_numFiles; ++i) {
+ if (!m_fileQueries[i].requested &&
+ !m_fileQueries[i].puid.isEmpty()) {
+ m_currentFile = i;
+ socketQuery();
+ return;
+ }
+ }
+ // no pending query => socketQuery() will be done in next query()
+ m_currentFile = -1;
+}
+
+/**
+ * Query a PUID from the server.
+ *
+ * @param puid PUID
+ * @param index index of file
+ */
+void LookupQuery::query(const char* puid, int index)
+{
+ m_fileQueries[index].puid = QString(puid);
+ // if no request is being executed, start the current request
+ if (m_currentFile < 0 || m_currentFile >= m_numFiles ||
+ !m_fileQueries[m_currentFile].requested) {
+ m_currentFile = index;
+ socketQuery();
+ }
+}
+
+/**
+ * Send query when the socket is connected.
+ */
+void LookupQuery::socketConnected()
+{
+ m_sock->writeBlock(m_request.latin1(), m_request.length());
+}
+
+/**
+ * Error on socket connection.
+ */
+void LookupQuery::socketError()
+{
+ queryNext();
+}
+
+/**
+ * Read received data when the server has closed the connection.
+ */
+void LookupQuery::socketConnectionClosed()
+{
+ Q_ULONG len = m_sock->bytesAvailable();
+ QCString buf;
+ buf.resize(len + 1 );
+ m_sock->readBlock(buf.data(), len);
+ m_sock->close();
+
+ int xmlStart = buf.find("<?xml");
+ if (xmlStart >= 0 &&
+ m_currentFile >= 0 && m_currentFile < m_numFiles &&
+ m_fileQueries[m_currentFile].requested) {
+ emit queryResponseReceived(m_currentFile, buf.mid(xmlStart, len - xmlStart));
+ }
+ queryNext();
+}
+
+#else
+
+LookupQuery::LookupQuery(int, const QString&, Q_UINT16, const QString&, Q_UINT16) {}
+LookupQuery::~LookupQuery() {}
+void LookupQuery::socketConnected() {}
+void LookupQuery::socketError() {}
+void LookupQuery::socketConnectionClosed() {}
+
+#endif
+
+
/**
* Constructor.
*
@@ -29,6 +180,9 @@
*/
MusicBrainzClient::MusicBrainzClient(ImportTrackDataVector& trackDataList) :
m_trackDataVector(trackDataList), m_tp(0), m_ids(0), m_numFiles(0)
+#if HAVE_TUNEPIMP >= 5
+ , m_lookupQuery(0)
+#endif
{
m_tp = tp_New("kid3", VERSION);
#ifdef WIN32
@@ -39,7 +193,11 @@
#else
tp_SetUseUTF8(m_tp, 1);
#endif
+#if HAVE_TUNEPIMP >= 5
+ tp_SetMusicDNSClientId(m_tp, "a95f5c7cd37fd4bce12dc86d196fb4fe");
+#else
tp_SetAutoFileLookup(m_tp, 1);
+#endif
tp_SetRenameFiles(m_tp, 0);
tp_SetMoveFiles(m_tp, 0);
tp_SetWriteID3v1(m_tp, 0);
@@ -110,8 +268,13 @@
{ eUnrecognized, I18N_NOOP("Unrecognized") },
{ eRecognized, I18N_NOOP("Recognized") },
{ ePending, I18N_NOOP("Pending") },
+#if HAVE_TUNEPIMP >= 5
+ { ePUIDLookup, I18N_NOOP("PUID Lookup") },
+ { ePUIDCollision, I18N_NOOP("PUID Collision") },
+#else
{ eTRMLookup, I18N_NOOP("TRM Lookup") },
{ eTRMCollision, I18N_NOOP("TRM Collision") },
+#endif
{ eFileLookup, I18N_NOOP("File Lookup") },
{ eUserSelection, I18N_NOOP("User Selection") },
{ eVerified, I18N_NOOP("Verified") },
@@ -163,7 +326,11 @@
track_t track = tp_GetTrack(m_tp, id);
if (track) {
tr_Lock(track);
+#if HAVE_TUNEPIMP >= 5
+ tr_GetPUID(track, trm, sizeof(trm));
+#else
tr_GetTRM(track, trm, sizeof(trm));
+#endif
if (trm[0] == '\0') {
tr_SetStatus(track, ePending);
tp_Wake(m_tp, track);
@@ -189,13 +356,33 @@
ImportTrackData trackData;
getMetaData(id, trackData);
emit metaDataReceived(index, trackData);
- } else if (statusCode == eTRMCollision ||
- statusCode == eUserSelection) {
+ }
+#if HAVE_TUNEPIMP >= 5
+ else if (statusCode == ePUIDLookup ||
+ statusCode == ePUIDCollision ||
+ statusCode == eFileLookup) {
+ char puid[255];
+ puid[0] = '\0';
+ track_t track = tp_GetTrack(m_tp, id);
+ if (track) {
+ tr_Lock(track);
+ tr_GetPUID(track, puid, sizeof(puid));
+ tr_Unlock(track);
+ tp_ReleaseTrack(m_tp, track);
+ }
+ if (m_lookupQuery) {
+ m_lookupQuery->query(puid, index);
+ }
+ }
+#else
+ else if (statusCode == eTRMCollision ||
+ statusCode == eUserSelection) {
ImportTrackDataVector trackDataList;
if (getResults(id, trackDataList)) {
emit resultsReceived(index, trackDataList);
}
}
+#endif
}
break;
}
@@ -242,6 +429,16 @@
m_numFiles = m_trackDataVector.count();
#endif
m_ids = new int[m_numFiles];
+#if HAVE_TUNEPIMP >= 5
+ char serverName[80], proxyName[80];
+ short serverPort, proxyPort;
+ tp_GetServer(m_tp, serverName, sizeof(serverName) - 1, &serverPort);
+ tp_GetProxy(m_tp, proxyName, sizeof(proxyName) - 1, &proxyPort);
+ m_lookupQuery = new LookupQuery(m_numFiles, serverName, serverPort,
+ proxyName, proxyPort);
+ connect(m_lookupQuery, SIGNAL(queryResponseReceived(int, const QCString&)),
+ this, SLOT(parseLookupResponse(int, const QCString&)));
+#endif
int i = 0;
for (
#if QT_VERSION >= 300
@@ -271,6 +468,10 @@
}
delete [] m_ids;
m_ids = 0;
+#if HAVE_TUNEPIMP >= 5
+ delete m_lookupQuery;
+ m_lookupQuery = 0;
+#endif
m_numFiles = 0;
}
}
@@ -308,6 +509,68 @@
}
}
+#if HAVE_TUNEPIMP >= 5
+
+bool MusicBrainzClient::getResults(int, ImportTrackDataVector&) {
+ return false;
+}
+
+/**
+ * Process server response with lookup data.
+ *
+ * @param index index of file
+ * @param response response from server
+ */
+void MusicBrainzClient::parseLookupResponse(int index, const QCString& response)
+{
+ ImportTrackDataVector trackDataList;
+ QDomDocument doc;
+ if (doc.setContent(response)) {
+ QDomElement trackList =
+ doc.namedItem("metadata").toElement().namedItem("track-list").toElement();
+
+ for (QDomNode trackNode = trackList.namedItem("track");
+ !trackNode.isNull();
+ trackNode = trackNode.nextSibling()) {
+ QDomElement track = trackNode.toElement();
+
+ ImportTrackData trackData;
+ trackData.artist =
+ track.namedItem("artist").toElement().namedItem("name").toElement().text();
+ trackData.title = track.namedItem("title").toElement().text();
+
+ for (QDomNode releaseNode =
+ track.namedItem("release-list").toElement().namedItem("release");
+ !releaseNode.isNull();
+ releaseNode = releaseNode.nextSibling() ) {
+ QDomElement release = releaseNode.toElement();
+
+ trackData.album = release.namedItem("title").toElement().text();
+ trackData.track = -1;
+ QDomNode releaseTrackNode = release.namedItem("track-list");
+ if (!releaseTrackNode.isNull()) {
+ QDomElement releaseTrack = releaseTrackNode.toElement();
+ if (!releaseTrack.attribute("offset").isEmpty())
+ trackData.track = releaseTrack.attribute("offset").toInt() + 1;
+ }
+ }
+ trackDataList.append(trackData);
+ }
+ }
+
+ if (trackDataList.size() > 1) {
+ emit resultsReceived(index, trackDataList);
+ emit statusChanged(index, i18n("User Selection"));
+ } else if (trackDataList.size() == 1) {
+ emit metaDataReceived(index, *trackDataList.begin());
+ emit statusChanged(index, i18n("Recognized"));
+ } else {
+ emit statusChanged(index, i18n("Unrecognized"));
+ }
+}
+
+#else
+
/**
* Get results for an ambiguous file.
*
@@ -387,6 +650,10 @@
}
return resultsAvailable;
}
+
+void MusicBrainzClient::parseLookupResponse(int, const QCString&) {}
+
+#endif
#else // HAVE_TUNEPIMP

View File

@ -1,146 +0,0 @@
--- ./kid3/musicbrainzclient.h.orig Thu Feb 23 22:48:34 2006
+++ ./kid3/musicbrainzclient.h Sat Sep 23 01:27:55 2006
@@ -15,7 +15,13 @@
#include <qobject.h>
#ifdef HAVE_TUNEPIMP
+#if HAVE_TUNEPIMP >= 5
+#include <qbuffer.h>
+#include <tunepimp-0.5/tp_c.h>
+class QSocket;
+#else
#include <tunepimp/tp_c.h>
+#endif
#endif // HAVE_TUNEPIMP
class MusicBrainzConfig;
@@ -23,6 +29,103 @@
class ImportTrackDataVector;
/**
+ * A HTTP query to a musicbrainz server for HAVE_TUNEPIMP >= 5.
+ */
+class LookupQuery : public QObject {
+Q_OBJECT
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param numFiles number of files to be queried
+ * @param serverName server name
+ * @param serverPort server port
+ * @param proxyName proxy name, empty if no proxy
+ * @param proxyPort proxy port
+ */
+ LookupQuery(int numFiles,
+ const QString& serverName, Q_UINT16 serverPort = 80,
+ const QString& proxyName = "", Q_UINT16 proxyPort = 80);
+
+ /**
+ * Destructor.
+ */
+ virtual ~LookupQuery();
+
+#if HAVE_TUNEPIMP >= 5
+ /**
+ * Query a PUID from the server.
+ *
+ * @param puid PUID
+ * @param index index of file
+ */
+ void query(const char* puid, int index);
+#endif
+
+signals:
+ /**
+ * Emitted when the query response is received
+ */
+ void queryResponseReceived(int, const QCString&);
+
+private slots:
+ /**
+ * Send query when the socket is connected.
+ */
+ void socketConnected();
+
+ /**
+ * Error on socket connection.
+ */
+ void socketError();
+
+ /**
+ * Read received data when the server has closed the connection.
+ */
+ void socketConnectionClosed();
+
+#if HAVE_TUNEPIMP >= 5
+private:
+ /**
+ * Connect to server to query information about the current file.
+ */
+ void socketQuery();
+
+ /**
+ * Query the next file.
+ */
+ void queryNext();
+
+ struct FileQuery {
+ bool requested;
+ QString puid;
+ };
+
+ /** Number of files to be queried. */
+ int m_numFiles;
+ /** MusicBrainz server */
+ QString m_serverName;
+ /** Port of MusicBrainz server */
+ Q_UINT16 m_serverPort;
+ /** Proxy */
+ QString m_proxyName;
+ /** Port of proxy */
+ Q_UINT16 m_proxyPort;
+ /**
+ * -1 if not yet started,
+ * 0..m_numFiles-1 if a file is currently processed,
+ * >=m_numFiles if all files processed.
+ */
+ int m_currentFile;
+ FileQuery* m_fileQueries;
+ QSocket* m_sock;
+ QString m_request;
+#endif
+};
+
+
+/**
* MusicBrainz client.
*/
class MusicBrainzClient : public QObject
@@ -85,6 +188,15 @@
*/
void resultsReceived(int, ImportTrackDataVector&);
+private slots:
+ /**
+ * Process server response with lookup data.
+ *
+ * @param index index of file
+ * @param response response from server
+ */
+ void parseLookupResponse(int index, const QCString& response);
+
#ifdef HAVE_TUNEPIMP
private:
/**
@@ -126,6 +238,9 @@
tunepimp_t m_tp;
int* m_ids;
int m_numFiles;
+#if HAVE_TUNEPIMP >= 5
+ LookupQuery* m_lookupQuery;
+#endif
#endif // HAVE_TUNEPIMP
};

View File

@ -1,11 +0,0 @@
--- ./kid3/oggfile.cpp.orig Fri Jan 27 21:15:27 2006
+++ ./kid3/oggfile.cpp Sat Sep 23 01:27:49 2006
@@ -143,7 +143,7 @@
bool setUtime = false;
struct utimbuf times;
if (preserve) {
- int fd = ::fileno(fpIn);
+ int fd = fileno(fpIn);
if (fd >= 0) {
struct stat fileStat;
if (::fstat(fd, &fileStat) == 0) {

View File

@ -1,5 +1,5 @@
bin/kid3
share/applnk/Multimedia/kid3.desktop
share/applications/kde/kid3.desktop
share/apps/kid3/kid3ui.rc
share/doc/HTML/de/kid3/common
share/doc/HTML/de/kid3/index.cache.bz2
@ -10,9 +10,11 @@ share/doc/HTML/en/kid3/index.docbook
share/icons/hicolor/16x16/apps/kid3.png
share/icons/hicolor/32x32/apps/kid3.png
share/icons/hicolor/48x48/apps/kid3.png
share/icons/hicolor/scalable/apps/kid3.svgz
share/locale/de/LC_MESSAGES/kid3.mo
share/locale/es/LC_MESSAGES/kid3.mo
share/locale/ru/LC_MESSAGES/kid3.mo
@dirrm share/doc/HTML/en/kid3
@dirrm share/doc/HTML/de/kid3
@dirrm share/apps/kid3
@dirrmtry share/applications/kde

View File

@ -6,8 +6,7 @@
#
PORTNAME= kid3
PORTVERSION= 0.7
PORTREVISION= 1
PORTVERSION= 0.8.1
CATEGORIES= audio kde
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}

View File

@ -1,3 +1,3 @@
MD5 (kid3-0.7.tar.gz) = e5f8262e3456d9b0bdba4e4b56ca3aee
SHA256 (kid3-0.7.tar.gz) = 05d01593f3b5cfd94fb4404cf7cc384a45b133595d6b9abc6cc43f67fe628a2b
SIZE (kid3-0.7.tar.gz) = 897741
MD5 (kid3-0.8.1.tar.gz) = df03e94061330e3ec088911727f85059
SHA256 (kid3-0.8.1.tar.gz) = fe922e75078d608df0b69c05b3130c03ffffab226ff1723271bf9dd8f9c3c3ba
SIZE (kid3-0.8.1.tar.gz) = 871390

View File

@ -1,232 +0,0 @@
--- ./configure.orig Tue Jun 27 22:55:03 2006
+++ ./configure Sat Sep 23 01:27:55 2006
@@ -31630,22 +31630,146 @@
fi;
if test "$with_musicbrainz" != "no"; then
+ if test "${ac_cv_header_tunepimp_0_5_tp_c_h+set}" = set; then
+ echo "$as_me:$LINENO: checking for tunepimp-0.5/tp_c.h" >&5
+echo $ECHO_N "checking for tunepimp-0.5/tp_c.h... $ECHO_C" >&6
+if test "${ac_cv_header_tunepimp_0_5_tp_c_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_tunepimp_0_5_tp_c_h" >&5
+echo "${ECHO_T}$ac_cv_header_tunepimp_0_5_tp_c_h" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking tunepimp-0.5/tp_c.h usability" >&5
+echo $ECHO_N "checking tunepimp-0.5/tp_c.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <tunepimp-0.5/tp_c.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+# Is the header present?
+echo "$as_me:$LINENO: checking tunepimp-0.5/tp_c.h presence" >&5
+echo $ECHO_N "checking tunepimp-0.5/tp_c.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <tunepimp-0.5/tp_c.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
- kde_safe_cppflags=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS $all_includes"
- ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tunepimp-0.5/tp_c.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tunepimp-0.5/tp_c.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for tunepimp-0.5/tp_c.h" >&5
+echo $ECHO_N "checking for tunepimp-0.5/tp_c.h... $ECHO_C" >&6
+if test "${ac_cv_header_tunepimp_0_5_tp_c_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_tunepimp_0_5_tp_c_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_tunepimp_0_5_tp_c_h" >&5
+echo "${ECHO_T}$ac_cv_header_tunepimp_0_5_tp_c_h" >&6
- if test "${ac_cv_header_tunepimp_tp_c_h+set}" = set; then
+fi
+if test $ac_cv_header_tunepimp_0_5_tp_c_h = yes; then
+ build_musicbrainz="yes"
+else
+ if test "${ac_cv_header_tunepimp_tp_c_h+set}" = set; then
echo "$as_me:$LINENO: checking for tunepimp/tp_c.h" >&5
echo $ECHO_N "checking for tunepimp/tp_c.h... $ECHO_C" >&6
if test "${ac_cv_header_tunepimp_tp_c_h+set}" = set; then
@@ -31788,19 +31912,14 @@
fi
- CPPFLAGS=$kde_safe_cppflags
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+fi
fi
if test "$build_musicbrainz" = "yes"; then
- echo "$as_me:$LINENO: checking for tp_SetPUIDCollisionThreshold in -ltunepimp" >&5
-echo $ECHO_N "checking for tp_SetPUIDCollisionThreshold in -ltunepimp... $ECHO_C" >&6
-if test "${ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold+set}" = set; then
+ echo "$as_me:$LINENO: checking for tr_GetPUID in -ltunepimp" >&5
+echo $ECHO_N "checking for tr_GetPUID in -ltunepimp... $ECHO_C" >&6
+if test "${ac_cv_lib_tunepimp_tr_GetPUID+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -31818,11 +31937,11 @@
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char tp_SetPUIDCollisionThreshold ();
+char tr_GetPUID ();
int
main ()
{
-tp_SetPUIDCollisionThreshold ();
+tr_GetPUID ();
;
return 0;
}
@@ -31848,20 +31967,20 @@
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold=yes
+ ac_cv_lib_tunepimp_tr_GetPUID=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold=no
+ac_cv_lib_tunepimp_tr_GetPUID=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold" >&5
-echo "${ECHO_T}$ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold" >&6
-if test $ac_cv_lib_tunepimp_tp_SetPUIDCollisionThreshold = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_tunepimp_tr_GetPUID" >&5
+echo "${ECHO_T}$ac_cv_lib_tunepimp_tr_GetPUID" >&6
+if test $ac_cv_lib_tunepimp_tr_GetPUID = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_TUNEPIMP 5
@@ -31977,6 +32096,7 @@
fi;
if test "$with_vorbis" != "no"; then
+

View File

@ -1,101 +0,0 @@
+++ ./kid3/freedbclient.cpp 2006-05-28 15:05:28.000000000 +0200
+++ ./kid3/freedbclient.cpp 2006-10-07 21:32:21.000000000 +0200
@@ -21,6 +21,7 @@
#include <qregexp.h>
#include <qsocket.h>
#include <qstatusbar.h>
+#include <qurl.h>
#include "freedbconfig.h"
#include "freedbclient.h"
@@ -34,7 +35,8 @@
*
* @param sb status bar to display progress information.
*/
-FreedbClient::FreedbClient(QStatusBar *sb) : statusBar(sb)
+FreedbClient::FreedbClient(QStatusBar *sb) :
+ statusBar(sb), m_requestType(RT_None)
{
sock = new QSocket();
connect(sock, SIGNAL(hostFound()),
@@ -158,7 +160,39 @@
}
#endif
sock->connectToHost(dest, destPort);
- isAlbumRequest = false;
+ m_requestType = RT_FindFreedbSearch;
+
+ statusBar->message(i18n("Connecting..."));
+}
+
+/**
+ * Find keyword in freedb with "cddb album" command of freedb2.org.
+ *
+ * @param cfg freedb configuration
+ * @param what string with words to search
+ */
+void FreedbClient::findCddbAlbum(const FreedbConfig *cfg, QString what)
+{
+ QString destNamePort(getProxyOrDest(cfg, cfg->server));
+ QString dest;
+ int destPort;
+ splitNamePort(destNamePort, dest, destPort);
+ what.replace(QRegExp(" +"), " "); // collapse spaces
+ QUrl::encode(what);
+ what.replace("%20", "+"); // replace spaces by '+'
+ request = "GET http://" + cfg->server + cfg->cgiPath +
+ "?cmd=cddb+album+" + what + "&hello=noname+localhost+" +
+ "Kid3+" VERSION "&proto=1 HTTP/1.1\r\nHost: " + cfg->server +
+ "\r\nConnection: close\r\n\r\n";
+#if defined WIN32 && QT_VERSION < 300
+ int err = hostnameToAddress(dest);
+ if (err) {
+ statusBar->message(QString("WinSock error %1").arg(err));
+ return;
+ }
+#endif
+ sock->connectToHost(dest, destPort);
+ m_requestType = RT_FindCddbAlbum;
statusBar->message(i18n("Connecting..."));
}
@@ -186,14 +220,23 @@
*/
void FreedbClient::slotConnectionClosed()
{
- rcvStr = "";
- while (sock->canReadLine()) {
- rcvStr += sock->readLine();
- }
- if (isAlbumRequest) {
- emit albumFinished(rcvStr);
- } else {
- emit findFinished(rcvStr);
+ Q_ULONG len = sock->bytesAvailable();
+ QCString s;
+ s.resize(len + 1);
+ sock->readBlock(s.data(), len);
+ rcvStr = QString::fromUtf8(s.data());
+ switch (m_requestType) {
+ case RT_Album:
+ emit albumFinished(rcvStr);
+ break;
+ case RT_FindFreedbSearch:
+ emit findFinished(rcvStr);
+ break;
+ case RT_FindCddbAlbum:
+ emit findCddbAlbumFinished(rcvStr);
+ break;
+ default:
+ qWarning("Unknown freedb request type");
}
sock->close();
statusBar->message(i18n("Ready."));
@@ -256,6 +299,6 @@
}
#endif
sock->connectToHost(dest, destPort);
- isAlbumRequest = true;
+ m_requestType = RT_Album;
statusBar->message(i18n("Connecting..."));
}

View File

@ -1,44 +0,0 @@
+++ ./kid3/freedbclient.h 2006-01-05 19:15:21.000000000 +0100
+++ ./kid3/freedbclient.h 2006-10-07 16:06:53.000000000 +0200
@@ -44,6 +44,13 @@
*/
void find(const FreedbConfig *cfg, QString what);
/**
+ * Find keyword in freedb with "cddb album" command of freedb2.org.
+ *
+ * @param cfg freedb configuration
+ * @param what string with words to search
+ */
+ void findCddbAlbum(const FreedbConfig *cfg, QString what);
+ /**
* Request track list from freedb server.
*
* @param cfg freedb configuration
@@ -92,6 +99,11 @@
*/
void findFinished(QString);
/**
+ * Emitted when findCddbAlbum request finished.
+ * Parameter: text containing result of findCddbAlbum request
+ */
+ void findCddbAlbumFinished(QString);
+ /**
* Emitted when album track data request finished.
* Parameter: text containing result of album request
*/
@@ -105,8 +117,13 @@
QString request;
/** buffer for received data */
QString rcvStr;
- /** true if last request was album track data request */
- bool isAlbumRequest;
+ /** type of current request */
+ enum RequestType {
+ RT_None,
+ RT_FindFreedbSearch,
+ RT_FindCddbAlbum,
+ RT_Album
+ } m_requestType;
};
#endif

View File

@ -1,96 +0,0 @@
+++ ./kid3/freedbdialog.cpp 2006-02-23 22:48:14.000000000 +0100
+++ ./kid3/freedbdialog.cpp 2006-10-07 21:31:43.000000000 +0200
@@ -24,6 +24,7 @@
#include <qlistbox.h>
#include <qlabel.h>
#include <qstatusbar.h>
+#include <qregexp.h>
#include "freedbconfig.h"
#include "freedbclient.h"
#include "freedbdialog.h"
@@ -109,6 +110,7 @@
if (serverLayout && serverLabel && serverComboBox &&
cgiLabel && cgiLineEdit) {
static const char *serverList[] = {
+ "freedb2.org:80",
"freedb.freedb.org:80",
"at.freedb.org:80",
"au.freedb.org:80",
@@ -155,6 +157,8 @@
client = new FreedbClient(statusBar);
connect(client, SIGNAL(findFinished(QString)),
this, SLOT(slotFindFinished(QString)));
+ connect(client, SIGNAL(findCddbAlbumFinished(QString)),
+ this, SLOT(slotFindCddbAlbumFinished(QString)));
connect(client, SIGNAL(albumFinished(QString)),
this, SLOT(slotAlbumFinished(QString)));
}
@@ -315,7 +319,8 @@
{
FreedbConfig cfg;
getFreedbConfig(&cfg);
- client->find(&cfg, findLineEdit->currentText());
+// client->find(&cfg, findLineEdit->currentText());
+ client->findCddbAlbum(&cfg, findLineEdit->currentText());
}
/**
@@ -364,6 +369,58 @@
}
/**
+ * Process finished findCddbAlbum request.
+ *
+ * @param searchStr search data received
+ */
+void FreedbDialog::slotFindCddbAlbumFinished(QString searchStr)
+{
+/*
+210 exact matches found
+categ discid dtitle
+(more matches...)
+.
+or
+211 close matches found
+rock 920b810c Catharsis / Imago
+.
+theoretically, but never seen
+200 categ discid dtitle
+*/
+ QRegExp catIdTitleRe("([a-z]+)\\s+([0-9a-f]+)\\s+([^/]+ / .+)");
+ QStringList lines = QStringList::split(QRegExp("[\\r\\n]+"), searchStr);
+ bool inEntries = false;
+ albumListBox->clear();
+ for (QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it) {
+ if (*it == ".") {
+ break;
+ }
+ if (inEntries) {
+ if (catIdTitleRe.exactMatch(*it)) {
+ new AlbumListItem(
+ albumListBox,
+ catIdTitleRe.cap(3),
+ catIdTitleRe.cap(1),
+ catIdTitleRe.cap(2));
+ }
+ } else {
+ if ((*it).startsWith("21") && (*it).find(" match") != -1) {
+ inEntries = true;
+ } else if ((*it).startsWith("200 ")) {
+ if (catIdTitleRe.exactMatch((*it).mid(4))) {
+ new AlbumListItem(
+ albumListBox,
+ catIdTitleRe.cap(3),
+ catIdTitleRe.cap(1),
+ catIdTitleRe.cap(2));
+ }
+ }
+ }
+ }
+ albumListBox->setFocus();
+}
+
+/**
* Process finished album data.
*
* @param albumStr album track data received

View File

@ -1,15 +0,0 @@
+++ ./kid3/freedbdialog.h 2006-02-23 22:39:28.000000000 +0100
+++ ./kid3/freedbdialog.h 2006-10-07 17:19:08.000000000 +0200
@@ -117,6 +117,12 @@
*/
void slotFindFinished(QString searchStr);
/**
+ * Process finished findCddbAlbum request.
+ *
+ * @param searchStr search data received
+ */
+ void slotFindCddbAlbumFinished(QString searchStr);
+ /**
* Process finished album data.
*
* @param albumStr album track data received

View File

@ -1,11 +0,0 @@
--- ./kid3/genres.cpp.orig Thu May 25 19:58:19 2006
+++ ./kid3/genres.cpp Sat Sep 23 01:28:25 2006
@@ -385,7 +385,7 @@
* @return genre number, 255 for unknown index.
*/
-int Genres::getNumber(QString &str)
+int Genres::getNumber(const QString &str)
{
for (int i = 0; i < Genres::count + 1; i++) {
if (QString(genre[i]) == str) {

View File

@ -1,11 +0,0 @@
--- ./kid3/genres.h.orig Thu Jan 5 21:15:20 2006
+++ ./kid3/genres.h Sat Sep 23 01:28:25 2006
@@ -46,7 +46,7 @@
*
* @return genre number, 255 for unknown index.
*/
- static int getNumber(QString &str);
+ static int getNumber(const QString &str);
/** Number of genres */
#if defined _WIN32 || defined WIN32
enum { count = 148 };

View File

@ -1,11 +0,0 @@
--- ./kid3/id3form.cpp.orig Sat Jun 17 14:46:00 2006
+++ ./kid3/id3form.cpp Sat Sep 23 01:28:25 2006
@@ -588,7 +588,7 @@
st->track = trackV2CheckBox->isChecked() ? trackV2SpinBox->value()
: -1;
st->genre = genreV2CheckBox->isChecked() ?
- Genres::getNumber(genreV2ComboBox->currentItem()) : -1;
+ Genres::getNumber(genreV2ComboBox->currentText()) : -1;
st->genreStr = st->genre == 0xff ? genreV2ComboBox->currentText()
: QString::null;
}

View File

@ -1,14 +0,0 @@
--- ./kid3/mp3file.cpp.orig Thu Jan 5 21:15:21 2006
+++ ./kid3/mp3file.cpp Sat Sep 23 01:28:25 2006
@@ -365,6 +365,11 @@
if (!ok || n > 0xff) {
n = 0xff;
}
+ } else {
+ // ID3v2 genres can be stored as "(9)", "(9)Metal" or "Metal".
+ // If the string does not start with '(', try to get the genre number
+ // from a string containing a genre text.
+ n = Genres::getNumber(str);
}
return n;
}

View File

@ -1,356 +0,0 @@
--- ./kid3/musicbrainzclient.cpp.orig Tue Jun 6 00:18:36 2006
+++ ./kid3/musicbrainzclient.cpp Sat Sep 23 01:27:55 2006
@@ -17,10 +17,161 @@
#define I18N_NOOP(s) QT_TR_NOOP(s)
#endif
#include <qfile.h>
+#if HAVE_TUNEPIMP >= 5
+#include <qsocket.h>
+#include <qdom.h>
+#endif
#include "musicbrainzconfig.h"
#include "freedbclient.h"
#include "importtrackdata.h"
+#if HAVE_TUNEPIMP >= 5
+/**
+ * Constructor.
+ *
+ * @param numFiles number of files to be queried
+ * @param serverName server name
+ * @param serverPort server port
+ * @param proxyName proxy name, empty if no proxy
+ * @param proxyPort proxy port
+ */
+LookupQuery::LookupQuery(int numFiles,
+ const QString& serverName, Q_UINT16 serverPort,
+ const QString& proxyName, Q_UINT16 proxyPort) :
+ m_numFiles(numFiles), m_serverName(serverName), m_serverPort(serverPort),
+ m_proxyName(proxyName), m_proxyPort(proxyPort),
+ m_currentFile(-1), m_fileQueries(new FileQuery[numFiles]),
+ m_sock(new QSocket)
+{
+ for (int i = 0; i < m_numFiles; ++i) {
+ m_fileQueries[i].requested = false;
+ m_fileQueries[i].puid = "";
+ }
+ connect(m_sock, SIGNAL(connected()),
+ this, SLOT(socketConnected()));
+ connect(m_sock, SIGNAL(error(int)),
+ this, SLOT(socketError()));
+ connect(m_sock, SIGNAL(connectionClosed()),
+ this, SLOT(socketConnectionClosed()));
+}
+
+/**
+ * Destructor.
+ */
+LookupQuery::~LookupQuery()
+{
+ m_sock->close();
+ m_sock->disconnect();
+ delete m_sock;
+ delete [] m_fileQueries;
+}
+
+/**
+ * Connect to server to query information about the current file.
+ */
+void LookupQuery::socketQuery()
+{
+ if (m_currentFile >= 0 && m_currentFile < m_numFiles) {
+ QString destName = m_proxyName.isEmpty() ? m_serverName : m_proxyName;
+ Q_UINT16 destPort = m_proxyName.isEmpty() ? m_serverPort : m_proxyPort;
+ m_request = "GET http://";
+ m_request += m_serverName;
+ if (m_serverPort != 80) {
+ m_request += ':';
+ m_request += QString::number(m_serverPort);
+ }
+ m_request += "/ws/1/track/?type=xml&puid=";
+ m_request += m_fileQueries[m_currentFile].puid;
+ m_request += " HTTP/1.0\r\nHost: ";
+ m_request += m_serverName;
+ m_request += "\r\nUser-agent: Kid3/" VERSION "\r\n\r\n";
+ m_sock->connectToHost(destName, destPort);
+ m_fileQueries[m_currentFile].requested = true;
+ }
+}
+
+/**
+ * Query the next file.
+ */
+void LookupQuery::queryNext()
+{
+ // handle the first pending query
+ for (int i = 0; i < m_numFiles; ++i) {
+ if (!m_fileQueries[i].requested &&
+ !m_fileQueries[i].puid.isEmpty()) {
+ m_currentFile = i;
+ socketQuery();
+ return;
+ }
+ }
+ // no pending query => socketQuery() will be done in next query()
+ m_currentFile = -1;
+}
+
+/**
+ * Query a PUID from the server.
+ *
+ * @param puid PUID
+ * @param index index of file
+ */
+void LookupQuery::query(const char* puid, int index)
+{
+ m_fileQueries[index].puid = QString(puid);
+ // if no request is being executed, start the current request
+ if (m_currentFile < 0 || m_currentFile >= m_numFiles ||
+ !m_fileQueries[m_currentFile].requested) {
+ m_currentFile = index;
+ socketQuery();
+ }
+}
+
+/**
+ * Send query when the socket is connected.
+ */
+void LookupQuery::socketConnected()
+{
+ m_sock->writeBlock(m_request.latin1(), m_request.length());
+}
+
+/**
+ * Error on socket connection.
+ */
+void LookupQuery::socketError()
+{
+ queryNext();
+}
+
+/**
+ * Read received data when the server has closed the connection.
+ */
+void LookupQuery::socketConnectionClosed()
+{
+ Q_ULONG len = m_sock->bytesAvailable();
+ QCString buf;
+ buf.resize(len + 1 );
+ m_sock->readBlock(buf.data(), len);
+ m_sock->close();
+
+ int xmlStart = buf.find("<?xml");
+ if (xmlStart >= 0 &&
+ m_currentFile >= 0 && m_currentFile < m_numFiles &&
+ m_fileQueries[m_currentFile].requested) {
+ emit queryResponseReceived(m_currentFile, buf.mid(xmlStart, len - xmlStart));
+ }
+ queryNext();
+}
+
+#else
+
+LookupQuery::LookupQuery(int, const QString&, Q_UINT16, const QString&, Q_UINT16) {}
+LookupQuery::~LookupQuery() {}
+void LookupQuery::socketConnected() {}
+void LookupQuery::socketError() {}
+void LookupQuery::socketConnectionClosed() {}
+
+#endif
+
+
/**
* Constructor.
*
@@ -29,6 +180,9 @@
*/
MusicBrainzClient::MusicBrainzClient(ImportTrackDataVector& trackDataList) :
m_trackDataVector(trackDataList), m_tp(0), m_ids(0), m_numFiles(0)
+#if HAVE_TUNEPIMP >= 5
+ , m_lookupQuery(0)
+#endif
{
m_tp = tp_New("kid3", VERSION);
#ifdef WIN32
@@ -39,7 +193,11 @@
#else
tp_SetUseUTF8(m_tp, 1);
#endif
+#if HAVE_TUNEPIMP >= 5
+ tp_SetMusicDNSClientId(m_tp, "a95f5c7cd37fd4bce12dc86d196fb4fe");
+#else
tp_SetAutoFileLookup(m_tp, 1);
+#endif
tp_SetRenameFiles(m_tp, 0);
tp_SetMoveFiles(m_tp, 0);
tp_SetWriteID3v1(m_tp, 0);
@@ -110,8 +268,13 @@
{ eUnrecognized, I18N_NOOP("Unrecognized") },
{ eRecognized, I18N_NOOP("Recognized") },
{ ePending, I18N_NOOP("Pending") },
+#if HAVE_TUNEPIMP >= 5
+ { ePUIDLookup, I18N_NOOP("PUID Lookup") },
+ { ePUIDCollision, I18N_NOOP("PUID Collision") },
+#else
{ eTRMLookup, I18N_NOOP("TRM Lookup") },
{ eTRMCollision, I18N_NOOP("TRM Collision") },
+#endif
{ eFileLookup, I18N_NOOP("File Lookup") },
{ eUserSelection, I18N_NOOP("User Selection") },
{ eVerified, I18N_NOOP("Verified") },
@@ -163,7 +326,11 @@
track_t track = tp_GetTrack(m_tp, id);
if (track) {
tr_Lock(track);
+#if HAVE_TUNEPIMP >= 5
+ tr_GetPUID(track, trm, sizeof(trm));
+#else
tr_GetTRM(track, trm, sizeof(trm));
+#endif
if (trm[0] == '\0') {
tr_SetStatus(track, ePending);
tp_Wake(m_tp, track);
@@ -189,13 +356,33 @@
ImportTrackData trackData;
getMetaData(id, trackData);
emit metaDataReceived(index, trackData);
- } else if (statusCode == eTRMCollision ||
- statusCode == eUserSelection) {
+ }
+#if HAVE_TUNEPIMP >= 5
+ else if (statusCode == ePUIDLookup ||
+ statusCode == ePUIDCollision ||
+ statusCode == eFileLookup) {
+ char puid[255];
+ puid[0] = '\0';
+ track_t track = tp_GetTrack(m_tp, id);
+ if (track) {
+ tr_Lock(track);
+ tr_GetPUID(track, puid, sizeof(puid));
+ tr_Unlock(track);
+ tp_ReleaseTrack(m_tp, track);
+ }
+ if (m_lookupQuery) {
+ m_lookupQuery->query(puid, index);
+ }
+ }
+#else
+ else if (statusCode == eTRMCollision ||
+ statusCode == eUserSelection) {
ImportTrackDataVector trackDataList;
if (getResults(id, trackDataList)) {
emit resultsReceived(index, trackDataList);
}
}
+#endif
}
break;
}
@@ -242,6 +429,16 @@
m_numFiles = m_trackDataVector.count();
#endif
m_ids = new int[m_numFiles];
+#if HAVE_TUNEPIMP >= 5
+ char serverName[80], proxyName[80];
+ short serverPort, proxyPort;
+ tp_GetServer(m_tp, serverName, sizeof(serverName) - 1, &serverPort);
+ tp_GetProxy(m_tp, proxyName, sizeof(proxyName) - 1, &proxyPort);
+ m_lookupQuery = new LookupQuery(m_numFiles, serverName, serverPort,
+ proxyName, proxyPort);
+ connect(m_lookupQuery, SIGNAL(queryResponseReceived(int, const QCString&)),
+ this, SLOT(parseLookupResponse(int, const QCString&)));
+#endif
int i = 0;
for (
#if QT_VERSION >= 300
@@ -271,6 +468,10 @@
}
delete [] m_ids;
m_ids = 0;
+#if HAVE_TUNEPIMP >= 5
+ delete m_lookupQuery;
+ m_lookupQuery = 0;
+#endif
m_numFiles = 0;
}
}
@@ -308,6 +509,68 @@
}
}
+#if HAVE_TUNEPIMP >= 5
+
+bool MusicBrainzClient::getResults(int, ImportTrackDataVector&) {
+ return false;
+}
+
+/**
+ * Process server response with lookup data.
+ *
+ * @param index index of file
+ * @param response response from server
+ */
+void MusicBrainzClient::parseLookupResponse(int index, const QCString& response)
+{
+ ImportTrackDataVector trackDataList;
+ QDomDocument doc;
+ if (doc.setContent(response)) {
+ QDomElement trackList =
+ doc.namedItem("metadata").toElement().namedItem("track-list").toElement();
+
+ for (QDomNode trackNode = trackList.namedItem("track");
+ !trackNode.isNull();
+ trackNode = trackNode.nextSibling()) {
+ QDomElement track = trackNode.toElement();
+
+ ImportTrackData trackData;
+ trackData.artist =
+ track.namedItem("artist").toElement().namedItem("name").toElement().text();
+ trackData.title = track.namedItem("title").toElement().text();
+
+ for (QDomNode releaseNode =
+ track.namedItem("release-list").toElement().namedItem("release");
+ !releaseNode.isNull();
+ releaseNode = releaseNode.nextSibling() ) {
+ QDomElement release = releaseNode.toElement();
+
+ trackData.album = release.namedItem("title").toElement().text();
+ trackData.track = -1;
+ QDomNode releaseTrackNode = release.namedItem("track-list");
+ if (!releaseTrackNode.isNull()) {
+ QDomElement releaseTrack = releaseTrackNode.toElement();
+ if (!releaseTrack.attribute("offset").isEmpty())
+ trackData.track = releaseTrack.attribute("offset").toInt() + 1;
+ }
+ }
+ trackDataList.append(trackData);
+ }
+ }
+
+ if (trackDataList.size() > 1) {
+ emit resultsReceived(index, trackDataList);
+ emit statusChanged(index, i18n("User Selection"));
+ } else if (trackDataList.size() == 1) {
+ emit metaDataReceived(index, *trackDataList.begin());
+ emit statusChanged(index, i18n("Recognized"));
+ } else {
+ emit statusChanged(index, i18n("Unrecognized"));
+ }
+}
+
+#else
+
/**
* Get results for an ambiguous file.
*
@@ -387,6 +650,10 @@
}
return resultsAvailable;
}
+
+void MusicBrainzClient::parseLookupResponse(int, const QCString&) {}
+
+#endif
#else // HAVE_TUNEPIMP

View File

@ -1,146 +0,0 @@
--- ./kid3/musicbrainzclient.h.orig Thu Feb 23 22:48:34 2006
+++ ./kid3/musicbrainzclient.h Sat Sep 23 01:27:55 2006
@@ -15,7 +15,13 @@
#include <qobject.h>
#ifdef HAVE_TUNEPIMP
+#if HAVE_TUNEPIMP >= 5
+#include <qbuffer.h>
+#include <tunepimp-0.5/tp_c.h>
+class QSocket;
+#else
#include <tunepimp/tp_c.h>
+#endif
#endif // HAVE_TUNEPIMP
class MusicBrainzConfig;
@@ -23,6 +29,103 @@
class ImportTrackDataVector;
/**
+ * A HTTP query to a musicbrainz server for HAVE_TUNEPIMP >= 5.
+ */
+class LookupQuery : public QObject {
+Q_OBJECT
+
+public:
+ /**
+ * Constructor.
+ *
+ * @param numFiles number of files to be queried
+ * @param serverName server name
+ * @param serverPort server port
+ * @param proxyName proxy name, empty if no proxy
+ * @param proxyPort proxy port
+ */
+ LookupQuery(int numFiles,
+ const QString& serverName, Q_UINT16 serverPort = 80,
+ const QString& proxyName = "", Q_UINT16 proxyPort = 80);
+
+ /**
+ * Destructor.
+ */
+ virtual ~LookupQuery();
+
+#if HAVE_TUNEPIMP >= 5
+ /**
+ * Query a PUID from the server.
+ *
+ * @param puid PUID
+ * @param index index of file
+ */
+ void query(const char* puid, int index);
+#endif
+
+signals:
+ /**
+ * Emitted when the query response is received
+ */
+ void queryResponseReceived(int, const QCString&);
+
+private slots:
+ /**
+ * Send query when the socket is connected.
+ */
+ void socketConnected();
+
+ /**
+ * Error on socket connection.
+ */
+ void socketError();
+
+ /**
+ * Read received data when the server has closed the connection.
+ */
+ void socketConnectionClosed();
+
+#if HAVE_TUNEPIMP >= 5
+private:
+ /**
+ * Connect to server to query information about the current file.
+ */
+ void socketQuery();
+
+ /**
+ * Query the next file.
+ */
+ void queryNext();
+
+ struct FileQuery {
+ bool requested;
+ QString puid;
+ };
+
+ /** Number of files to be queried. */
+ int m_numFiles;
+ /** MusicBrainz server */
+ QString m_serverName;
+ /** Port of MusicBrainz server */
+ Q_UINT16 m_serverPort;
+ /** Proxy */
+ QString m_proxyName;
+ /** Port of proxy */
+ Q_UINT16 m_proxyPort;
+ /**
+ * -1 if not yet started,
+ * 0..m_numFiles-1 if a file is currently processed,
+ * >=m_numFiles if all files processed.
+ */
+ int m_currentFile;
+ FileQuery* m_fileQueries;
+ QSocket* m_sock;
+ QString m_request;
+#endif
+};
+
+
+/**
* MusicBrainz client.
*/
class MusicBrainzClient : public QObject
@@ -85,6 +188,15 @@
*/
void resultsReceived(int, ImportTrackDataVector&);
+private slots:
+ /**
+ * Process server response with lookup data.
+ *
+ * @param index index of file
+ * @param response response from server
+ */
+ void parseLookupResponse(int index, const QCString& response);
+
#ifdef HAVE_TUNEPIMP
private:
/**
@@ -126,6 +238,9 @@
tunepimp_t m_tp;
int* m_ids;
int m_numFiles;
+#if HAVE_TUNEPIMP >= 5
+ LookupQuery* m_lookupQuery;
+#endif
#endif // HAVE_TUNEPIMP
};

View File

@ -1,11 +0,0 @@
--- ./kid3/oggfile.cpp.orig Fri Jan 27 21:15:27 2006
+++ ./kid3/oggfile.cpp Sat Sep 23 01:27:49 2006
@@ -143,7 +143,7 @@
bool setUtime = false;
struct utimbuf times;
if (preserve) {
- int fd = ::fileno(fpIn);
+ int fd = fileno(fpIn);
if (fd >= 0) {
struct stat fileStat;
if (::fstat(fd, &fileStat) == 0) {

View File

@ -1,5 +1,5 @@
bin/kid3
share/applnk/Multimedia/kid3.desktop
share/applications/kde/kid3.desktop
share/apps/kid3/kid3ui.rc
share/doc/HTML/de/kid3/common
share/doc/HTML/de/kid3/index.cache.bz2
@ -10,9 +10,11 @@ share/doc/HTML/en/kid3/index.docbook
share/icons/hicolor/16x16/apps/kid3.png
share/icons/hicolor/32x32/apps/kid3.png
share/icons/hicolor/48x48/apps/kid3.png
share/icons/hicolor/scalable/apps/kid3.svgz
share/locale/de/LC_MESSAGES/kid3.mo
share/locale/es/LC_MESSAGES/kid3.mo
share/locale/ru/LC_MESSAGES/kid3.mo
@dirrm share/doc/HTML/en/kid3
@dirrm share/doc/HTML/de/kid3
@dirrm share/apps/kid3
@dirrmtry share/applications/kde