File src/command.cpp changed (mode: 100644) (index e280f5d..7051fcb) |
... |
... |
Control::update_queue() |
1703 |
1703 |
} |
} |
1704 |
1704 |
|
|
1705 |
1705 |
/* |
/* |
1706 |
|
* Stores the currently playing song in _song |
|
1707 |
|
* FIXME: dubious return value |
|
|
1706 |
|
* Retrieves the currently playing song from MPD, and caches it locally. |
|
1707 |
|
* |
|
1708 |
|
* Returns true on success, false on failure. |
1708 |
1709 |
*/ |
*/ |
1709 |
1710 |
bool |
bool |
1710 |
1711 |
Control::get_current_song() |
Control::get_current_song() |
1711 |
1712 |
{ |
{ |
|
1713 |
|
bool status_ok; |
1712 |
1714 |
struct mpd_song * song; |
struct mpd_song * song; |
1713 |
1715 |
|
|
1714 |
1716 |
EXIT_IDLE; |
EXIT_IDLE; |
1715 |
1717 |
|
|
1716 |
|
if ((song = mpd_run_current_song(conn->h())) == NULL) { |
|
1717 |
|
return false; |
|
|
1718 |
|
song = mpd_run_current_song(conn->h()); |
|
1719 |
|
status_ok = get_error_bool(); |
|
1720 |
|
|
|
1721 |
|
if (!status_ok) { |
|
1722 |
|
return status_ok; |
1718 |
1723 |
} |
} |
1719 |
1724 |
|
|
1720 |
1725 |
if (_song != NULL) { |
if (_song != NULL) { |
1721 |
1726 |
delete _song; |
delete _song; |
|
1727 |
|
_song = NULL; |
1722 |
1728 |
} |
} |
1723 |
1729 |
|
|
1724 |
|
_song = new Song(song); |
|
1725 |
|
|
|
1726 |
|
mpd_song_free(song); |
|
|
1730 |
|
if (song) { |
|
1731 |
|
_song = new Song(song); |
|
1732 |
|
mpd_song_free(song); |
|
1733 |
|
} |
1727 |
1734 |
|
|
1728 |
1735 |
return get_error_bool(); |
return get_error_bool(); |
1729 |
1736 |
} |
} |