diff --git a/inc/lektor/commands.h b/inc/lektor/commands.h index eea73378372ddb9af80a5dab9e96d2c2211f7c70..a7ada9fbd7854d1183a71aca85767ecfe5aa1feb 100644 --- a/inc/lektor/commands.h +++ b/inc/lektor/commands.h @@ -15,43 +15,39 @@ /* Querying lektor's status */ bool command_currentsong(struct lkt_state *srv, size_t c); -bool command_status(struct lkt_state *srv, size_t c); +bool command_status (struct lkt_state *srv, size_t c); /* Controlling playback */ -bool command_next(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); -bool command_pause(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); -bool command_previous(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); -bool command_play(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], - enum mpd_idle_flag *watch_mask_ptr); -bool command_stop(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); +bool command_next (sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); +bool command_pause (sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); +bool command_previous(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); +bool command_play (sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); +bool command_stop (sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr); bool command_set_pos(sqlite3 *db, struct lkt_win *win, enum mpd_idle_flag *watch_mask_ptr, int index); /* The queue */ -bool command_add(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], - enum mpd_idle_flag *watch_mask_ptr); -bool command_addid(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], - enum mpd_idle_flag *watch_mask_ptr); -bool command_del(sqlite3 *db, struct lkt_win *win, char *pos_range, enum mpd_idle_flag *watch_mask_ptr); -bool command_delid(sqlite3 *db, struct lkt_win *win, char *id, enum mpd_idle_flag *watch_mask_ptr); -bool command_clear(sqlite3 *db, enum mpd_idle_flag *watch_mask_ptr); -bool command_crop(sqlite3 *db, enum mpd_idle_flag *watch_mask_ptr); -bool command_move(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); -bool command_shuffle(sqlite3 *db, enum mpd_idle_flag *watch_mask_ptr); +bool command_add (sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); +bool command_addid (sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); +bool command_del (sqlite3 *db, struct lkt_win *win, char *pos_range, enum mpd_idle_flag *watch_mask_ptr); +bool command_delid (sqlite3 *db, struct lkt_win *win, char *id, enum mpd_idle_flag *watch_mask_ptr); +bool command_clear (sqlite3 *db, enum mpd_idle_flag *watch_mask_ptr); +bool command_crop (sqlite3 *db, enum mpd_idle_flag *watch_mask_ptr); +bool command_move (sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); +bool command_shuffle(sqlite3 *db, enum mpd_idle_flag *watch_mask_ptr); +bool command_playid (sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); + bool command_queue_list(struct lkt_state *srv, size_t c, char *args[LKT_MESSAGE_ARGS_MAX]); -bool command_playid(sqlite3 *db, struct lkt_win *win, char *args[LKT_MESSAGE_ARGS_MAX], - enum mpd_idle_flag *watch_mask_ptr); -bool command_queue_find(struct lkt_state *srv, size_t c, char *cmd_args[LKT_MESSAGE_ARGS_MAX], - long continuation); +bool command_queue_find(struct lkt_state *srv, size_t c, char *cmd_args[LKT_MESSAGE_ARGS_MAX], long continuation); /* The playlists */ bool command_plt_create(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); bool command_plt_remove(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); -bool command_plt_clear(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); +bool command_plt_clear (sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); bool command_plt_rename(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); bool command_plt_export(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); bool command_plt_import(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); -bool command_plt_add(sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); +bool command_plt_add (sqlite3 *db, char *args[LKT_MESSAGE_ARGS_MAX], enum mpd_idle_flag *watch_mask_ptr); /* The help */ bool command_help(struct lkt_state *srv, size_t c); @@ -71,8 +67,7 @@ enum lkt_find_action { }; /* Find and send karas in the db that match the search expression */ -bool command_find(struct lkt_state *srv, size_t c, char *cmd_args[LKT_MESSAGE_ARGS_MAX], - long continuation, enum lkt_find_action action); +bool command_find(struct lkt_state *srv, size_t c, char *cmd_args[LKT_MESSAGE_ARGS_MAX], long continuation, enum lkt_find_action action); /* Set options for the lektor such as `random`, `single`, `repeat`, etc */ enum lkt_playback_option { @@ -84,21 +79,20 @@ enum lkt_playback_option { lkt_playback_option_volume, }; -bool command_set_playback_option(struct lkt_state *srv, size_t c, enum lkt_playback_option opt, - char *args[LKT_MESSAGE_ARGS_MAX]); +bool command_set_playback_option(struct lkt_state *srv, size_t c, enum lkt_playback_option opt, char *args[LKT_MESSAGE_ARGS_MAX]); /* Authentificate users */ -bool command_password(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); +bool command_password(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); bool command_user_add(struct lkt_state *srv, size_t c, sqlite3 *db, char *argv[LKT_MESSAGE_ARGS_MAX]); /* Program management control */ bool command_restart(struct lkt_state *srv, size_t c); -bool command_kill(struct lkt_state *srv, size_t c); -bool command_update(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); -bool command_rescan(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); +bool command_kill (struct lkt_state *srv, size_t c); +bool command_update (struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); +bool command_rescan (struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); /* Sticker management */ -bool command_sticker_get(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); -bool command_sticker_set(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); +bool command_sticker_get (struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); +bool command_sticker_set (struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); bool command_sticker_delete(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); -bool command_sticker_list(struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); +bool command_sticker_list (struct lkt_state *srv, size_t c, char *argv[LKT_MESSAGE_ARGS_MAX]); diff --git a/inc/lektor/database.h b/inc/lektor/database.h index 23148fa739e0ef3fe4b2eb2e36cf4be4e1a5c0cc..194bb101bb000215d07e66b15eb8a90866cb193e 100644 --- a/inc/lektor/database.h +++ b/inc/lektor/database.h @@ -23,56 +23,55 @@ struct lkt_queue_state { }; /* Open correctly a database for lektor. */ -bool database_new(sqlite3 **db); -bool database_open(sqlite3 *db, const char *dbpath); +bool database_new (sqlite3 **db); +bool database_open (sqlite3 *db, const char *dbpath); bool database_attach(sqlite3 *db, const char *name, const char *dbpath); bool database_detach(sqlite3 *db, const char *name); /* Get information on the queue and currently playing kara. */ -bool database_queue_state(sqlite3 *db, struct lkt_queue_state *res); +bool database_queue_state (sqlite3 *db, struct lkt_queue_state *res); bool database_queue_current_kara(sqlite3 *db, struct kara_metadata *res, int *id); -bool database_queue_set_paused(sqlite3 *db, bool paused); +bool database_queue_set_paused (sqlite3 *db, bool paused); bool database_queue_set_current_index(sqlite3 *db, int idx); -bool database_queue_get_current_file(sqlite3 *db, char filepath[PATH_MAX]); +bool database_queue_get_current_file (sqlite3 *db, char filepath[PATH_MAX]); /* Mpv and database synchronisation. */ bool database_sync_mpv_state(sqlite3 *db, mpv_handle **mpv); /* Update the database. */ bool database_update(sqlite3 *db, const char *kara_dir); -bool database_update_add(sqlite3 *db, const char *kara_path, struct kara_metadata *mdt, uint64_t id, - bool avail); +bool database_update_add(sqlite3 *db, const char *kara_path, struct kara_metadata *mdt, uint64_t id, bool avail); /* Control the content of the queue. */ -bool database_queue_add_id(sqlite3 *db, int id, int priority); -bool database_queue_add_query(sqlite3 *db, const char *query, int priority); -bool database_queue_add_author(sqlite3 *db, const char *author, int priority); -bool database_queue_add_language(sqlite3 *db, const char *author, int priority); -bool database_queue_add_category(sqlite3 *db, const char *author, int priority); -bool database_queue_add_type(sqlite3 *db, const char *author, int priority); -bool database_queue_add_plt(sqlite3 *db, const char *plt_name, int priority); - -bool database_queue_insert_query(sqlite3 *db, const char *query, int pos); -bool database_queue_insert_id(sqlite3 *db, int id); -bool database_queue_insert_author(sqlite3 *db, const char *author); +bool database_queue_add_id (sqlite3 *db, int id, int priority); +bool database_queue_add_query (sqlite3 *db, const char *query, int priority); +bool database_queue_add_author (sqlite3 *db, const char *author, int priority); +bool database_queue_add_language(sqlite3 *db, const char *author, int priority); +bool database_queue_add_category(sqlite3 *db, const char *author, int priority); +bool database_queue_add_type (sqlite3 *db, const char *author, int priority); +bool database_queue_add_plt (sqlite3 *db, const char *plt_name, int priority); + +bool database_queue_insert_query (sqlite3 *db, const char *query, int pos); +bool database_queue_insert_id (sqlite3 *db, int id); +bool database_queue_insert_author (sqlite3 *db, const char *author); bool database_queue_insert_language(sqlite3 *db, const char *author); bool database_queue_insert_category(sqlite3 *db, const char *author); -bool database_queue_insert_type(sqlite3 *db, const char *author); -bool database_queue_insert_plt(sqlite3 *db, const char *plt_name); +bool database_queue_insert_type (sqlite3 *db, const char *author); +bool database_queue_insert_plt (sqlite3 *db, const char *plt_name); -bool database_queue_del_id(sqlite3 *db, int id); +bool database_queue_del_id (sqlite3 *db, int id); bool database_queue_del_pos(sqlite3 *db, int pos); -bool database_queue_clear(sqlite3 *db); -bool database_queue_crop(sqlite3 *db); -bool database_queue_move(sqlite3 *db, int from, int to); +bool database_queue_clear (sqlite3 *db); +bool database_queue_crop (sqlite3 *db); +bool database_queue_move (sqlite3 *db, int from, int to); bool database_queue_shuffle(sqlite3 *db); -bool database_queue_seekid(sqlite3 *db, int id, int *out_pos); +bool database_queue_seekid (sqlite3 *db, int id, int *out_pos); /* Control the playing state of the queue. */ bool database_queue_toggle_pause(sqlite3 *db); -bool database_queue_play(sqlite3 *db, int pos); -bool database_queue_stop(sqlite3 *db); +bool database_queue_play (sqlite3 *db, int pos); +bool database_queue_stop (sqlite3 *db); /* A search callback to be called after each matched row */ struct lkt_callback { @@ -105,7 +104,7 @@ typedef bool (*lkt_search_database_func)(struct lkt_state *srv, size_t c, int id const char *row); bool database_search_database_init(sqlite3 *db, char *col_name, char *rgx, struct lkt_search *ret); -bool database_search_queue_init(sqlite3 *db, char *col_name, char *rgx, struct lkt_search *ret); +bool database_search_queue_init (sqlite3 *db, char *col_name, char *rgx, struct lkt_search *ret); bool database_search_iter(struct lkt_search *item); /* Next and prev operation on the queue. */ @@ -113,11 +112,11 @@ bool database_queue_next(sqlite3 *db, char filepath[PATH_MAX]); bool database_queue_prev(sqlite3 *db, char filepath[PATH_MAX]); /* Set a value in the config table */ -bool database_config_set(sqlite3 *db, const char *section, const char *key, const char *value); +bool database_config_set (sqlite3 *db, const char *section, const char *key, const char *value); bool database_config_get_text(sqlite3 *db, const char *section, const char *key, char *value, size_t len); -bool database_config_get_int(sqlite3 *db, const char *section, const char *key, int *value); -bool database_config_exists(sqlite3 *db, const char *section, const char *key); -bool database_config_queue(sqlite3 *db, const char *option, int value); +bool database_config_get_int (sqlite3 *db, const char *section, const char *key, int *value); +bool database_config_exists (sqlite3 *db, const char *section, const char *key); +bool database_config_queue (sqlite3 *db, const char *option, int value); bool database_config_queue_default(sqlite3 *db); /* Get a value from the config table */ @@ -131,11 +130,11 @@ struct lkt_playlist_metadata { }; /* Control playlists */ -bool database_plt_create(sqlite3 *db, const char *name); -bool database_plt_remove(sqlite3 *db, const char *name); +bool database_plt_create (sqlite3 *db, const char *name); +bool database_plt_remove (sqlite3 *db, const char *name); bool database_plt_remove_pos(sqlite3 *db, const char *name, int pos); -bool database_plt_clear(sqlite3 *db, const char *name); -bool database_plt_rename(sqlite3 *db, const char *old_name, const char *new_name); +bool database_plt_clear (sqlite3 *db, const char *name); +bool database_plt_rename (sqlite3 *db, const char *old_name, const char *new_name); bool database_plt_export(sqlite3 *db, const char *name); bool database_plt_import(sqlite3 *db, const char *name); @@ -155,10 +154,9 @@ struct sticker_callback { bool (*call)(void *args, const char *sticker, const char *type, int uri, int value); }; -bool database_sticker_create(sqlite3 *db, const char *name); -bool database_sticker_delete(sqlite3 *db, const char *name); +bool database_sticker_create (sqlite3 *db, const char *name); +bool database_sticker_delete (sqlite3 *db, const char *name); bool database_sticker_delete_specify(sqlite3 *sb, const char *type, int uri, const char *name); -bool database_sticker_list(sqlite3 *db, const char *type, struct sticker_callback *call); -bool database_sticker_set(sqlite3 *db, const char *type, const char *name, int uri, int value); -bool database_sticker_get(sqlite3 *db, const char *type, const char *name, int uri, - struct sticker_callback *call); +bool database_sticker_list (sqlite3 *db, const char *type, struct sticker_callback *call); +bool database_sticker_set (sqlite3 *db, const char *type, const char *name, int uri, int value); +bool database_sticker_get (sqlite3 *db, const char *type, const char *name, int uri, struct sticker_callback *call); diff --git a/inc/lektor/mkv.h b/inc/lektor/mkv.h index 681315934b96e0b0b5557ef0dbaaeea50d20f71b..3dfdf09a3a9c1c0b0db01ed08e3edaa4d75f01bc 100644 --- a/inc/lektor/mkv.h +++ b/inc/lektor/mkv.h @@ -56,8 +56,7 @@ struct kara { int kara_metadata_read(struct kara_metadata *dst, const char *filename); /* Write metadata to a mkv file */ -int kara_metadata_write(struct kara_metadata *mdt, const char *filename, - const char *mkvpropedit); +int kara_metadata_write(struct kara_metadata *mdt, const char *filename, const char *mkvpropedit); /* Set the metadata for the file according to its path. */ int metadata_set_file(char *karapath, const char *mkvpropedit); diff --git a/inc/lektor/repo.h b/inc/lektor/repo.h index 88059cb1466c6622c5b0219e9871febe69bacd65..565ba01819af36a7873493bdaa3d2dc69d11d87a 100644 --- a/inc/lektor/repo.h +++ b/inc/lektor/repo.h @@ -42,8 +42,8 @@ int repo_get_alljson_sync(struct lkt_repo *const repo, struct json_object **json int repo_get_allid_async(struct lkt_repo *const repo); /* Download a kara. */ -int repo_download_id_sync(struct lkt_repo *const repo, sqlite3 *db, const uint64_t id, - const char *kara_path, struct kara_metadata *mdt_ret); +int repo_download_id_sync(struct lkt_repo *const repo, sqlite3 *db, const uint64_t id, const char *kara_path, + struct kara_metadata *mdt_ret); int repo_download_id_async(struct lkt_repo *const repo, const size_t id); int repo_get_kara_async(struct lkt_repo *const repo, struct kara **downloaded); diff --git a/inc/lektor/thread.h b/inc/lektor/thread.h index 8187b5619affa51e382b60c9d57f3749d5f90878..e91546ed3918c89958c28388d14d3a3352fbe05e 100644 --- a/inc/lektor/thread.h +++ b/inc/lektor/thread.h @@ -28,18 +28,17 @@ struct poller_thread_arg { /* Create a new thread. Returns 0 on success, a non zero value on error. */ -int poller_new(struct poller_thread *th, unsigned int init_sizes, - void *(*func)(struct poller_thread_arg *), void *args); +int poller_new(struct poller_thread *th, unsigned int init_sizes, void *(*func)(struct poller_thread_arg *), void *args); /* Joins a thread. Returns 0 on success, a non zero value on error. */ int poller_join(struct poller_thread *th, void **ret); /* Input qeueu manipulations. */ int poller_append_input(struct poller_thread *th, void *ptr); -int poller_pop_input(struct poller_thread *th, void **ptr); -int poller_head_input(struct poller_thread *th, void **ptr); +int poller_pop_input (struct poller_thread *th, void **ptr); +int poller_head_input (struct poller_thread *th, void **ptr); /* Output qeueu manipulations. */ int poller_append_output(struct poller_thread *th, void *ptr); -int poller_pop_output(struct poller_thread *th, void **ptr); -int poller_head_output(struct poller_thread *th, void **ptr); +int poller_pop_output (struct poller_thread *th, void **ptr); +int poller_head_output (struct poller_thread *th, void **ptr);