* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
- * $Id$ */
+ */
#include "conky.h"
+#include "logging.h"
void init_mpd_stats(struct mpd_s *mpd)
{
*mpd->repeat = 0;
*mpd->track = 0;
*mpd->status = 0;
+ mpd->is_playing = 0;
mpd->bitrate = 0;
mpd->progress = 0;
mpd->elapsed = 0;
void *update_mpd(void *arg)
{
+ struct mpd_s *mpd;
+
if (arg == NULL) {
CRIT_ERR("update_mpd called with a null argument!");
}
- struct mpd_s *mpd = (struct mpd_s *) arg;
+ mpd = (struct mpd_s *) arg;
while (1) {
mpd_Status *status;
strncpy(mpd->status, "MPD not responding",
text_buffer_size - 1);
timed_thread_unlock(mpd->timed_thread);
- if (timed_thread_test(mpd->timed_thread)) {
+ if (timed_thread_test(mpd->timed_thread, 0)) {
timed_thread_exit(mpd->timed_thread);
}
continue;
strncpy(mpd->status, "MPD not responding",
text_buffer_size - 1);
timed_thread_unlock(mpd->timed_thread);
- if (timed_thread_test(mpd->timed_thread)) {
+ if (timed_thread_test(mpd->timed_thread, 0)) {
timed_thread_exit(mpd->timed_thread);
}
continue;
mpd_closeConnection(mpd->conn);
mpd->conn = 0;
timed_thread_unlock(mpd->timed_thread);
- if (timed_thread_test(mpd->timed_thread)) {
+ if (timed_thread_test(mpd->timed_thread, 0)) {
timed_thread_exit(mpd->timed_thread);
}
continue;
}
if (status->state == MPD_STATUS_STATE_PLAY
|| status->state == MPD_STATUS_STATE_PAUSE) {
+ mpd->is_playing = 1;
mpd->bitrate = status->bitRate;
mpd->progress = (float) status->elapsedTime /
status->totalTime;
mpd_closeConnection(mpd->conn);
mpd->conn = 0;
timed_thread_unlock(mpd->timed_thread);
- if (timed_thread_test(mpd->timed_thread)) {
+ if (timed_thread_test(mpd->timed_thread, 0)) {
timed_thread_exit(mpd->timed_thread);
}
continue;
mpd_closeConnection(mpd->conn);
mpd->conn = 0;
timed_thread_unlock(mpd->timed_thread);
- if (timed_thread_test(mpd->timed_thread)) {
+ if (timed_thread_test(mpd->timed_thread, 0)) {
timed_thread_exit(mpd->timed_thread);
}
continue;
// fprintf(stderr, "%s\n", mpd->conn->errorStr);
mpd_closeConnection(mpd->conn);
mpd->conn = 0;
- if (timed_thread_test(mpd->timed_thread)) {
+ if (timed_thread_test(mpd->timed_thread, 0)) {
timed_thread_exit(mpd->timed_thread);
}
continue;
mpd_closeConnection(mpd->conn);
mpd->conn = 0;
} */
- if (timed_thread_test(mpd->timed_thread)) {
+ if (timed_thread_test(mpd->timed_thread, 0)) {
timed_thread_exit(mpd->timed_thread);
}
continue;