make changes from 7b6521a3 compatible with <mpd-0.14
This commit is contained in:
@@ -101,6 +101,11 @@ void Connection::Disconnect()
|
||||
ClearQueue();
|
||||
}
|
||||
|
||||
float Connection::Version() const
|
||||
{
|
||||
return itsConnection ? itsConnection->version[1] + itsConnection->version[2]*0.1 : 0;
|
||||
}
|
||||
|
||||
void Connection::SetHostname(const string &host)
|
||||
{
|
||||
size_t at = host.find("@");
|
||||
|
||||
@@ -88,6 +88,8 @@ namespace MPD
|
||||
const std::string & GetHostname() { return itsHost; }
|
||||
int GetPort() { return itsPort; }
|
||||
|
||||
float Version() const;
|
||||
|
||||
void SetHostname(const std::string &);
|
||||
void SetPort(int port) { itsPort = port; }
|
||||
void SetTimeout(int timeout) { itsTimeout = timeout; }
|
||||
|
||||
@@ -55,6 +55,11 @@
|
||||
mLibAlbums->Display(); \
|
||||
mvvline(main_start_y, right_col_startx-1, 0, main_height); \
|
||||
mLibSongs->Display(); \
|
||||
if (mLibAlbums->Empty()) \
|
||||
{ \
|
||||
mLibAlbums->WriteXY(0, 0, 0, "No albums found."); \
|
||||
mLibAlbums->Refresh(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define REFRESH_PLAYLIST_EDITOR_SCREEN \
|
||||
@@ -530,7 +535,9 @@ int main(int argc, char *argv[])
|
||||
Mpd->CommitSearch(list);
|
||||
}
|
||||
|
||||
// check if there are songs without album tag
|
||||
// <mpd-0.14 doesn't support searching for empty tag
|
||||
if (Mpd->Version() > 13)
|
||||
{
|
||||
SongList noalbum_list;
|
||||
Mpd->StartSearch(1);
|
||||
Mpd->AddSearch(Config.media_lib_primary_tag, mLibArtists->Current());
|
||||
@@ -539,6 +546,7 @@ int main(int argc, char *argv[])
|
||||
if (!noalbum_list.empty())
|
||||
mLibAlbums->AddOption(make_pair("<no album>", ""));
|
||||
FreeSongList(noalbum_list);
|
||||
}
|
||||
|
||||
for (TagList::iterator it = list.begin(); it != list.end(); it++)
|
||||
{
|
||||
@@ -576,7 +584,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
mLibSongs->Clear(0);
|
||||
Mpd->StartSearch(1);
|
||||
Mpd->AddSearch(Config.media_lib_primary_tag, mLibArtists->Current());
|
||||
Mpd->AddSearch(Config.media_lib_primary_tag, locale_to_utf_cpy(mLibArtists->Current()));
|
||||
if (mLibAlbums->Empty()) // left for compatibility with <mpd-0.14
|
||||
{
|
||||
mLibAlbums->WriteXY(0, 0, 0, "No albums found.");
|
||||
mLibAlbums->Refresh();
|
||||
}
|
||||
else
|
||||
Mpd->AddSearch(MPD_TAG_ITEM_ALBUM, locale_to_utf_cpy(mLibAlbums->Current().second));
|
||||
Mpd->CommitSearch(list);
|
||||
|
||||
@@ -1966,8 +1980,10 @@ int main(int argc, char *argv[])
|
||||
wCurrent->Refresh();
|
||||
wCurrent = mLibAlbums;
|
||||
mLibAlbums->HighlightColor(Config.active_column_color);
|
||||
if (!mLibAlbums->Empty())
|
||||
continue;
|
||||
}
|
||||
else if (wCurrent == mLibAlbums && !mLibSongs->Empty())
|
||||
if (wCurrent == mLibAlbums && !mLibSongs->Empty())
|
||||
{
|
||||
mLibAlbums->HighlightColor(Config.main_highlight_color);
|
||||
wCurrent->Refresh();
|
||||
@@ -2020,8 +2036,10 @@ int main(int argc, char *argv[])
|
||||
wCurrent->Refresh();
|
||||
wCurrent = mLibAlbums;
|
||||
mLibAlbums->HighlightColor(Config.active_column_color);
|
||||
if (!mLibAlbums->Empty())
|
||||
continue;
|
||||
}
|
||||
else if (wCurrent == mLibAlbums)
|
||||
if (wCurrent == mLibAlbums)
|
||||
{
|
||||
mLibAlbums->HighlightColor(Config.main_highlight_color);
|
||||
wCurrent->Refresh();
|
||||
|
||||
@@ -131,7 +131,6 @@ void TraceMpdStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
//wHeader->WriteXY(0,1, IntoStr(now_playing), 1);
|
||||
}
|
||||
|
||||
void NcmpcppErrorCallback(Connection *Mpd, int errorid, const char *msg, void *)
|
||||
|
||||
Reference in New Issue
Block a user