Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 2025d3c6 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Handle case to delete current kara (not if the kara is the last)

parent 98e6c32f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!79Database update
...@@ -271,20 +271,30 @@ command_crop(volatile sqlite3 *db, mpd_idle_flag *watch_mask_ptr) ...@@ -271,20 +271,30 @@ command_crop(volatile sqlite3 *db, mpd_idle_flag *watch_mask_ptr)
bool bool
command_delid(volatile sqlite3 *db, struct lkt_win *win, char *id_str, mpd_idle_flag *watch_mask_ptr) command_delid(volatile sqlite3 *db, struct lkt_win *win, char *id_str, mpd_idle_flag *watch_mask_ptr)
{ {
UNUSED(win);
long id; long id;
char *endptr = NULL, err = 0; char *endptr = NULL, err = 0, filepath[PATH_MAX];
int uri = 0; int uri = 0;
*watch_mask_ptr |= MPD_IDLE_PLAYLIST;
STRTOL(id, id_str, endptr, err); STRTOL(id, id_str, endptr, err);
RETURN_IF(err, "STRTOL failed", false); RETURN_IF(err, "STRTOL failed", false);
/* If one day we allow suppression of the current kara, will need the `win`
pointer to reload the kara in the same position (but the kara won't be
the same). */
database_queue_current_kara(db, NULL, &uri); database_queue_current_kara(db, NULL, &uri);
RETURN_IF(id == (long) uri, "Can't delete current kara", false);
if (id == (long) uri) {
if (database_queue_skip_current(db, filepath)) {
if (!win->load_file(win, filepath)) {
LOG_ERROR_SCT("COMMAND", "Failed to skip current kara to delete id %ld", id);
return false;
}
}
else {
LOG_WARN_SCT("COMMAND", "Failed to skip current kara to delete id %ld, stop playback", id);
win->close(win);
}
}
*watch_mask_ptr |= MPD_IDLE_PLAYER;
return database_queue_del_id(db, id); return database_queue_del_id(db, id);
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter