commit 1620ea870db6afd4fa54246cd006eb6f60ab1744
parent 38eb5ec7b286085b505b4cd088c2b9638eb5ae00
Author: Louis Burda <quent.burda@gmail.com>
Date: Tue, 1 Mar 2022 21:01:21 +0100
Fixed minor bugs
Diffstat:
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/data.c b/src/data.c
@@ -490,6 +490,9 @@ track_rm(struct track *track, bool sync_fs)
/* remove from player queue */
link_pop(&track->link_pq);
+ /* remove from player history */
+ link_pop(&track->link_hs);
+
/* remove the reference as last used track */
if (player.track == track)
player.track = NULL;
@@ -517,8 +520,8 @@ aquire_lock(const char *datadir)
return false;
}
- fread(linebuf, 1, sizeof(linebuf), file);
- pid = atoi(linebuf);
+ fgets(linebuf, sizeof(linebuf), file);
+ pid = strtol(linebuf, NULL, 10);
procpath = aprintf("/proc/%i", pid);
OOM_CHECK(procpath);
if (path_exists(procpath)) {
diff --git a/src/player_mpd.c b/src/player_mpd.c
@@ -363,6 +363,7 @@ player_update(void)
current_song = mpd_run_current_song(mpd.conn);
if (current_song) {
+ free(player.track_name);
player.track_name = mpd_loaded_track_name(current_song);
OOM_CHECK(player.track_name);
player.loaded = true;
diff --git a/src/tui.c b/src/tui.c
@@ -504,7 +504,8 @@ delete_selected_track(void)
link = list_at(tracks_vis, track_nav.sel);
ASSERT(link != NULL);
track = tracks_vis_track(link);
- track_rm(track, true);
+ if (!track_rm(track, true))
+ CMD_SET_STATUS("Failed to remove track");
}
bool