more common way of handling example config files (like in ncmpc) + add a few
more functions to libmpdclient implementation
This commit is contained in:
@@ -533,6 +533,15 @@ void MPDConnection::StartSearch(bool exact_match) const
|
||||
mpd_startSearch(itsConnection, exact_match);
|
||||
}
|
||||
|
||||
void MPDConnection::StartFieldSearch(mpd_TagItems item)
|
||||
{
|
||||
if (isConnected)
|
||||
{
|
||||
itsSearchedField = item;
|
||||
mpd_startFieldSearch(itsConnection, item);
|
||||
}
|
||||
}
|
||||
|
||||
void MPDConnection::AddSearch(mpd_TagItems item, const string &str) const
|
||||
{
|
||||
if (isConnected)
|
||||
@@ -558,6 +567,23 @@ void MPDConnection::CommitSearch(SongList &v) const
|
||||
}
|
||||
}
|
||||
|
||||
void MPDConnection::CommitSearch(TagList &v) const
|
||||
{
|
||||
if (isConnected)
|
||||
{
|
||||
mpd_commitSearch(itsConnection);
|
||||
char *tag = NULL;
|
||||
while ((tag = mpd_getNextTag(itsConnection, itsSearchedField)) != NULL)
|
||||
{
|
||||
string s_tag = tag;
|
||||
if (v.empty() || v.back() != s_tag)
|
||||
v.push_back(s_tag);
|
||||
delete [] tag;
|
||||
}
|
||||
mpd_finishCommand(itsConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void MPDConnection::GetDirectory(const string &path, ItemList &v) const
|
||||
{
|
||||
if (isConnected)
|
||||
@@ -612,7 +638,7 @@ int MPDConnection::CheckForErrors()
|
||||
{
|
||||
int errid = 0;
|
||||
if (itsConnection->error)
|
||||
{
|
||||
{
|
||||
if (itsConnection->error == MPD_ERROR_ACK)
|
||||
{
|
||||
// this is to avoid setting too small max size as we check it before fetching current status
|
||||
|
||||
@@ -140,8 +140,10 @@ class MPDConnection
|
||||
bool SavePlaylist(const string &) const;
|
||||
|
||||
void StartSearch(bool) const;
|
||||
void StartFieldSearch(mpd_TagItems);
|
||||
void AddSearch(mpd_TagItems, const string &) const;
|
||||
void CommitSearch(SongList &v) const;
|
||||
void CommitSearch(SongList &) const;
|
||||
void CommitSearch(TagList &) const;
|
||||
|
||||
void GetArtists(TagList &) const;
|
||||
void GetAlbums(string, TagList &) const;
|
||||
@@ -173,6 +175,7 @@ class MPDConnection
|
||||
ErrorHandler itsErrorHandler;
|
||||
void *itsErrorHandlerUserdata;
|
||||
|
||||
mpd_TagItems itsSearchedField;
|
||||
std::vector<QueueCommand *> itsQueue;
|
||||
};
|
||||
|
||||
|
||||
@@ -1739,7 +1739,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
found_pos = 0;
|
||||
vFoundPositions.clear();
|
||||
|
||||
|
||||
if (mLibArtists->Empty())
|
||||
{
|
||||
Mpd->GetArtists(vArtists);
|
||||
@@ -1747,13 +1747,13 @@ int main(int argc, char *argv[])
|
||||
for (TagList::const_iterator it = vArtists.begin(); it != vArtists.end(); it++)
|
||||
mLibArtists->AddOption(*it);
|
||||
}
|
||||
|
||||
|
||||
mLibArtists->HighlightColor(Config.library_active_column_color);
|
||||
mLibAlbums->HighlightColor(Config.main_highlight_color);
|
||||
mLibSongs->HighlightColor(Config.main_highlight_color);
|
||||
|
||||
|
||||
wCurrent->Hide();
|
||||
|
||||
|
||||
REFRESH_MEDIA_LIBRARY_SCREEN;
|
||||
|
||||
wCurrent = mLibArtists;
|
||||
|
||||
Reference in New Issue
Block a user