From 35dcbd95c21ff1e726ce3b49e1631391ccb2d25c Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 21 May 2009 09:35:06 +0100 Subject: [PATCH] fix playlist saving when not playing --- mpc-car2pc.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/mpc-car2pc.c b/mpc-car2pc.c index 884bc93..9b9c206 100644 --- a/mpc-car2pc.c +++ b/mpc-car2pc.c @@ -1,3 +1,26 @@ +/* + * mpc-car2pc: Interface between Music Player Dæmon and Car2PC adapter + * + * http://www.musicpd.org/ + * http://www.car2pc.com/ + * + * Copyright © 2009 David Woodhouse + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #define _BSD_SOURCE #include @@ -237,15 +260,14 @@ int mainloop(void) if (sts->playlist != plid) { save_disc(); track = -1; + plid = sts->playlist; } if (sts->state == MPD_STATUS_STATE_PLAY) { - if (sts->song != track || - sts->playlist != plid) { + if (sts->song != track) { track = sts->song; send_car2pc_command("TR%03d", track + 1); send_song_info(); - plid = sts->playlist; track = sts->song; } if (sts->elapsedTime != last_time) { -- 2.50.1