rsked/mpdclient.cc
/// Collect URIs for the songs of album with given (exact) name.
/// @returns number of URIs collected.
///
Collect URIs for the songs of album with given (exact) name.
Collect URIs for the songs of album with given ( exact ) name .
unsigned Mpd_client::search_album(const std::string &name,
                                  std::vector<std::string>& urivec)
{
    unsigned ns=0;
    connect();
    assert_connected();
    mpd_search_cancel(m_conn);
    bool rc =
        mpd_search_db_songs(m_conn,true)
        and mpd_search_add_tag_constraint(m_conn, MPD_OPERATOR_DEFAULT,
                                  MPD_TAG_ALBUM, name.c_str())
        and mpd_search_commit(m_conn);
    if (rc) {
        while(mpd_song *song = mpd_recv_song(m_conn)) {
            if (const char* uri=mpd_song_get_uri(song)) {
                urivec.push_back( uri );
                ++ns;
            }
            mpd_song_free( song );
        }
    } else {
        enum mpd_server_error serr;
        diag_error("search_album: ",serr);
        throw Mpd_search_exception();
    }
    return ns;
}
unsigned Mpd_client :: search_album ( const std :: string & name , std :: vector < std :: string > & urivec ) { unsigned ns = 0 ; connect ( ) ; assert_connected ( ) ; mpd_search_cancel ( m_conn ) ; bool rc = mpd_search_db_songs ( m_conn , true ) and mpd_search_add_tag_constraint ( m_conn , MPD_OPERATOR_DEFAULT , MPD_TAG_ALBUM , name . c_str ( ) ) and mpd_search_commit ( m_conn ) ; if ( rc ) { while ( mpd_song * song = mpd_recv_song ( m_conn ) ) { if ( const char * uri = mpd_song_get_uri ( song ) ) { urivec . push_back ( uri ) ; ++ ns ; } mpd_song_free ( song ) ; } } else { enum mpd_server_error serr ; diag_error ( " " , serr ) ; throw Mpd_search_exception ( ) ; } return ns ; }
Collect URIs for the songs of album with given (exact) name.
Collect URIs for the songs of album with given ( exact ) name .