diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index bf7d8fc52..1ecb17b0f 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1576,7 +1576,7 @@ void MainWindow::updateCurrentSong(const Song &song) current=song; - if (current.file.startsWith("http") && HttpServer::self()->isOurs(current.file)) { + if (current.isCantataStream()) { Song mod=HttpServer::self()->decodeUrl(current.file); if (!mod.title.isEmpty()) { current=mod; diff --git a/mpd/mpdparseutils.cpp b/mpd/mpdparseutils.cpp index a6b98f27d..e0ef91020 100644 --- a/mpd/mpdparseutils.cpp +++ b/mpd/mpdparseutils.cpp @@ -261,7 +261,7 @@ QList MPDParseUtils::parseSongs(const QByteArray &data) if (i == lines.size() - 1 || lines.at(i + 1).startsWith("file:")) { Song song=parseSong(line); - if (song.file.startsWith("http") && HttpServer::self()->isOurs(song.file)) { + if (song.isCantataStream()) { Song mod=HttpServer::self()->decodeUrl(song.file); if (!mod.title.isEmpty()) { mod.id=song.id; diff --git a/mpd/song.cpp b/mpd/song.cpp index 9f9aa4ccd..a3a7d5d00 100644 --- a/mpd/song.cpp +++ b/mpd/song.cpp @@ -28,6 +28,7 @@ #include "song.h" #include "mpdparseutils.h" #include "musiclibraryitemalbum.h" +#include "httpserver.h" #ifdef ENABLE_KDE_SUPPORT #include #else @@ -139,12 +140,17 @@ void Song::setKey() static quint16 currentKey=0; static QMap keys; + if (isStream() && !isCantataStream()) { + key=0; + return; + } + QString albumAndArtist=albumArtist()+QLatin1String("::")+album; QMap::ConstIterator it=keys.find(albumAndArtist); if (it!=keys.end()) { key=it.value(); } else { - currentKey++; + currentKey++; // Key 0 is for streams, so we need to increment before setting... keys.insert(albumAndArtist, currentKey); key=currentKey; } @@ -314,3 +320,8 @@ bool Song::capitalise() return artist!=origArtist || albumartist!=origAlbumArtist || album!=origAlbum || title!=origTitle; } + +bool Song::isCantataStream() const +{ + return !file.isEmpty() && file.startsWith("http") && HttpServer::self()->isOurs(file); +} diff --git a/mpd/song.h b/mpd/song.h index 00c1d03af..eb47a292d 100644 --- a/mpd/song.h +++ b/mpd/song.h @@ -87,6 +87,7 @@ struct Song static QString capitalize(const QString &s); bool capitalise(); bool isStream() const { return file.isEmpty() || file.contains("://"); } + bool isCantataStream() const; }; Q_DECLARE_METATYPE(Song)