diff --git a/PKGBUILD b/PKGBUILD index c487010d7ff9c14f968afffc25661f213a152fa3..80eda5ce0b7ee6f6aa86f925a654f6d72cf83cdb 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Maël 'Kubat' MARTIN <mael.martin31@gmail.com> pkgname=lektor -pkgver=mk7.818.a4f399d +pkgver=mk7.956.1e4b3aa pkgrel=1 pkgdesc="The lektor kara player, from the Bakaclub" arch=(x86_64 i686) diff --git a/inc/lektor/commands.h b/inc/lektor/commands.h index 617046afe664f37f5bbd4af2bf5ae855f76cef8e..a75b27a73f6cd01c828a9605702476146662e8be 100644 --- a/inc/lektor/commands.h +++ b/inc/lektor/commands.h @@ -31,6 +31,7 @@ bool command_set_pos(volatile sqlite3 *db, struct lkt_win *win, mpd_idle_flag *w bool command_add (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr, int priority); bool command_addid (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr); +bool command_multiaddid (volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr); bool command_del (volatile sqlite3 *db, struct lkt_win *win, char *pos_range, mpd_idle_flag *watch_mask_ptr); bool command_delid (volatile sqlite3 *db, struct lkt_win *win, char *id, mpd_idle_flag *watch_mask_ptr); bool command_clear (volatile sqlite3 *db, mpd_idle_flag *watch_mask_ptr); diff --git a/inc/lektor/database.h b/inc/lektor/database.h index 080c507b0b88f84e734a54abe5a8c3fa6cd76863..87c63aa1f5fcfea8ec479d0fd679987b09402b90 100644 --- a/inc/lektor/database.h +++ b/inc/lektor/database.h @@ -55,6 +55,7 @@ void database_update_touch (volatile sqlite3 *db, int id); /* Control the content of the queue. */ bool database_queue_add_uri(volatile sqlite3 *db, struct lkt_uri *uri, int priority); +bool database_queue_add_id(volatile sqlite3 *db, int id, int priority); bool database_queue_del_id (volatile sqlite3 *db, int id); bool database_queue_del_pos(volatile sqlite3 *db, int pos); bool database_queue_clear (volatile sqlite3 *db); diff --git a/src/commands.c b/src/commands.c index a4b34dba0172ee2f7eb35c07706c8e64f748f4b2..0e615fe644c46e1398c43f83b42a1d1f99f55f76 100644 --- a/src/commands.c +++ b/src/commands.c @@ -278,6 +278,36 @@ command_addid(volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ return database_queue_add_uri(db, &uri, 1); } +bool +command_multiaddid(volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr) +{ + UNUSED(win); + RETURN_UNLESS(args, "Invalid argument", false); + long id; + char *endptr = NULL, err = 0; + struct lkt_uri uri = { .type = uri_id }; + *watch_mask_ptr |= MPD_IDLE_PLAYLIST; + STRTOL(id, args[0], endptr, err); + RETURN_IF(err, "STRTOL failed", false); + uri.value = (void *) (size_t) id; + return database_queue_add_uri(db, &uri, 1); + /* + UNUSED(win); + RETURN_UNLESS(args, "Invalid argument", false); + long id; + char *endptr = malloc(sizeof(char)), err = 0; + *watch_mask_ptr |= MPD_IDLE_PLAYLIST; + //STRTOL(id, args[0], endptr, err); + while ( (id=strtol(args[0], &endptr, 10)) != 0 ) + { + RETURN_IF(err, "STRTOL failed", false); + database_queue_add_id(db, id, 1); + args[0] = endptr; + } + return true; + */ +} + inline bool command_clear(volatile sqlite3 *db, mpd_idle_flag *watch_mask_ptr) { diff --git a/src/mkv/mkv.c b/src/mkv/mkv.c index ff5164427ff0220ce289e4a17e55088c6bd46452..d1384bc1d1888609c5b165f95dff1cf7e071d550 100644 --- a/src/mkv/mkv.c +++ b/src/mkv/mkv.c @@ -403,6 +403,8 @@ mkv_seek_tags(struct bufferfd *bf, size_t header_len) while (seekhead_len > 0) { struct mkv_seek s; + s.id = 0; + s.pos = 0; uint32_t eid; ssize_t n; diff --git a/src/net/listen.c b/src/net/listen.c index daad13d8ace43a705fab6f62d904f8fca86c571f..4eb1b1fe9a62c5c6df78d385e06ceaf304cba2c5 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -228,6 +228,8 @@ handle_simple_command(struct lkt_state *srv, size_t c, struct lkt_command cmd) err = !command_add((sqlite3 *) srv->db, &srv->win, cmd.args, &srv->mpd_idle_events, 1); else if (STR_MATCH(cmd.name, "addid")) err = !command_addid((sqlite3 *) srv->db, &srv->win, cmd.args, &srv->mpd_idle_events); + else if (STR_MATCH(cmd.name, "multiaddid")) + err = !command_multiaddid((sqlite3 *) srv->db, &srv->win, cmd.args, &srv->mpd_idle_events); else if (STR_MATCH(cmd.name, "deleteid")) err = ! (cmd.args[0] != NULL && command_delid((sqlite3 *) srv->db, &srv->win, cmd.args[0], &srv->mpd_idle_events));