FreeBSD Bugzilla – Attachment 72371 Details for
Bug 105220
maintainer update: audio/kid3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
kid3.diff
kid3.diff (text/x-diff; charset="us-ascii"), 31.59 KB, created by
Max Brazhnikov
on 2006-11-20 07:39:55 UTC
(
hide
)
Description:
kid3.diff
Filename:
MIME Type:
Creator:
Max Brazhnikov
Created:
2006-11-20 07:39:55 UTC
Size:
31.59 KB
patch
obsolete
>===> Generating patch >===> Viewing diff with more >diff -ruN --exclude=CVS /usr/ports/audio/kid3/Makefile /home/makc/porting/ports/audio/kid3/Makefile >--- /usr/ports/audio/kid3/Makefile Wed Sep 13 01:49:38 2006 >+++ /home/makc/porting/ports/audio/kid3/Makefile Mon Nov 20 10:17:34 2006 >@@ -7,6 +7,7 @@ > > PORTNAME= kid3 > PORTVERSION= 0.7 >+PORTREVISION= 1 > CATEGORIES= audio kde > MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} > MASTER_SITE_SUBDIR= ${PORTNAME} >@@ -18,22 +19,15 @@ > FLAC.7:${PORTSDIR}/audio/flac \ > ogg.5:${PORTSDIR}/audio/libogg \ > vorbis.3:${PORTSDIR}/audio/libvorbis \ >- tunepimp-0.4.3:${PORTSDIR}/audio/libtunepimp-old >+ tunepimp.5:${PORTSDIR}/audio/libtunepimp > > USE_KDELIBS_VER=3 > USE_GMAKE= yes >-USE_AUTOTOOLS= libtool:15 >+USE_AUTOTOOLS= automake:19:env autoconf:259:env libtool:15 >+USE_PERL5_BUILD=yes > USE_GETTEXT= yes > GNU_CONFIGURE= yes > INSTALLS_ICONS= yes >-CONFIGURE_ARGS+=CFLAGS=-I${LOCALBASE}/include/tunepimp-0.4 \ >- LDFLAGS=-L${LOCALBASE}/lib/tunepimp-0.4 >- >-post-patch: >- @${REINPLACE_CMD} -e 's|-ltunepimp|-ltunepimp-0.4|g' \ >- -e 's|<tunepimp/tp_c.h>|<tunepimp-0.4/tunepimp/tp_c.h>|g' \ >- ${WRKSRC}/configure ${WRKSRC}/kid3/musicbrainzclient.h \ >- ${WRKSRC}/admin/Makefile > > .include <bsd.port.pre.mk> > >@@ -41,5 +35,11 @@ > IGNORE= does not compile on FreeBSD 4.x > .endif > >-.include <bsd.port.post.mk> >+pre-configure: >+ @cd ${CONFIGURE_WRKSRC} \ >+ && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} -I ${ACLOCAL_DIR} \ >+ && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} ${AUTOMAKE_ARGS} \ >+ && ${PERL} admin/am_edit \ >+ && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} ${AUTOCONF_ARGS} > >+.include <bsd.port.post.mk> >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-configure.in /home/makc/porting/ports/audio/kid3/files/patch-configure.in >--- /usr/ports/audio/kid3/files/patch-configure.in Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-configure.in Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,18 @@ >+diff -ru configure.in configure.in >+--- configure.in Tue Jun 27 22:54:46 2006 >++++ configure.in Sun Nov 12 00:18:44 2006 >+@@ -133,10 +133,12 @@ >+ with_musicbrainz=yes >+ ) >+ if test "$with_musicbrainz" != "no"; then >+- KDE_CHECK_HEADER(tunepimp/tp_c.h, [build_musicbrainz="yes"], [build_musicbrainz="no"]) >++ AC_CHECK_HEADER(tunepimp-0.5/tp_c.h, [build_musicbrainz="yes"], >++ [AC_CHECK_HEADER(tunepimp/tp_c.h, [build_musicbrainz="yes"], >++ [build_musicbrainz="no"])]) >+ fi >+ if test "$build_musicbrainz" = "yes"; then >+- AC_CHECK_LIB(tunepimp, tp_SetPUIDCollisionThreshold, >++ AC_CHECK_LIB(tunepimp, tr_GetPUID, >+ AC_DEFINE(HAVE_TUNEPIMP, 5, [have TunePimp 0.5.x]), >+ AC_CHECK_LIB(tunepimp, tp_SetFileNameEncoding, >+ AC_DEFINE(HAVE_TUNEPIMP, 4, [have TunePimp 0.4.x]), >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3-oggfile.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3-oggfile.cpp >--- /usr/ports/audio/kid3/files/patch-kid3-oggfile.cpp Mon Aug 7 13:06:48 2006 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3-oggfile.cpp Thu Jan 1 03:00:00 1970 >@@ -1,11 +0,0 @@ >---- kid3/oggfile.cpp.orig Sat Jan 28 02:15:27 2006 >-+++ kid3/oggfile.cpp Mon Aug 7 16:13:25 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) { >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_Makefile.am /home/makc/porting/ports/audio/kid3/files/patch-kid3_Makefile.am >--- /usr/ports/audio/kid3/files/patch-kid3_Makefile.am Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_Makefile.am Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,41 @@ >+diff -ru kid3/Makefile.am kid3/Makefile.am >+--- kid3/Makefile.am Thu May 25 17:31:52 2006 >++++ kid3/Makefile.am Sun Nov 12 00:25:16 2006 >+@@ -36,22 +36,6 @@ >+ # additional files in distribution >+ EXTRA_DIST = kid3.desktop kid3ui.rc hi16-app-kid3.png hi32-app-kid3.png hi48-app-kid3.png de_qt.po ru_qt.po kid3.dsp kid3.dsw kid3win.rc kid3.ico kid3.mak config.mk >+ >+-install-data-local: >+- $(mkinstalldirs) $(kde_datadir)/kid3/ >+- $(INSTALL_DATA) $(srcdir)/kid3ui.rc $(kde_datadir)/kid3/kid3ui.rc >+- $(mkinstalldirs) $(kde_icondir)/hicolor/16x16/apps/ >+- $(INSTALL_DATA) $(srcdir)/hi16-app-kid3.png $(kde_icondir)/hicolor/16x16/apps/kid3.png >+- $(mkinstalldirs) $(kde_icondir)/hicolor/32x32/apps/ >+- $(INSTALL_DATA) $(srcdir)/hi32-app-kid3.png $(kde_icondir)/hicolor/32x32/apps/kid3.png >+- $(mkinstalldirs) $(kde_icondir)/hicolor/48x48/apps/ >+- $(INSTALL_DATA) $(srcdir)/hi48-app-kid3.png $(kde_icondir)/hicolor/48x48/apps/kid3.png >+- >+-uninstall-local: >+- -rm -f $(kde_datadir)/kid3/kid3ui.rc >+- -rm -f $(kde_icondir)/hicolor/16x16/apps/kid3.png >+- -rm -f $(kde_icondir)/hicolor/32x32/apps/kid3.png >+- -rm -f $(kde_icondir)/hicolor/48x48/apps/kid3.png >+- >+ # generate precompiled header allsys.h.gch for GCC 3.4 >+ pch: >+ echo "/* automatically generated by Makefile */" >allsys.h >+@@ -72,6 +56,11 @@ >+ messages: rc.cpp >+ $(XGETTEXT) *.cpp -o $(podir)/kid3.pot >+ >+-# this is where the desktop file will go >+-desktopdir = $(kde_appsdir)/Multimedia >+-desktop_DATA = kid3.desktop >++KDE_ICON = kid3 >++ >++# this is where the kdelnk file will go >++xdg_apps_DATA = kid3.desktop >++ >++# this is where the XML-GUI resource file goes >++rcdir = $(kde_datadir)/kid3 >++rc_DATA = kid3ui.rc >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_freedbclient.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbclient.cpp >--- /usr/ports/audio/kid3/files/patch-kid3_freedbclient.cpp Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbclient.cpp Mon Nov 6 21:26:13 2006 >@@ -0,0 +1,101 @@ >++++ ./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...")); >+ } >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_freedbclient.h /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbclient.h >--- /usr/ports/audio/kid3/files/patch-kid3_freedbclient.h Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbclient.h Mon Nov 6 21:26:19 2006 >@@ -0,0 +1,44 @@ >++++ ./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 >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_freedbdialog.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbdialog.cpp >--- /usr/ports/audio/kid3/files/patch-kid3_freedbdialog.cpp Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbdialog.cpp Mon Nov 6 21:26:23 2006 >@@ -0,0 +1,96 @@ >++++ ./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 >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_freedbdialog.h /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbdialog.h >--- /usr/ports/audio/kid3/files/patch-kid3_freedbdialog.h Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_freedbdialog.h Mon Nov 6 21:26:28 2006 >@@ -0,0 +1,15 @@ >++++ ./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 >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_genres.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3_genres.cpp >--- /usr/ports/audio/kid3/files/patch-kid3_genres.cpp Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_genres.cpp Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,12 @@ >+diff -ru kid3/genres.cpp kid3/genres.cpp >+--- kid3/genres.cpp Thu May 25 19:58:19 2006 >++++ kid3/genres.cpp Sun Nov 12 00:13:00 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) { >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_genres.h /home/makc/porting/ports/audio/kid3/files/patch-kid3_genres.h >--- /usr/ports/audio/kid3/files/patch-kid3_genres.h Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_genres.h Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,12 @@ >+diff -ru kid3/genres.h kid3/genres.h >+--- kid3/genres.h Thu Jan 5 21:15:20 2006 >++++ kid3/genres.h Sun Nov 12 00:13:00 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 }; >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_id3form.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3_id3form.cpp >--- /usr/ports/audio/kid3/files/patch-kid3_id3form.cpp Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_id3form.cpp Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,12 @@ >+diff -ru kid3/id3form.cpp kid3/id3form.cpp >+--- kid3/id3form.cpp Sat Jun 17 14:46:00 2006 >++++ kid3/id3form.cpp Sun Nov 12 00:13:00 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; >+ } >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_mp3file.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3_mp3file.cpp >--- /usr/ports/audio/kid3/files/patch-kid3_mp3file.cpp Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_mp3file.cpp Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,15 @@ >+diff -ru kid3/mp3file.cpp kid3/mp3file.cpp >+--- kid3/mp3file.cpp Thu Jan 5 21:15:21 2006 >++++ kid3/mp3file.cpp Sun Nov 12 00:13:00 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; >+ } >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_musicbrainzclient.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3_musicbrainzclient.cpp >--- /usr/ports/audio/kid3/files/patch-kid3_musicbrainzclient.cpp Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_musicbrainzclient.cpp Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,357 @@ >+diff -ru kid3/musicbrainzclient.cpp kid3/musicbrainzclient.cpp >+--- kid3/musicbrainzclient.cpp Tue Jun 6 00:18:36 2006 >++++ kid3/musicbrainzclient.cpp Sun Nov 12 00:18:44 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 >+ >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_musicbrainzclient.h /home/makc/porting/ports/audio/kid3/files/patch-kid3_musicbrainzclient.h >--- /usr/ports/audio/kid3/files/patch-kid3_musicbrainzclient.h Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_musicbrainzclient.h Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,147 @@ >+diff -ru kid3/musicbrainzclient.h kid3/musicbrainzclient.h >+--- kid3/musicbrainzclient.h Thu Feb 23 22:48:34 2006 >++++ kid3/musicbrainzclient.h Sun Nov 12 00:18:44 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 >+ }; >+ >diff -ruN --exclude=CVS /usr/ports/audio/kid3/files/patch-kid3_oggfile.cpp /home/makc/porting/ports/audio/kid3/files/patch-kid3_oggfile.cpp >--- /usr/ports/audio/kid3/files/patch-kid3_oggfile.cpp Thu Jan 1 03:00:00 1970 >+++ /home/makc/porting/ports/audio/kid3/files/patch-kid3_oggfile.cpp Sun Nov 12 01:07:54 2006 >@@ -0,0 +1,12 @@ >+diff -ru kid3/oggfile.cpp kid3/oggfile.cpp >+--- kid3/oggfile.cpp Fri Jan 27 21:15:27 2006 >++++ kid3/oggfile.cpp Sun Nov 12 00:12:20 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) { >diff -ruN --exclude=CVS /usr/ports/audio/kid3/pkg-plist /home/makc/porting/ports/audio/kid3/pkg-plist >--- /usr/ports/audio/kid3/pkg-plist Mon Aug 7 13:06:48 2006 >+++ /home/makc/porting/ports/audio/kid3/pkg-plist Mon Nov 20 10:23:13 2006 >@@ -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 >@@ -16,3 +16,4 @@ > @dirrm share/doc/HTML/en/kid3 > @dirrm share/doc/HTML/de/kid3 > @dirrm share/apps/kid3 >+@dirrmtry share/applications/kde >===> Done
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 105220
:
72370
| 72371