Commit 23eb1b3e authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

handle url from command line and allow to enqueue track and radio by URL

parent 8c2abfd0
......@@ -67,13 +67,13 @@ private Q_SLOTS:
auto myDirectory = QDir::current();
auto relativePath = myDirectory.relativeFilePath(myTestFile.canonicalFilePath());
myApp.setArguments({{0, relativePath}});
myApp.setArguments({{{}, {}, QUrl::fromLocalFile(relativePath)}});
QCOMPARE(argumentsChangedSpy.count(), 1);
QCOMPARE(enqueueSpy.count(), 1);
QCOMPARE(myApp.arguments().count(), 1);
QCOMPARE(std::get<1>(myApp.arguments().at(0)), myTestFile.canonicalFilePath());
QCOMPARE(std::get<2>(myApp.arguments().at(0)), QUrl::fromLocalFile(myTestFile.canonicalFilePath()));
}
void activateRequestedTest()
......@@ -93,7 +93,7 @@ private Q_SLOTS:
QCOMPARE(enqueueSpy.count(), 1);
QCOMPARE(enqueueSpy.at(0).count(), 4);
QCOMPARE(std::get<1>(enqueueSpy.at(0).at(0).value<ElisaUtils::EntryDataList>().at(0)), myTestFile.canonicalFilePath());
QCOMPARE(std::get<2>(enqueueSpy.at(0).at(0).value<ElisaUtils::EntryDataList>().at(0)), QUrl::fromLocalFile(myTestFile.canonicalFilePath()));
}
};
......
This diff is collapsed.
......@@ -149,6 +149,10 @@ private Q_SLOTS:
void enqueueMultipleAlbumsCase();
void enqueueTrackByUrl();
void enqueueTracksByUrl();
};
class MediaPlayList;
......
......@@ -108,7 +108,7 @@ private Q_SLOTS:
auto trackId = musicDb.trackIdFromFileName(QUrl::fromLocalFile(QStringLiteral("/$1")));
myModel.initializeById(ElisaUtils::Track, trackId);
myModel.initializeByIdAndUrl(ElisaUtils::Track, trackId, QUrl::fromLocalFile(QStringLiteral("/$1")));
QCOMPARE(beginResetSpy.count(), 1);
QCOMPARE(endResetSpy.count(), 1);
......
......@@ -101,7 +101,7 @@ private Q_SLOTS:
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.replaceAndPlay({0, QStringLiteral("artist1")}, ElisaUtils::Artist);
myPlayList.replaceAndPlay({0, QStringLiteral("artist1"), {}}, ElisaUtils::Artist);
QCOMPARE(trackHasChangedSpy.count(), 0);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -228,7 +228,7 @@ private Q_SLOTS:
QCOMPARE(trackId != 0, true);
myPlayList.replaceAndPlay(ElisaUtils::EntryData{trackId, {}}, ElisaUtils::Track);
myPlayList.replaceAndPlay(ElisaUtils::EntryData{trackId, {}, {}}, ElisaUtils::Track);
QCOMPARE(trackHasChangedSpy.count(), 1);
QCOMPARE(trackHasBeenRemovedSpy.count(), 0);
......@@ -291,7 +291,7 @@ private Q_SLOTS:
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueue({myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1),
QStringLiteral("track1")},
QStringLiteral("track1"), {}},
ElisaUtils::Track);
QCOMPARE(trackHasChangedSpy.count(), 1);
......@@ -424,7 +424,7 @@ private Q_SLOTS:
QCOMPARE(tracksListAddedSpy.count(), 0);
myPlayList.enqueue({myDatabaseContent.trackIdFromTitleAlbumTrackDiscNumber(QStringLiteral("track1"), QStringLiteral("artist1"), QStringLiteral("album1"), 1, 1),
QStringLiteral("track1")},
QStringLiteral("track1"), {}},
ElisaUtils::Track);
QCOMPARE(trackHasChangedSpy.count(), 1);
......
......@@ -87,7 +87,8 @@ public:
mClearTracksTable(mTracksDatabase), mClearAlbumsTable(mTracksDatabase), mClearArtistsTable(mTracksDatabase),
mClearComposerTable(mTracksDatabase), mClearGenreTable(mTracksDatabase), mClearLyricistTable(mTracksDatabase),
mArtistMatchGenreQuery(mTracksDatabase), mSelectTrackIdQuery(mTracksDatabase),
mInsertRadioQuery(mTracksDatabase), mDeleteRadioQuery(mTracksDatabase)
mInsertRadioQuery(mTracksDatabase), mDeleteRadioQuery(mTracksDatabase),
mSelectTrackFromIdAndUrlQuery(mTracksDatabase)
{
}
......@@ -263,6 +264,8 @@ public:
QSqlQuery mDeleteRadioQuery;
QSqlQuery mSelectTrackFromIdAndUrlQuery;
QSet<qulonglong> mModifiedTrackIds;
QSet<qulonglong> mModifiedAlbumIds;
......@@ -740,6 +743,29 @@ DataTypes::TrackDataType DatabaseInterface::trackDataFromDatabaseId(qulonglong i
return result;
}
DataTypes::TrackDataType DatabaseInterface::trackDataFromDatabaseIdAndUrl(qulonglong id, const QUrl &trackUrl)
{
auto result = DataTypes::TrackDataType();
if (!d) {
return result;
}
auto transactionResult = startTransaction();
if (!transactionResult) {
return result;
}
result = internalOneTrackPartialDataByIdAndUrl(id, trackUrl);
transactionResult = finishTransaction();
if (!transactionResult) {
return result;
}
return result;
}
DataTypes::TrackDataType DatabaseInterface::radioDataFromDatabaseId(qulonglong id)
{
auto result = DataTypes::TrackDataType();
......@@ -810,6 +836,29 @@ qulonglong DatabaseInterface::trackIdFromFileName(const QUrl &fileName)
return result;
}
qulonglong DatabaseInterface::radioIdFromFileName(const QUrl &fileName)
{
auto result = qulonglong(0);
if (!d) {
return result;
}
auto transactionResult = startTransaction();
if (!transactionResult) {
return result;
}
result = internalRadioIdFromHttpAddress(fileName.toString());
transactionResult = finishTransaction();
if (!transactionResult) {
return result;
}
return result;
}
void DatabaseInterface::applicationAboutToQuit()
{
d->mStopRequest = 1;
......@@ -4440,6 +4489,119 @@ void DatabaseInterface::initRequest()
}
}
{
auto selectTrackFromIdAndUrlQueryText = QStringLiteral("SELECT "
"tracks.`Id`, "
"tracks.`Title`, "
"album.`ID`, "
"tracks.`ArtistName`, "
"( "
"SELECT "
"COUNT(DISTINCT tracksFromAlbum1.`ArtistName`) "
"FROM "
"`Tracks` tracksFromAlbum1 "
"WHERE "
"tracksFromAlbum1.`AlbumTitle` = album.`Title` AND "
"(tracksFromAlbum1.`AlbumArtistName` = album.`ArtistName` OR "
"(tracksFromAlbum1.`AlbumArtistName` IS NULL AND "
"album.`ArtistName` IS NULL "
") "
") AND "
"tracksFromAlbum1.`AlbumPath` = album.`AlbumPath` "
") AS ArtistsCount, "
"( "
"SELECT "
"GROUP_CONCAT(tracksFromAlbum2.`ArtistName`) "
"FROM "
"`Tracks` tracksFromAlbum2 "
"WHERE "
"tracksFromAlbum2.`AlbumTitle` = album.`Title` AND "
"(tracksFromAlbum2.`AlbumArtistName` = album.`ArtistName` OR "
"(tracksFromAlbum2.`AlbumArtistName` IS NULL AND "
"album.`ArtistName` IS NULL "
") "
") AND "
"tracksFromAlbum2.`AlbumPath` = album.`AlbumPath` "
") AS AllArtists, "
"tracks.`AlbumArtistName`, "
"tracksMapping.`FileName`, "
"tracksMapping.`FileModifiedTime`, "
"tracks.`TrackNumber`, "
"tracks.`DiscNumber`, "
"tracks.`Duration`, "
"tracks.`AlbumTitle`, "
"tracks.`Rating`, "
"album.`CoverFileName`, "
"("
"SELECT "
"COUNT(DISTINCT tracks2.DiscNumber) <= 1 "
"FROM "
"`Tracks` tracks2 "
"WHERE "
"tracks2.`AlbumTitle` = album.`Title` AND "
"(tracks2.`AlbumArtistName` = album.`ArtistName` OR "
"(tracks2.`AlbumArtistName` IS NULL AND "
"album.`ArtistName` IS NULL"
")"
") AND "
"tracks2.`AlbumPath` = album.`AlbumPath` "
") as `IsSingleDiscAlbum`, "
"trackGenre.`Name`, "
"trackComposer.`Name`, "
"trackLyricist.`Name`, "
"tracks.`Comment`, "
"tracks.`Year`, "
"tracks.`Channels`, "
"tracks.`BitRate`, "
"tracks.`SampleRate`, "
"tracks.`HasEmbeddedCover`, "
"tracksMapping.`ImportDate`, "
"tracksMapping.`FirstPlayDate`, "
"tracksMapping.`LastPlayDate`, "
"tracksMapping.`PlayCounter`, "
"tracksMapping.`PlayCounter` / (strftime('%s', 'now') - tracksMapping.`FirstPlayDate`) as PlayFrequency, "
"( "
"SELECT tracksCover.`FileName` "
"FROM "
"`Tracks` tracksCover "
"WHERE "
"tracksCover.`HasEmbeddedCover` = 1 AND "
"tracksCover.`AlbumTitle` = album.`Title` AND "
"(tracksCover.`AlbumArtistName` = album.`ArtistName` OR "
"(tracksCover.`AlbumArtistName` IS NULL AND "
"album.`ArtistName` IS NULL "
") "
") AND "
"tracksCover.`AlbumPath` = album.`AlbumPath` "
") as EmbeddedCover "
"FROM "
"`Tracks` tracks, "
"`TracksData` tracksMapping "
"LEFT JOIN "
"`Albums` album "
"ON "
"tracks.`AlbumTitle` = album.`Title` AND "
"(tracks.`AlbumArtistName` = album.`ArtistName` OR tracks.`AlbumArtistName` IS NULL ) AND "
"tracks.`AlbumPath` = album.`AlbumPath` "
"LEFT JOIN `Composer` trackComposer ON trackComposer.`Name` = tracks.`Composer` "
"LEFT JOIN `Lyricist` trackLyricist ON trackLyricist.`Name` = tracks.`Lyricist` "
"LEFT JOIN `Genre` trackGenre ON trackGenre.`Name` = tracks.`Genre` "
"WHERE "
"tracks.`ID` = :trackId AND "
"tracksMapping.`FileName` = tracks.`FileName` AND "
"tracksMapping.`FileName` = :trackUrl "
"");
auto result = prepareQuery(d->mSelectTrackFromIdAndUrlQuery, selectTrackFromIdAndUrlQueryText);
if (!result) {
qCDebug(orgKdeElisaDatabase) << "DatabaseInterface::initRequest" << d->mSelectTrackFromIdAndUrlQuery.lastQuery();
qCDebug(orgKdeElisaDatabase) << "DatabaseInterface::initRequest" << d->mSelectTrackFromIdAndUrlQuery.lastError();
Q_EMIT databaseError();
}
}
{
auto selectRadioFromIdQueryText = QStringLiteral("SELECT "
"radios.`ID`, "
......@@ -7541,6 +7703,28 @@ DataTypes::TrackDataType DatabaseInterface::internalOneTrackPartialData(qulonglo
return result;
}
DataTypes::TrackDataType DatabaseInterface::internalOneTrackPartialDataByIdAndUrl(qulonglong databaseId, const QUrl &trackUrl)
{
auto result = DataTypes::TrackDataType{};
d->mSelectTrackFromIdAndUrlQuery.bindValue(QStringLiteral(":trackId"), databaseId);
d->mSelectTrackFromIdAndUrlQuery.bindValue(QStringLiteral(":trackUrl"), trackUrl);
if (!internalGenericPartialData(d->mSelectTrackFromIdAndUrlQuery)) {
return result;
}
if (d->mSelectTrackFromIdAndUrlQuery.next()) {
const auto &currentRecord = d->mSelectTrackFromIdAndUrlQuery.record();
result = buildTrackDataFromDatabaseRecord(currentRecord);
}
d->mSelectTrackFromIdAndUrlQuery.finish();
return result;
}
DataTypes::TrackDataType DatabaseInterface::internalOneRadioPartialData(qulonglong databaseId)
{
auto result = DataTypes::TrackDataType{};
......
......@@ -84,12 +84,16 @@ public:
DataTypes::TrackDataType trackDataFromDatabaseId(qulonglong id);
DataTypes::TrackDataType trackDataFromDatabaseIdAndUrl(qulonglong id, const QUrl &trackUrl);
DataTypes::TrackDataType radioDataFromDatabaseId(qulonglong id);
qulonglong trackIdFromTitleAlbumTrackDiscNumber(const QString &title, const QString &artist, const std::optional<QString> &album, std::optional<int> trackNumber, std::optional<int> discNumber);
qulonglong trackIdFromFileName(const QUrl &fileName);
qulonglong radioIdFromFileName(const QUrl &fileName);
void applicationAboutToQuit();
Q_SIGNALS:
......@@ -263,6 +267,8 @@ private:
DataTypes::TrackDataType internalOneTrackPartialData(qulonglong databaseId);
DataTypes::TrackDataType internalOneTrackPartialDataByIdAndUrl(qulonglong databaseId, const QUrl &trackUrl);
DataTypes::TrackDataType internalOneRadioPartialData(qulonglong databaseId);
DataTypes::ListGenreDataType internalAllGenresPartialData();
......
......@@ -209,7 +209,7 @@ void ElisaApplication::activateRequested(const QStringList &arguments, const QSt
continue;
}
realArguments.push_back(ElisaUtils::EntryData{0, oneArgument});
realArguments.push_back(ElisaUtils::EntryData{0, {}, QUrl(oneArgument)});
}
Q_EMIT enqueue(checkFileListAndMakeAbsolute(realArguments, workingDirectory),
......@@ -287,19 +287,30 @@ void ElisaApplication::scrub() {}
void ElisaApplication::playPause() {}
ElisaUtils::EntryDataList ElisaApplication::checkFileListAndMakeAbsolute(const ElisaUtils::EntryDataList &filesList,
const QString &workingDirectory) const
const QString &workingDirectory) const
{
auto filesToOpen = ElisaUtils::EntryDataList{};
for (const auto &oneFile : filesList) {
auto newFile = QFileInfo(std::get<1>(oneFile));
if (std::get<2>(oneFile).scheme().isEmpty() || std::get<2>(oneFile).isLocalFile()) {
auto newFile = QFileInfo(std::get<2>(oneFile).toLocalFile());
if (std::get<2>(oneFile).scheme().isEmpty()) {
newFile = QFileInfo(std::get<2>(oneFile).toString());
}
if (newFile.isRelative()) {
newFile = QFileInfo(workingDirectory + QLatin1String("/") + std::get<1>(oneFile));
}
if (newFile.isRelative()) {
if (std::get<2>(oneFile).scheme().isEmpty()) {
newFile.setFile(workingDirectory, std::get<2>(oneFile).toString());
} else {
newFile.setFile(workingDirectory, std::get<2>(oneFile).toLocalFile());
}
}
if (newFile.exists()) {
filesToOpen.push_back(ElisaUtils::EntryData{0, newFile.canonicalFilePath()});
if (newFile.exists()) {
filesToOpen.push_back(ElisaUtils::EntryData{0, {}, QUrl::fromLocalFile(newFile.canonicalFilePath())});
}
} else {
filesToOpen.push_back(ElisaUtils::EntryData{0, {}, std::get<2>(oneFile)});
}
}
......
......@@ -21,6 +21,7 @@
#include "elisaLib_export.h"
#include <QList>
#include <QUrl>
#include <QString>
#include <QMetaObject>
#include <QMetaType>
......@@ -43,7 +44,7 @@ enum PlayListEnqueueTriggerPlay {
Q_ENUM_NS(PlayListEnqueueTriggerPlay)
using EntryData = std::tuple<qulonglong, QString>;
using EntryData = std::tuple<qulonglong, QString, QUrl>;
using EntryDataList = QList<EntryData>;
enum PlayListEntryType {
......
......@@ -167,7 +167,7 @@ int main(int argc, char *argv[])
auto realArgumentsList = parser.positionalArguments();
for (auto oneArgument : realArgumentsList) {
arguments.push_back(ElisaUtils::EntryData{0, oneArgument});
arguments.push_back(ElisaUtils::EntryData{{}, {}, QUrl(oneArgument)});
}
myApp->setArguments(arguments);
......
......@@ -433,27 +433,49 @@ void MediaPlayList::enqueueArtist(const QString &artistName)
Q_EMIT persistentStateChanged();
}
void MediaPlayList::enqueueFilesList(const ElisaUtils::EntryDataList &newEntries)
void MediaPlayList::enqueueFilesList(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType)
{
qCDebug(orgKdeElisaPlayList()) << "MediaPlayList::enqueueFilesList";
enqueueCommon();
beginInsertRows(QModelIndex(), d->mData.size(), d->mData.size() + newEntries.size() - 1);
for (const auto &oneTrackUrl : newEntries) {
auto newEntry = MediaPlayListEntry(QUrl::fromLocalFile(std::get<1>(oneTrackUrl)));
newEntry.mEntryType = ElisaUtils::FileName;
d->mData.push_back(newEntry);
d->mTrackData.push_back({});
if (newEntry.mTrackUrl.isValid()) {
auto entryURL = newEntry.mTrackUrl.toUrl();
if (entryURL.isLocalFile()) {
auto entryString = entryURL.toLocalFile();
QFileInfo newTrackFile(entryString);
if (newTrackFile.exists()) {
switch (databaseIdType)
{
case ElisaUtils::Radio:
case ElisaUtils::Track:
case ElisaUtils::FileName:
{
const auto &trackUrl = std::get<2>(oneTrackUrl);
auto newEntry = MediaPlayListEntry(trackUrl);
newEntry.mEntryType = databaseIdType;
d->mData.push_back(newEntry);
if (std::get<2>(oneTrackUrl).isValid()) {
if (std::get<2>(oneTrackUrl).isLocalFile()) {
d->mTrackData.push_back({{DataTypes::ColumnsRoles::ResourceRole, trackUrl}});
auto entryString = std::get<2>(oneTrackUrl).toLocalFile();
QFileInfo newTrackFile(entryString);
if (newTrackFile.exists()) {
d->mData.last().mIsValid = true;
}
} else {
d->mTrackData.push_back({{DataTypes::ColumnsRoles::ResourceRole, trackUrl},
{DataTypes::ColumnsRoles::TitleRole, trackUrl.fileName()}});
d->mData.last().mIsValid = true;
}
Q_EMIT newEntryInList(0, entryString, newEntry.mEntryType);
Q_EMIT newUrlInList(std::get<2>(oneTrackUrl), newEntry.mEntryType);
} else {
d->mTrackData.push_back({});
}
break;
}
case ElisaUtils::Album:
case ElisaUtils::Artist:
case ElisaUtils::Genre:
case ElisaUtils::Lyricist:
case ElisaUtils::Composer:
case ElisaUtils::Unknown:
break;
}
}
endInsertRows();
......@@ -519,9 +541,17 @@ void MediaPlayList::enqueueMultipleEntries(const ElisaUtils::EntryDataList &entr
beginInsertRows(QModelIndex(), d->mData.size(), d->mData.size() + entriesData.size() - 1);
for (const auto &entryData : entriesData) {
d->mData.push_back(MediaPlayListEntry{std::get<0>(entryData), std::get<1>(entryData), type});
if (std::get<2>(entryData).isValid()) {
d->mData.push_back(MediaPlayListEntry{std::get<2>(entryData)});
} else {
d->mData.push_back(MediaPlayListEntry{std::get<0>(entryData), std::get<1>(entryData), type});
}
d->mTrackData.push_back({});
Q_EMIT newEntryInList(std::get<0>(entryData), std::get<1>(entryData), type);
if (std::get<2>(entryData).isValid()) {
Q_EMIT newUrlInList(std::get<2>(entryData), type);
} else {
Q_EMIT newEntryInList(std::get<0>(entryData), std::get<1>(entryData), type);
}
}
endInsertRows();
......@@ -672,7 +702,14 @@ void MediaPlayList::enqueue(qulonglong newEntryDatabaseId,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(ElisaUtils::EntryData{newEntryDatabaseId, newEntryTitle}, databaseIdType, enqueueMode, triggerPlay);
enqueue(ElisaUtils::EntryData{newEntryDatabaseId, newEntryTitle, {}}, databaseIdType, enqueueMode, triggerPlay);
}
void MediaPlayList::enqueue(const QUrl &entryUrl, ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay)
{
enqueue(ElisaUtils::EntryData{{}, {}, entryUrl}, databaseIdType, enqueueMode, triggerPlay);
}
void MediaPlayList::enqueue(const ElisaUtils::EntryData &newEntry,
......@@ -694,12 +731,18 @@ void MediaPlayList::enqueue(const ElisaUtils::EntryData &newEntry,
case ElisaUtils::Album:
case ElisaUtils::Artist:
case ElisaUtils::Genre:
enqueueOneEntry(newEntry, databaseIdType);
break;
case ElisaUtils::Track:
case ElisaUtils::Radio:
enqueueOneEntry(newEntry, databaseIdType);
if (std::get<2>(newEntry).isValid()) {
enqueueFilesList({newEntry}, databaseIdType);
} else {
enqueueOneEntry(newEntry, databaseIdType);
}
break;
case ElisaUtils::FileName:
enqueueFilesList({newEntry});
enqueueFilesList({newEntry}, databaseIdType);
break;
case ElisaUtils::Lyricist:
case ElisaUtils::Composer:
......@@ -738,10 +781,10 @@ void MediaPlayList::enqueue(const ElisaUtils::EntryDataList &newEntries,
{
case ElisaUtils::Track:
case ElisaUtils::Radio:
enqueueTracksListById(newEntries, databaseIdType);
enqueueMultipleEntries(newEntries, databaseIdType);
break;
case ElisaUtils::FileName:
enqueueFilesList(newEntries);
enqueueFilesList(newEntries, databaseIdType);
break;
case ElisaUtils::Album:
case ElisaUtils::Artist:
......@@ -1245,7 +1288,7 @@ void MediaPlayList::loadPlayListLoaded()
clearPlayList();
for (int i = 0; i < d->mLoadPlaylist.mediaCount(); ++i) {
enqueue(ElisaUtils::EntryData{0, d->mLoadPlaylist.media(i).canonicalUrl().toLocalFile()}, ElisaUtils::FileName);
enqueue(ElisaUtils::EntryData{{}, {}, d->mLoadPlaylist.media(i).canonicalUrl()}, ElisaUtils::FileName);
}
restorePlayListPosition();
......
......@@ -200,6 +200,9 @@ Q_SIGNALS:
const QString &entryTitle,
ElisaUtils::PlayListEntryType databaseIdType);
void newUrlInList(const QUrl &entryUrl,
ElisaUtils::PlayListEntryType databaseIdType);
void persistentStateChanged();
void musicListenersManagerChanged();
......@@ -272,6 +275,11 @@ public Q_SLOTS:
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(const QUrl &entryUrl,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
ElisaUtils::PlayListEnqueueTriggerPlay triggerPlay);
void enqueue(const ElisaUtils::EntryData &newEntry,
ElisaUtils::PlayListEntryType databaseIdType,
ElisaUtils::PlayListEnqueueMode enqueueMode,
......@@ -319,7 +327,7 @@ private:
void enqueueArtist(const QString &artistName);
void enqueueFilesList(const ElisaUtils::EntryDataList &newEntries);
void enqueueFilesList(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType databaseIdType);
void enqueueTracksListById(const ElisaUtils::EntryDataList &newEntries, ElisaUtils::PlayListEntryType type);
......
......@@ -224,7 +224,8 @@ void ModelDataLoader::loadDataByGenreAndArtist(ElisaUtils::PlayListEntryType dat
}
}
void ModelDataLoader::loadDataByDatabaseId(ElisaUtils::PlayListEntryType dataType, qulonglong databaseId)
void ModelDataLoader::loadDataByDatabaseIdAndUrl(ElisaUtils::PlayListEntryType dataType,
qulonglong databaseId, const QUrl &url)
{
if (!d->mDatabase) {
return;
......@@ -236,7 +237,7 @@ void ModelDataLoader::loadDataByDatabaseId(ElisaUtils::PlayListEntryType dataTyp
switch (dataType)
{
case ElisaUtils::Track:
Q_EMIT allTrackData(d->mDatabase->trackDataFromDatabaseId(databaseId));
Q_EMIT allTrackData(d->mDatabase->trackDataFromDatabaseIdAndUrl(databaseId, url));
break;
case ElisaUtils::Radio:
Q_EMIT allRadioData(d->mDatabase->radioDataFromDatabaseId(databaseId));
......@@ -252,6 +253,34 @@ void ModelDataLoader::loadDataByDatabaseId(ElisaUtils::PlayListEntryType dataTyp
}
}
void ModelDataLoader::loadDataByUrl(ElisaUtils::PlayListEntryType dataType, const QUrl &url)
{