|
|
|
@ -45,10 +45,7 @@ void Connection::Connect() |
|
|
|
assert(!m_connection); |
|
|
|
assert(!m_connection); |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_connection = std::shared_ptr<mpd_connection>( |
|
|
|
m_connection.reset(mpd_connection_new(m_host.c_str(), m_port, m_timeout * 1000)); |
|
|
|
mpd_connection_new(m_host.c_str(), m_port, m_timeout * 1000), |
|
|
|
|
|
|
|
mpd_connection_free |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
checkErrors(); |
|
|
|
checkErrors(); |
|
|
|
if (!m_password.empty()) |
|
|
|
if (!m_password.empty()) |
|
|
|
SendPassword(); |
|
|
|
SendPassword(); |
|
|
|
@ -298,7 +295,7 @@ SongIterator Connection::GetPlaylistChanges(unsigned version) |
|
|
|
prechecksNoCommandsList(); |
|
|
|
prechecksNoCommandsList(); |
|
|
|
mpd_send_queue_changes_meta(m_connection.get(), version); |
|
|
|
mpd_send_queue_changes_meta(m_connection.get(), version); |
|
|
|
checkErrors(); |
|
|
|
checkErrors(); |
|
|
|
return SongIterator(m_connection, mpd_recv_song); |
|
|
|
return SongIterator(m_connection.get(), mpd_recv_song); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Song Connection::GetCurrentSong() |
|
|
|
Song Connection::GetCurrentSong() |
|
|
|
@ -325,7 +322,7 @@ SongIterator Connection::GetPlaylistContent(const std::string &path) |
|
|
|
{ |
|
|
|
{ |
|
|
|
prechecksNoCommandsList(); |
|
|
|
prechecksNoCommandsList(); |
|
|
|
mpd_send_list_playlist_meta(m_connection.get(), path.c_str()); |
|
|
|
mpd_send_list_playlist_meta(m_connection.get(), path.c_str()); |
|
|
|
SongIterator result(m_connection, mpd_recv_song); |
|
|
|
SongIterator result(m_connection.get(), mpd_recv_song); |
|
|
|
checkErrors(); |
|
|
|
checkErrors(); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -334,7 +331,7 @@ SongIterator Connection::GetPlaylistContentNoInfo(const std::string &path) |
|
|
|
{ |
|
|
|
{ |
|
|
|
prechecksNoCommandsList(); |
|
|
|
prechecksNoCommandsList(); |
|
|
|
mpd_send_list_playlist(m_connection.get(), path.c_str()); |
|
|
|
mpd_send_list_playlist(m_connection.get(), path.c_str()); |
|
|
|
SongIterator result(m_connection, mpd_recv_song); |
|
|
|
SongIterator result(m_connection.get(), mpd_recv_song); |
|
|
|
checkErrors(); |
|
|
|
checkErrors(); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -664,7 +661,7 @@ SongIterator Connection::CommitSearchSongs() |
|
|
|
prechecksNoCommandsList(); |
|
|
|
prechecksNoCommandsList(); |
|
|
|
mpd_search_commit(m_connection.get()); |
|
|
|
mpd_search_commit(m_connection.get()); |
|
|
|
checkErrors(); |
|
|
|
checkErrors(); |
|
|
|
return SongIterator(m_connection, mpd_recv_song); |
|
|
|
return SongIterator(m_connection.get(), mpd_recv_song); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Connection::CommitSearchTags(StringConsumer f) |
|
|
|
void Connection::CommitSearchTags(StringConsumer f) |
|
|
|
@ -742,7 +739,7 @@ SongIterator Connection::GetSongs(const std::string &directory) |
|
|
|
prechecksNoCommandsList(); |
|
|
|
prechecksNoCommandsList(); |
|
|
|
mpd_send_list_meta(m_connection.get(), directory.c_str()); |
|
|
|
mpd_send_list_meta(m_connection.get(), directory.c_str()); |
|
|
|
checkErrors(); |
|
|
|
checkErrors(); |
|
|
|
return SongIterator(m_connection, mpd_recv_song); |
|
|
|
return SongIterator(m_connection.get(), mpd_recv_song); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OutputIterator Connection::GetOutputs() |
|
|
|
OutputIterator Connection::GetOutputs() |
|
|
|
@ -750,7 +747,7 @@ OutputIterator Connection::GetOutputs() |
|
|
|
prechecksNoCommandsList(); |
|
|
|
prechecksNoCommandsList(); |
|
|
|
mpd_send_outputs(m_connection.get()); |
|
|
|
mpd_send_outputs(m_connection.get()); |
|
|
|
checkErrors(); |
|
|
|
checkErrors(); |
|
|
|
return OutputIterator(m_connection, mpd_recv_output); |
|
|
|
return OutputIterator(m_connection.get(), mpd_recv_output); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Connection::EnableOutput(int id) |
|
|
|
void Connection::EnableOutput(int id) |
|
|
|
|