summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index c0e943cf37..1822db844f 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -434,7 +434,7 @@ static int update_control_unlocked(struct playlist_info* playlist,
434 result = write(fd, "R\n", 2); 434 result = write(fd, "R\n", 2);
435 break; 435 break;
436 case PLAYLIST_COMMAND_CLEAR: 436 case PLAYLIST_COMMAND_CLEAR:
437 result = write(fd, "C\n", 2); 437 result = fdprintf(fd, "C:%d\n", i1);
438 break; 438 break;
439 case PLAYLIST_COMMAND_FLAGS: 439 case PLAYLIST_COMMAND_FLAGS:
440 result = fdprintf(fd, "F:%u:%u\n", i1, i2); 440 result = fdprintf(fd, "F:%u:%u\n", i1, i2);
@@ -1178,7 +1178,6 @@ static int remove_all_tracks_unlocked(struct playlist_info *playlist, bool write
1178#endif 1178#endif
1179 1179
1180 /* Update playlist state as if by remove_track_unlocked() */ 1180 /* Update playlist state as if by remove_track_unlocked() */
1181 playlist->index = 0;
1182 playlist->first_index = 0; 1181 playlist->first_index = 0;
1183 playlist->amount = 1; 1182 playlist->amount = 1;
1184 playlist->indices[0] |= PLAYLIST_QUEUED; 1183 playlist->indices[0] |= PLAYLIST_QUEUED;
@@ -1191,10 +1190,12 @@ static int remove_all_tracks_unlocked(struct playlist_info *playlist, bool write
1191 if (write && playlist->control_fd >= 0) 1190 if (write && playlist->control_fd >= 0)
1192 { 1191 {
1193 update_control_unlocked(playlist, PLAYLIST_COMMAND_CLEAR, 1192 update_control_unlocked(playlist, PLAYLIST_COMMAND_CLEAR,
1194 -1, -1, NULL, NULL, NULL); 1193 playlist->index, -1, NULL, NULL, NULL);
1195 sync_control_unlocked(playlist); 1194 sync_control_unlocked(playlist);
1196 } 1195 }
1197 1196
1197 playlist->index = 0;
1198
1198 return 0; 1199 return 0;
1199} 1200}
1200 1201
@@ -3353,6 +3354,8 @@ int playlist_resume(void)
3353 } 3354 }
3354 case PLAYLIST_COMMAND_CLEAR: 3355 case PLAYLIST_COMMAND_CLEAR:
3355 { 3356 {
3357 if (strp[0])
3358 playlist->index = atoi(strp[0]);
3356 if (remove_all_tracks_unlocked(playlist, false) < 0) 3359 if (remove_all_tracks_unlocked(playlist, false) < 0)
3357 { 3360 {
3358 result = -16; 3361 result = -16;