Permalink
Browse files

albumartist

  • Loading branch information...
fuchsmich committed Nov 19, 2017
1 parent 35ec176 commit c794da71dde16d30e6f6b7e6966e658328715554
Showing with 58 additions and 7 deletions.
  1. +13 −0 qml/pages/settings/GUISettings.qml
  2. +1 −1 rpm/harbour-smpc.yaml
  3. +6 −0 src/controller.cpp
  4. +1 −0 src/controller.h
  5. +32 −6 src/mpd/networkaccess.cpp
  6. +5 −0 src/mpd/networkaccess.h
@@ -115,6 +115,19 @@ Page {
}
}
}
TextSwitch{
id: albumArtistSwitch
text: qsTr("use albumartist in artists view")
checked: artistsViewUseAlbumArtist
onClicked: {
if ( checked ) {
newSettingKey(["artistsViewUseAlbumArtist","1"]);
} else {
newSettingKey(["artistsViewUseAlbumArtist","0"]);
}
// mCurrentSongPage = null;
}
}
TextSwitch{
id: coverNowPlayingSwitch
text: qsTr("show cover in now playing")
View
@@ -1,7 +1,7 @@
Name: harbour-smpc
Summary: SailfishOS Port of qmobilempd client
URL: https://github.com/djselbeck/smpc
Version: 1.3.3
Version: 1.3.3.1
Release: 1
Group: Qt/Qt
License: GPLv3
View
@@ -511,6 +511,7 @@ void Controller::readSettings()
mSectionsInSearch = settings.value("sections_in_search",1).toInt();
mSectionsInPlaylist = settings.value("sections_in_playlist",1).toInt();
mDownloadEnabled = settings.value("lastfm_download",1).toInt();
mNetAccess->setUseAlbumArtist(settings.value("artist_view_albumartist",0).toInt());
mCoverInNowPlaying = settings.value("show_covernowplaying",1).toInt();
mShowModeLandscape = settings.value("useShowView",1).toInt();
@@ -522,6 +523,7 @@ void Controller::readSettings()
mQuickView->rootContext()->setContextProperty("sectionsInSearch", mSectionsInSearch);
mQuickView->rootContext()->setContextProperty("sectionsInPlaylist", mSectionsInPlaylist);
mQuickView->rootContext()->setContextProperty("lastfmEnabled", mDownloadEnabled);
mQuickView->rootContext()->setContextProperty("artistsViewUseAlbumArtist", mNetAccess->useAlbumArtist());
mQuickView->rootContext()->setContextProperty("showCoverNowPlaying", mCoverInNowPlaying);
mQuickView->rootContext()->setContextProperty("useShowView", mShowModeLandscape);
@@ -565,6 +567,7 @@ void Controller::writeSettings()
settings.setValue("sections_in_search",mSectionsInSearch);
settings.setValue("sections_in_playlist",mSectionsInPlaylist);
settings.setValue("lastfm_download",mDownloadEnabled);
settings.setValue("artist_view_albumartist",mNetAccess->useAlbumArtist());
settings.setValue("show_covernowplaying",mCoverInNowPlaying);
settings.setValue("useShowView",mShowModeLandscape);
settings.endGroup();
@@ -870,6 +873,9 @@ void Controller::receiveSettingKey(QVariant setting)
mDownloadEnabled = settings.at(1).toInt();
mQuickView->rootContext()->setContextProperty("lastfmEnabled", mDownloadEnabled);
emit newDownloadEnabled(mDownloadEnabled);
} else if ( settings.at(0) == "artistsViewUseAlbumArtist" ) {
mNetAccess->setUseAlbumArtist(settings.at(1).toInt());
mQuickView->rootContext()->setContextProperty("artistsViewUseAlbumArtist", mNetAccess->useAlbumArtist());
} else if ( settings.at(0) == "showCoverNowPlaying" ) {
mCoverInNowPlaying = settings.at(1).toInt();
mQuickView->rootContext()->setContextProperty("showCoverNowPlaying", mCoverInNowPlaying);
View
@@ -141,6 +141,7 @@ public slots:
int mListImageSize;
int mSectionsInSearch;
int mSectionsInPlaylist;
int mArtistsViewUseAlbumArtist;
int mCoverInNowPlaying;
int mShowModeLandscape;
View
@@ -199,7 +199,11 @@ QList<MpdArtist*> *NetworkAccess::getArtists_prv()
if (connected()) {
//Start getting list from mpd
//Send request
sendMPDCommand("list artist\n");
if (mUseAlbumArtist) {
sendMPDCommand("list albumartist\n");
} else {
sendMPDCommand("list artist\n");
}
//Read & parse all artists until OK send from mpd
QString response ="";
@@ -215,9 +219,15 @@ QList<MpdArtist*> *NetworkAccess::getArtists_prv()
response = QString::fromUtf8(mTCPSocket->readLine());
response.chop(1);
/* Parse mpd output */
if (response.startsWith("Artist: "))
QString artistString;
if (mUseAlbumArtist) {
artistString = "AlbumArtist: ";
} else {
artistString = "Artist: ";
}
if (response.startsWith(artistString))
{
name = response.right(response.length()-8);
name = response.right(response.length() - artistString.length());
tempartist = new MpdArtist(NULL,name);
/* This helps with qml Q_PROPERTY accesses */
tempartist->moveToThread(mQMLThread);
@@ -284,7 +294,13 @@ QList<MpdAlbum*> *NetworkAccess::getArtistsAlbums_prv(QString artist)
//Send request
artist = artist.replace('\"',"\\\"");
if ( mServerInfo->getListFilterSupported() && mServerInfo->getListGroupSupported() ) {
sendMPDCommand(QString("list album artist \"") + artist + "\"" + " group MUSICBRAINZ_ALBUMID\n");
QString artistString;
if (mUseAlbumArtist) {
artistString = "albumartist";
} else {
artistString = "artist";
}
sendMPDCommand(QString("list album ") + artistString + (" \"") + artist + "\"" + " group MUSICBRAINZ_ALBUMID\n");
} else {
sendMPDCommand(QString("list album \"") + artist + "\"\n");
}
@@ -1662,7 +1678,7 @@ QList<MpdTrack*>* NetworkAccess::parseMPDTracks(QString cartist)
if (temptrack!=NULL)
{
// Discard track if artist filter mismatches
if (artist==cartist||cartist=="") {
if (albumartist==cartist||artist==cartist||cartist=="") {
temptracks->append(temptrack);
artistMBID = "";
temptrack->moveToThread(mQMLThread);
@@ -1738,7 +1754,7 @@ QList<MpdTrack*>* NetworkAccess::parseMPDTracks(QString cartist)
}
if (temptrack!=NULL)
{
if (artist==cartist||cartist=="") {
if (albumartist==cartist||artist==cartist||cartist=="") {
temptrack->setPlaying(false);
temptracks->append(temptrack);
temptrack->moveToThread(mQMLThread);
@@ -1894,6 +1910,16 @@ MPDPlaybackStatus *NetworkAccess::getMPDPlaybackStatus() {
return mPlaybackStatus;
}
void NetworkAccess::setUseAlbumArtist(int state)
{
mUseAlbumArtist = (state == 1);
}
int NetworkAccess::useAlbumArtist()
{
return mUseAlbumArtist*1;
}
MPD_PLAYBACK_STATE NetworkAccess::getPlaybackState()
{
MPD_PLAYBACK_STATE playbackState = MPD_STOP;
View
@@ -82,6 +82,9 @@ class NetworkAccess : public QThread
*/
MPDPlaybackStatus *getMPDPlaybackStatus();
void setUseAlbumArtist(int state);
int useAlbumArtist();
signals:
/* Connection signals */
@@ -697,6 +700,8 @@ protected slots:
* @return
*/
bool authenticate(QString passwort);
bool mUseAlbumArtist;
};
#endif // NETWORKACCESS_H

0 comments on commit c794da7

Please sign in to comment.