Commit adf07467 authored by Michael Pyne's avatar Michael Pyne

Remove broken/unused MusicBrainz feature and code.

Some vestigial IDs and whatnot will remain and I continue to want for
this to be implemented correctly, but we can bring back or rewrite the
code appropriately rather than continuing to carry old Qt3-era code and
deprecated baggage.
parent 7264132f
......@@ -39,7 +39,7 @@ add_subdirectory( doc )
add_subdirectory( tests )
add_subdirectory( pics )
set_package_properties(FEATURE PROPERTIES DESCRIPTION "A library for developing MusicBrainz enabled tagging applications" URL "http://www.musicbrainz.org/products/tunepimp" TYPE OPTIONAL PURPOSE "Provides MusicBrainz tagging in Juk.")
#set_package_properties(FEATURE PROPERTIES DESCRIPTION "A library for developing MusicBrainz enabled tagging applications" URL "http://www.musicbrainz.org/products/tunepimp" TYPE OPTIONAL PURPOSE "Provides MusicBrainz tagging in Juk.")
# TODO: tunepimp is fully unsupported, replace this when tunepimp is replaced
# with whatever is actually current this decade.
......@@ -58,13 +58,7 @@ cmake_pop_check_state()
configure_file (config-juk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-juk.h )
set(tunepimp_SRCS)
if(TUNEPIMP_FOUND)
set(tunepimp_SRCS trackpickerdialog.cpp)
include_directories( ${TUNEPIMP_INCLUDE_DIR} )
endif(TUNEPIMP_FOUND)
set(juk_SRCS ${tunepimp_SRCS}
set(juk_SRCS
advancedsearchdialog.cpp
slider.cpp
svghandler.cpp
......@@ -99,7 +93,6 @@ set(juk_SRCS ${tunepimp_SRCS}
mpris2/mediaplayer2.cpp
mpris2/mediaplayer2player.cpp
mpris2/mpris2.cpp
musicbrainzquery.cpp
nowplaying.cpp
playermanager.cpp
playlist.cpp
......@@ -128,7 +121,6 @@ set(juk_SRCS ${tunepimp_SRCS}
tracksequencemanager.cpp
treeviewitemplaylist.cpp
upcomingplaylist.cpp
ktrm.cpp
viewmode.cpp )
ecm_qt_declare_logging_category(juk_SRCS HEADER juk_debug.h
......@@ -144,7 +136,6 @@ ki18n_wrap_ui(juk_SRCS
filerenamerbase.ui
filerenameroptionsbase.ui
directorylistbase.ui
trackpickerdialogbase.ui
tagguesserconfigdlgwidget.ui
exampleoptionsbase.ui
coverdialogbase.ui
......
......@@ -24,8 +24,9 @@ Learn more about [Juk at KDE.org](https://www.kde.org/applications/multimedia/ju
albums, artists and genres.
- Playlist history to indicate which files have been played and when.
- Inline search for filtering the list of visible items.
- The ability to guess tag information from the file name or using MusicBrainz
online lookup.
- The ability to guess tag information from the file name
- Previous versions could also use MusicBrainz online lookup, but we need help to
get that working again.
- File renamer that can rename files based on the tag content.
- ID3v1, ID3v2 and Ogg Vorbis tag reading and editing support (via TagLib).
......
This diff is collapsed.
/**
* Copyright (C) 2004 Scott Wheeler <wheeler@kde.org>
*/
/**
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version
* 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
/*
* At some point this will likely be a library class, as such it's been written
* as such and is LGPL'ed.
*/
#ifndef KTRM_H
#define KTRM_H
#include <QObject>
// FIXME ktrm
#if 0
template<class T>
class QList;
class QString;
class QStringList;
class KJob;
/**
* This represents a potential match for a TRM lookup. KTRMResultList is
* returned from KTRMLookup and will be sorted by relevance (better matches
* at the beginning of the list).
*/
class KTRMResult
{
friend class KTRMLookup;
public:
KTRMResult();
KTRMResult(const KTRMResult &result);
~KTRMResult();
/**
* Returns the title of the track for the potential match.
*/
QString title() const;
/**
* Returns the artist name of the track for the potential match.
*/
QString artist() const;
/**
* Returns the album name of the track for the potential match.
*/
QString album() const;
/**
* Returns the track number of the track for the potential match.
*/
int track() const;
/**
* Returns the original release year of the track for the potential match.
*/
int year() const;
/**
* Returns true if all of the values for the result are empty.
*/
bool isEmpty() const;
/**
* Compares to \a r based on the relevance of the match. Better matches
* will be greater than less accurate matches.
*/
bool operator<(const KTRMResult &r) const;
/**
* Compares to \a r based on the relevance of the match. Better matches
* will be greater than less accurate matches.
*/
bool operator>(const KTRMResult &r) const;
private:
class KTRMResultPrivate;
KTRMResultPrivate *d;
};
typedef QList<KTRMResult> KTRMResultList;
/**
* An abstraction for libtunepimp's TRM based lookup and file recognition.
*
* A lookup is started when the object is created. One of the virtual methods
* -- recognized(), unrecognized(), collision() or error(). Those methods
* should be reimplemented in subclasses to specify what behavior should happen
* for each result.
*
* The lookups themselves happen in a background thread, but the return calls
* are guaranteed to run in the GUI thread.
*/
class KTRMLookup : public QObject
{
Q_OBJECT
public:
/**
* Creates and starts a lookup for \a file. If \a autoDelete is set to
* true the lookup will delete itself when it has finished.
*/
explicit KTRMLookup(const QString &file, bool autoDelete = false);
virtual ~KTRMLookup();
/**
* Returns the file name that was specified in the constructor.
*/
QString file() const;
/**
* Returns the TunePimp file ID for the file. This is of no use to the
* public API.
*
* @internal
*/
int fileId() const;
/**
* This method is called when the puid was already generated. It will then do
* the lookup with MusicBrainz's server. This may be reimplemented to provide
* specific behavior for the lookup.
*/
virtual void puidGenerated();
/**
* This method is called if the track was recognized by the TRM server.
* results() will return just one value. This may be reimplemented to
* provide specific behavior in the case of the track being recognized.
*
* \note The base class call should happen at the beginning of the subclass
* reimplementation; it populates the values of results().
*/
virtual void recognized();
/**
* This method is called if the track was not recognized by the TRM server.
* results() will return an empty set. This may be reimplemented to provide
* specific behavior in the case of the track not being recognized.
*/
virtual void unrecognized();
/**
* This method is called if there are multiple potential matches for the TRM
* value. results() will return a list of the potential matches, sorted by
* liklihood. This may be reimplemented to provide
* specific behavior in the case of the track not being recognized.
*
* \note The base class call should happen at the beginning of the subclass
* reimplementation; it populates the values of results().
*/
virtual void collision();
/**
* This method is called if the track was not recognized by the TRM server.
* results() will return an empty set. This may be reimplemented to provide
* specific behavior in the case of the track not being recognized.
*/
virtual void error();
/**
* Returns the list of matches found by the lookup. In the case that there
* was a TRM collision this list will contain multiple entries. In the case
* that it was recognized this will only contain one entry. Otherwise it
* will remain empty.
*/
KTRMResultList results() const;
protected:
/**
* This method is called when any of terminal states (recognized,
* unrecognized, collision or error) has been reached after the specific
* method for the result has been called.
*
* This should be reimplemented in the case that there is some general
* processing to be done for all terminal states.
*/
virtual void finished();
protected slots:
virtual void lookupResult( KJob* );
signals:
void sigResult( KTRMResultList, QString );
private:
class KTRMLookupPrivate;
KTRMLookupPrivate *d;
};
/*
* Helper Functions used for sorting MusicBrainz results
*/
double stringSimilarity(QString s1, QString s2);
double stringSimilarity(const QStringList &l, const QString &s);
#endif
#endif
// vim: set et sw=4 tw=0 sta:
/**
* Copyright (C) 2004 Scott Wheeler <wheeler@kde.org>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "musicbrainzquery.h"
#if HAVE_TUNEPIMP > 0
#include "juk.h"
#include "trackpickerdialog.h"
#include "tag.h"
#include "collectionlist.h"
#include "tagtransactionmanager.h"
#include "juk_debug.h"
#include <kxmlguiwindow.h>
#include <kstatusbar.h>
#include <klocale.h>
#include <QList>
#include <QFileInfo>
MusicBrainzLookup::MusicBrainzLookup(const FileHandle &file) :
KTRMLookup(file.absFilePath()),
m_file(file)
{
message(i18n("Querying MusicBrainz server..."));
}
void MusicBrainzLookup::recognized()
{
KTRMLookup::recognized();
confirmation();
delete this;
}
void MusicBrainzLookup::unrecognized()
{
KTRMLookup::unrecognized();
message(i18n("No matches found."));
delete this;
}
void MusicBrainzLookup::collision()
{
KTRMLookup::collision();
confirmation();
delete this;
}
void MusicBrainzLookup::error()
{
KTRMLookup::error();
message(i18n("Error connecting to MusicBrainz server."));
delete this;
}
void MusicBrainzLookup::message(const QString &s) const
{
QString message = QString("%1 (%2)").arg(s).arg(m_file.fileInfo().fileName());
JuK::JuKInstance()->statusBar()->showMessage(message, 3000);
}
void MusicBrainzLookup::confirmation()
{
// Here we do a bit of queuing to make sure that we don't pop up multiple
// instances of the confirmation dialog at once.
static QList< QPair<FileHandle, KTRMResultList> > queue;
if(results().isEmpty())
return;
if(!queue.isEmpty()) {
queue.append(qMakePair(m_file, results()));
return;
}
queue.append(qMakePair(m_file, results()));
while(!queue.isEmpty()) {
QPair<FileHandle, KTRMResultList> item = queue.first();
FileHandle file = item.first;
KTRMResultList results = item.second;
TrackPickerDialog dialog(file.fileInfo().fileName(), results);
if(dialog.exec() == QDialog::Accepted && !dialog.result().isEmpty()) {
KTRMResult result = dialog.result();
Tag *tag = TagTransactionManager::duplicateTag(file.tag());
if(!result.title().isEmpty())
tag->setTitle(result.title());
if(!result.artist().isEmpty())
tag->setArtist(result.artist());
if(!result.album().isEmpty())
tag->setAlbum(result.album());
if(result.track() != 0)
tag->setTrack(result.track());
if(result.year() != 0)
tag->setYear(result.year());
PlaylistItem *item = CollectionList::instance()->lookup(file.absFilePath());
TagTransactionManager::instance()->changeTagOnItem(item, tag);
TagTransactionManager::instance()->commit();
}
queue.pop_front();
}
}
#endif
// vim: set et sw=4 tw=0 sta:
/**
* Copyright (C) 2004 Scott Wheeler <wheeler@kde.org>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MUSICBRAINZQUERY_H
#define MUSICBRAINZQUERY_H
#include <config-juk.h>
#if HAVE_TUNEPIMP
#include "ktrm.h"
#include "filehandle.h"
class MusicBrainzLookup : public KTRMLookup
{
public:
explicit MusicBrainzLookup(const FileHandle &file);
virtual void recognized();
virtual void unrecognized();
virtual void collision();
virtual void error();
private:
void message(const QString &s) const;
void confirmation();
FileHandle m_file;
};
#endif
#endif
// vim: set et sw=4 tw=0 sta:
......@@ -26,7 +26,6 @@
#include <QPixmap>
#include "collectionlist.h"
#include "musicbrainzquery.h"
#include "tag.h"
#include "coverinfo.h"
#include "covermanager.h"
......@@ -35,16 +34,6 @@
PlaylistItemList PlaylistItem::m_playingItems; // static
static void startMusicBrainzQuery(const FileHandle &file)
{
#if HAVE_TUNEPIMP
// This deletes itself when finished.
new MusicBrainzLookup(file);
#else
Q_UNUSED(file)
#endif
}
static int naturalCompare(const QString &first, const QString &second)
{
static QCollator collator;
......@@ -191,7 +180,7 @@ void PlaylistItem::guessTagInfo(TagGuesser::Type type)
break;
}
case TagGuesser::MusicBrainz:
startMusicBrainzQuery(d->fileHandle);
qCDebug(JUK_LOG) << "Ignoring MusicBrainz query request until support is reimplemented.";
break;
}
}
......
/**
* Copyright (C) 2003-2004 Scott Wheeler <wheeler@kde.org>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config-juk.h>
#include "trackpickerdialog.h"
#if HAVE_TUNEPIMP
#include <k3listview.h>
#include <klocale.h>
#define NUMBER(x) (x == 0 ? QString::null : QString::number(x)) //krazy:exclude=nullstrassign for old broken gcc
class TrackPickerItem : public K3ListViewItem
{
public:
TrackPickerItem(K3ListView *parent, const KTRMResult &result) :
K3ListViewItem(parent, parent->lastChild(),
result.title(), result.artist(), result.album(),
NUMBER(result.track()), NUMBER(result.year())),
m_result(result) {}
KTRMResult result() const { return m_result; }
private:
KTRMResult m_result;
};
////////////////////////////////////////////////////////////////////////////////
// public methods
////////////////////////////////////////////////////////////////////////////////
TrackPickerDialog::TrackPickerDialog(const QString &name,
const KTRMResultList &results,
QWidget *parent) :
KDialog(parent)
{
setObjectName(name.toAscii());
setModal(true);
setCaption(i18n("Internet Tag Guesser"));
setButtons(Ok | Cancel);
showButtonSeparator(true);
m_base = new TrackPickerDialogBase(this);
setMainWidget(m_base);
m_base->fileLabel->setText(name);
m_base->trackList->setSorting(-1);
for(KTRMResultList::ConstIterator it = results.begin(); it != results.end(); ++it)
new TrackPickerItem(m_base->trackList, *it);
m_base->trackList->setSelected(m_base->trackList->firstChild(), true);
connect(m_base->trackList, SIGNAL(doubleClicked(Q3ListViewItem*,QPoint,int)),
this, SLOT(accept()));
setMinimumWidth(qMax(400, width()));
}
TrackPickerDialog::~TrackPickerDialog()
{
}
KTRMResult TrackPickerDialog::result() const
{
if(m_base->trackList->selectedItem())
return static_cast<TrackPickerItem *>(m_base->trackList->selectedItem())->result();
else
return KTRMResult();
}
////////////////////////////////////////////////////////////////////////////////
// public slots
////////////////////////////////////////////////////////////////////////////////
int TrackPickerDialog::exec()
{
int dialogCode = KDialog::exec();
// Only return true if an item was selected.
if(m_base->trackList->selectedItem())
return dialogCode;
else
return Rejected;
}
#endif // HAVE_TUNEPIMP
// vim: set et sw=4 tw=0 sta:
/**
* Copyright (C) 2003-2004 Scott Wheeler <wheeler@kde.org>
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRACKPICKERDIALOG_H
#define TRACKPICKERDIALOG_H
#include <config-juk.h>
#include <kdialog.h>
#include "musicbrainzquery.h"
#include "ui_trackpickerdialogbase.h"
class TrackPickerDialogBase : public QWidget, public Ui::TrackPickerDialogBase
{
public:
TrackPickerDialogBase( QWidget *parent ) : QWidget( parent ) {
setupUi( this );
}
};
class TrackPickerDialog : public KDialog
{
Q_OBJECT
public:
TrackPickerDialog(const QString &name,
const KTRMResultList &results,
QWidget *parent = 0);
virtual ~TrackPickerDialog();
KTRMResult result() const;
public slots:
int exec();
private:
TrackPickerDialogBase *m_base;
};
#endif
// vim: set et sw=4 tw=0 sta:
<ui version="4.0" stdsetdef="1" >
<class>TrackPickerDialogBase</class>
<widget class="QWidget" name="TrackPickerDialogBase" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>556</width>
<height>310</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="fileInfoGroup" >
<property name="title" >
<string>File Name</string>
</property>
<property name="alignment" >
<set>Qt::AlignTop</set>
</property>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="fileLabel" >
<property name="font" >
<font>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string/>
</property>
<property name="alignment" >
<set>Qt::AlignVCenter|Qt::AlignLeft</set>
</property>
<property name="indent" >
<number>9</number>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="trackInfoGroup" >
<property name="title" >
<string>Select Best Possible Match</string>
</property>
<property name="alignment" >
<set>Qt::AlignTop</set>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<item>
<widget class="K3ListView" name="trackList" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="allColumnsShowFocus" >
<bool>true</bool>
</property>
<property name="itemMargin" >
<number>1</number>
</property>
<property name="resizeMode" >
<enum>LastColumn</enum>
</property>
<property name="fullWidth" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>Track Name</string>
</property>
<property name="clickable" >
<bool>true</bool>
</property>
<property name="resizable" >
<bool>false</bool>
</property>
</column>
<column>
<property name="text" >
<string>Artist</string>
</property>
<property name="clickable" >
<bool>true</bool>
</property>
<property name="resizable" >
<bool>false</bool>
</property>
</column>
<column>
<property name="text" >
<string>Album</string>