Fix soundcloud and podcast grouping in playqueue

This commit is contained in:
craig.p.drummond
2014-07-17 16:12:36 +00:00
parent 4255572b48
commit 751ce81b44
4 changed files with 21 additions and 1 deletions

View File

@@ -29,6 +29,9 @@
#include "song.h"
#include "models/musiclibraryitemalbum.h"
#include "support/localize.h"
#if !defined CANTATA_NO_UI_FUNCTIONS && defined ENABLE_ONLINE_SERVICES
#include "online/onlineservice.h"
#endif
#include <QStringList>
#include <QSet>
#include <QChar>
@@ -473,6 +476,11 @@ QString Song::artistSong() const
QString Song::trackAndTitleStr(bool showArtistIfDifferent) const
{
#if !defined CANTATA_NO_UI_FUNCTIONS && defined ENABLE_ONLINE_SERVICES
if (OnlineSvrTrack==type && OnlineService::showLogoAsCover(*this)) {
return artistSong();
}
#endif
// if (isFromOnlineService()) {
// return (disc>0 && disc!=constOnlineDiscId ? (QString::number(disc)+QLatin1Char('.')) : QString())+
// (track>0 ? (track>9 ? QString::number(track) : (QLatin1Char('0')+QString::number(track))) : QString())+
@@ -615,6 +623,16 @@ bool Song::capitalise()
return artist!=origArtist || albumartist!=origAlbumArtist || album!=origAlbum || title!=origTitle;
}
QString Song::albumKey() const
{
#if !defined CANTATA_NO_UI_FUNCTIONS && defined ENABLE_ONLINE_SERVICES
if (OnlineSvrTrack==type && OnlineService::showLogoAsCover(*this)) {
return onlineService();
}
#endif
return albumArtist()+QLatin1Char(':')+albumId()+QLatin1Char(':')+QString::number(disc);
}
QString Song::basicArtist() const
{
if (!albumartist.isEmpty() && (artist.isEmpty() || albumartist==artist || (albumartist.length()<artist.length() && artist.startsWith(albumartist)))) {

View File

@@ -159,7 +159,7 @@ struct Song
bool isNonMPD() const { return isStream() || OnlineSvrTrack==type || Cdda==type || (!file.isEmpty() && file.startsWith(Utils::constDirSep)); }
bool isCantataStream() const { return CantataStream==type; }
bool isCdda() const { return Cdda==type; }
QString albumKey() const { return albumArtist()+QLatin1Char(':')+albumId()+QLatin1Char(':')+QString::number(disc); }
QString albumKey() const;
bool isCueFile() const { return Playlist==type && file.endsWith(QLatin1String(".cue"), Qt::CaseInsensitive); }
QString basicArtist() const;
QString filePath() const { return decodePath(file); }

View File

@@ -105,6 +105,7 @@ Song PodcastService::fixPath(const Song &orig, bool) const
Song song=orig;
song.setPodcastLocalPath(QString());
song.setIsFromOnlineService(constName);
song.album=constName;
if (!orig.podcastLocalPath().isEmpty() && QFile::exists(orig.podcastLocalPath())) {
if (!HttpServer::self()->forceUsage() && MPDConnection::self()->getDetails().isLocal()) {
song.file=QLatin1String("file://")+orig.podcastLocalPath();

View File

@@ -53,6 +53,7 @@ Song SoundCloudService::fixPath(const Song &orig, bool) const
{
Song s(orig);
s.setIsFromOnlineService(constName);
s.album=constName;
return encode(s);
}