diff --git a/PKGBUILD b/PKGBUILD index c487010d7ff9c14f968afffc25661f213a152fa3..298803707ad273232e5b0f2cb0cbd891440dd055 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.957.7f1fbc7 pkgrel=1 pkgdesc="The lektor kara player, from the Bakaclub" arch=(x86_64 i686) diff --git a/inc/lektor/database.h b/inc/lektor/database.h index 8f140317e34cc255c9cb4662b7f0b07d9b641540..1f6f802a4431227d6560ed9aa771f36656b170f7 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/inc/lektor/uri.h b/inc/lektor/uri.h index bf73b9fc1089d0cfe79759dae9df7bc4fe65ef9e..513091d46033659ff7a896d8ce2e7bca934efb29 100644 --- a/inc/lektor/uri.h +++ b/inc/lektor/uri.h @@ -21,7 +21,6 @@ struct lkt_uri { void *value; size_t id; }; - bool _allocated; }; diff --git a/src/commands.c b/src/commands.c index f6cc45073dadfa641d46ec2560fabedfe3ebbfc0..5a40fd84f8d6fbd6cc7baf00c463f2523e8ffa41 100644 --- a/src/commands.c +++ b/src/commands.c @@ -256,7 +256,9 @@ command_stop(volatile sqlite3 *db, struct lkt_win *win, mpd_idle_flag *watch_mas } bool -command_add(volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr, int priority) +command_add(volatile sqlite3 *db, struct lkt_win *win, + char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr, + int priority) { RETURN_UNLESS(args && args[0], "Invalid argument", false); *watch_mask_ptr |= MPD_IDLE_PLAYLIST; @@ -272,16 +274,19 @@ command_add(volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_AR } bool -command_addid(volatile sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], mpd_idle_flag *watch_mask_ptr) +command_addid(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); - char *endptr = NULL, err = 0; + errno = 0; + int i; struct lkt_uri uri = { .type = uri_id }; + for (i = 0; (uri.id = strtol(args[i], NULL, 0)) && ! errno; ++i) { + errno |= database_queue_add_id(db, uri.id, 1); + } *watch_mask_ptr |= MPD_IDLE_PLAYLIST; - STRTOL(uri.id, args[0], endptr, err); - RETURN_IF(err, "STRTOL failed", false); - return database_queue_add_uri(db, &uri, 1); + return ! errno; } inline bool 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 43a21ca36e0b99014ca77f3dc42a9062d6fa2164..a960160afe9fb2d154181ddbf16026788769b490 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -223,14 +223,20 @@ handle_simple_command(struct lkt_state *srv, size_t c, struct lkt_command cmd) err = !command_help(srv, c); else if (STR_MATCH(cmd.name, "__insert")) - err = !command_add(srv->db, &srv->win, cmd.args, &srv->mpd_idle_events, 5); - else if (STR_MATCH(cmd.name, "searchadd") || STR_MATCH(cmd.name, "findadd") || STR_MATCH(cmd.name, "add")) - err = !command_add(srv->db, &srv->win, cmd.args, &srv->mpd_idle_events, 1); + err = ! command_add(srv->db, &srv->win, cmd.args, + &srv->mpd_idle_events, 5); + else if (STR_MATCH(cmd.name, "searchadd") || + STR_MATCH(cmd.name, "findadd") || + STR_MATCH(cmd.name, "add")) + err = ! command_add(srv->db, &srv->win, cmd.args, + &srv->mpd_idle_events, 1); else if (STR_MATCH(cmd.name, "addid")) - err = !command_addid(srv->db, &srv->win, cmd.args, &srv->mpd_idle_events); + err = ! command_addid(srv->db, &srv->win, cmd.args, + &srv->mpd_idle_events); else if (STR_MATCH(cmd.name, "deleteid")) err = ! (cmd.args[0] != NULL && - command_delid(srv->db, &srv->win, cmd.args[0], &srv->mpd_idle_events)); + command_delid(srv->db, &srv->win, cmd.args[0], + &srv->mpd_idle_events)); else if (STR_MATCH(cmd.name, "playlistclear")) err = ! command_plt_clear(srv->db, cmd.args, &srv->mpd_idle_events);