From edb2946f54749d46556940a237aa480ceef5f57f Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Mon, 27 Apr 2020 12:35:55 +0200 Subject: [PATCH] Set everything to be able to update/rescan from kurisu --- inc/lektor/repo.h | 8 ++++++++ meson.build | 3 ++- src/repo/{async.c => downloader.c} | 0 src/repo/sync.c | 11 +++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) rename src/repo/{async.c => downloader.c} (100%) create mode 100644 src/repo/sync.c diff --git a/inc/lektor/repo.h b/inc/lektor/repo.h index 40953c69..c9635da0 100644 --- a/inc/lektor/repo.h +++ b/inc/lektor/repo.h @@ -3,6 +3,8 @@ #include <lektor/defines.h> #include <lektor/mkv.h> #include <lektor/thread.h> +#include <lektor/uri.h> + #include <curl/curl.h> #include <sqlite3.h> #include <json.h> @@ -36,3 +38,9 @@ int repo_download_id_sync(struct lkt_repo *const repo, sqlite3 *db, const uint64 const char *kara_path, struct kara_metadata *mdt_ret); int repo_download_id_async(const size_t id); int repo_get_kara_async(struct kara **downloaded); + +/* Scan and update the DB. + If only update from the kurisu repo, rescan must be null, if you want to + also scan the directories, set rescan to a non zero value. If the uri is + null, will just update/rescan everything. */ +int repo_sync(struct lkt_uri_t *uri, int rescan); diff --git a/meson.build b/meson.build index cd546e9d..17e180c6 100644 --- a/meson.build +++ b/meson.build @@ -39,7 +39,8 @@ core_sources = [ 'src/mkv/bufferfd.c' , 'src/uri.c' , 'src/ini/ini.c' , 'src/repo/curl.c' - , 'src/repo/async.c' + , 'src/repo/downloader.c' + , 'src/repo/sync.c' , 'src/thread.c' ] diff --git a/src/repo/async.c b/src/repo/downloader.c similarity index 100% rename from src/repo/async.c rename to src/repo/downloader.c diff --git a/src/repo/sync.c b/src/repo/sync.c new file mode 100644 index 00000000..c7f38b2f --- /dev/null +++ b/src/repo/sync.c @@ -0,0 +1,11 @@ +#define _POSIX_C_SOURCE 200809L + +#include <lektor/repo.h> + +int +repo_sync(struct lkt_uri_t *uri, int rescan) +{ + (void) rescan; + (void) uri; + return 1; +} -- GitLab