xaizek / pms (License: GPLv3+) (since 2018-12-07)
Older version of Practical Music Search written in C++.
Commit d18d0941e7447536dadef06802d9b35e368d02d3

Fix return value of get_current_song()
Author: Kim Tore Jensen
Author date (UTC): 2015-08-21 15:17
Committer name: Kim Tore Jensen
Committer date (UTC): 2015-08-21 15:17
Parent(s): 138bc778e804795153bb636b124f672a0330fff2
Signing key:
Tree: 91ac8d61760721b70c3ac8f6564a9b0f9ed8dfa9
File Lines added Lines deleted
src/command.cpp 14 7
src/pms.cpp 1 1
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 } }
File src/pms.cpp changed (mode: 100644) (index dd06808..cd2e424)
... ... bool Pms::run_shell(string cmd)
1006 1006 */ */
1007 1007 Song * Pms::cursong() Song * Pms::cursong()
1008 1008 { {
1009 if (!comm) return NULL;
1009 assert(comm != NULL);
1010 1010 return comm->song(); return comm->song();
1011 1011 } }
1012 1012
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/pms

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/pms

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master