1
/* This file is part of Clementine.
2
Copyright 2011, David Sansome <me@davidsansome.com>
4
Clementine is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
9
Clementine is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
18
#include "icecastsearchprovider.h"
19
#include "internet/icecastbackend.h"
21
IcecastSearchProvider::IcecastSearchProvider(IcecastBackend* backend, QObject* parent)
22
: BlockingSearchProvider(parent),
25
Init("Icecast", "icecast", QIcon(":last.fm/icon_radio.png"), DisabledByDefault);
28
SearchProvider::ResultList IcecastSearchProvider::Search(int id, const QString& query) {
29
IcecastBackend::StationList stations = backend_->GetStations(query);
32
const QStringList tokens = TokenizeQuery(query);
34
foreach (const IcecastBackend::Station& station, stations) {
39
result.type_ = globalsearch::Type_Stream;
40
result.metadata_ = station.ToSong();
41
result.match_quality_ = MatchQuality(tokens, station.name);