Show a helpful error if the gstofa plugin isn't available
This commit is contained in:
parent
b74576cbd5
commit
1fb7dae446
@ -32,6 +32,16 @@ Fingerprinter::~Fingerprinter() {
|
|||||||
delete event_loop_;
|
delete event_loop_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Fingerprinter::GstreamerHasOfa() {
|
||||||
|
GstElementFactory* factory = gst_element_factory_find("ofa");
|
||||||
|
if (!factory) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_object_unref(factory);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
GstElement* Fingerprinter::CreateElement(const QString &factory_name,
|
GstElement* Fingerprinter::CreateElement(const QString &factory_name,
|
||||||
GstElement *bin) {
|
GstElement *bin) {
|
||||||
GstElement* ret = gst_element_factory_make(
|
GstElement* ret = gst_element_factory_make(
|
||||||
|
@ -37,6 +37,9 @@ public:
|
|||||||
Fingerprinter(const QString& filename);
|
Fingerprinter(const QString& filename);
|
||||||
~Fingerprinter();
|
~Fingerprinter();
|
||||||
|
|
||||||
|
// Checks if this gstreamer installation has the required ofa plugin.
|
||||||
|
static bool GstreamerHasOfa();
|
||||||
|
|
||||||
// Creates a fingerprint from the song. This method is blocking, so you want
|
// Creates a fingerprint from the song. This method is blocking, so you want
|
||||||
// to call it in another thread. Returns an empty string if no fingerprint
|
// to call it in another thread. Returns an empty string if no fingerprint
|
||||||
// could be created.
|
// could be created.
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "core/utilities.h"
|
#include "core/utilities.h"
|
||||||
#include "library/library.h"
|
#include "library/library.h"
|
||||||
#include "library/librarybackend.h"
|
#include "library/librarybackend.h"
|
||||||
|
#include "musicbrainz/fingerprinter.h"
|
||||||
#include "playlist/playlistdelegates.h"
|
#include "playlist/playlistdelegates.h"
|
||||||
#include "ui/albumcoverchoicecontroller.h"
|
#include "ui/albumcoverchoicecontroller.h"
|
||||||
#include "ui/coverfromurldialog.h"
|
#include "ui/coverfromurldialog.h"
|
||||||
@ -59,7 +60,7 @@ EditTagDialog::EditTagDialog(QWidget* parent)
|
|||||||
connect(cover_loader_->Worker().get(), SIGNAL(ImageLoaded(quint64,QImage,QImage)),
|
connect(cover_loader_->Worker().get(), SIGNAL(ImageLoaded(quint64,QImage,QImage)),
|
||||||
SLOT(ArtLoaded(quint64,QImage,QImage)));
|
SLOT(ArtLoaded(quint64,QImage,QImage)));
|
||||||
connect(tag_fetcher_, SIGNAL(ResultAvailable(Song, SongList)),
|
connect(tag_fetcher_, SIGNAL(ResultAvailable(Song, SongList)),
|
||||||
results_dialog_, SLOT(FetchTagFinished(Songa, SongList)),
|
results_dialog_, SLOT(FetchTagFinished(Song, SongList)),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(tag_fetcher_, SIGNAL(Progress(Song,QString)),
|
connect(tag_fetcher_, SIGNAL(Progress(Song,QString)),
|
||||||
results_dialog_, SLOT(FetchTagProgress(Song,QString)));
|
results_dialog_, SLOT(FetchTagProgress(Song,QString)));
|
||||||
@ -69,7 +70,6 @@ EditTagDialog::EditTagDialog(QWidget* parent)
|
|||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
ui_->splitter->setSizes(QList<int>() << 200 << width() - 200);
|
ui_->splitter->setSizes(QList<int>() << 200 << width() - 200);
|
||||||
ui_->loading_container->hide();
|
ui_->loading_container->hide();
|
||||||
ui_->fetch_tag->setVisible(false);
|
|
||||||
|
|
||||||
// An editable field is one that has a label as a buddy. The label is
|
// An editable field is one that has a label as a buddy. The label is
|
||||||
// important because it gets turned bold when the field is changed.
|
// important because it gets turned bold when the field is changed.
|
||||||
@ -679,6 +679,11 @@ void EditTagDialog::ResetPlayCounts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditTagDialog::FetchTag() {
|
void EditTagDialog::FetchTag() {
|
||||||
|
if (!Fingerprinter::GstreamerHasOfa()) {
|
||||||
|
QMessageBox::warning(this, tr("Error"), tr("Your gstreamer installation is missing the 'ofa' plugin. This is required for automatic tag fetching. Try installing the 'gstreamer-plugins-bad' package."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes();
|
const QModelIndexList sel = ui_->song_list->selectionModel()->selectedIndexes();
|
||||||
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "library/librarydirectorymodel.h"
|
#include "library/librarydirectorymodel.h"
|
||||||
#include "library/libraryfilterwidget.h"
|
#include "library/libraryfilterwidget.h"
|
||||||
#include "library/libraryviewcontainer.h"
|
#include "library/libraryviewcontainer.h"
|
||||||
|
#include "musicbrainz/fingerprinter.h"
|
||||||
#include "musicbrainz/tagfetcher.h"
|
#include "musicbrainz/tagfetcher.h"
|
||||||
#include "playlist/playlistbackend.h"
|
#include "playlist/playlistbackend.h"
|
||||||
#include "playlist/playlist.h"
|
#include "playlist/playlist.h"
|
||||||
@ -1887,6 +1888,11 @@ void MainWindow::Exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AutoCompleteTags() {
|
void MainWindow::AutoCompleteTags() {
|
||||||
|
if (!Fingerprinter::GstreamerHasOfa()) {
|
||||||
|
QMessageBox::warning(this, tr("Error"), tr("Your gstreamer installation is missing the 'ofa' plugin. This is required for automatic tag fetching. Try installing the 'gstreamer-plugins-bad' package."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the tag fetching stuff if it hasn't been already
|
// Create the tag fetching stuff if it hasn't been already
|
||||||
if (!tag_fetcher_) {
|
if (!tag_fetcher_) {
|
||||||
tag_fetcher_.reset(new TagFetcher);
|
tag_fetcher_.reset(new TagFetcher);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user