Sélectionner une révision Git
CRTPLuaScriptObject.hh
module_repo.c 27,59 Kio
#define _POSIX_C_SOURCE 200809L
#define __LKT_MODULE_MAIN_SOURCE__
#include <lektor/lktmodule.h>
#include "worker.h"
#include <pthread.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <limits.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <stdarg.h>
/* Different kinds of updates */
#define REPO_UPDATE_KARA (1 << 1) /* Downloading or rescanning the bakabase */
#define REPO_UPDATE_FAV (1 << 2) /* Downloading the favorites */
#define REPO_UPDATE_TYPE_COUNT 2 /* Different kinds of download, for some sizes... */
/***********
* Globals *
***********/
static volatile unsigned int __curl_init = false;
/*********************
* Private structure *
*********************/
struct module_repo_internal;
struct kara {
int ignored_count;
int update_count;
volatile sqlite3 *db;
struct module_repo_internal *repo;
size_t kara_dir_len;
long id;
long unix_timestamp;
struct kara_metadata mdt;
char mkvpropedit[LKT_LINE_MAX];
char url[LKT_LINE_MAX];
char database_filepath[PATH_MAX];
char filename[PATH_MAX];
};
struct module_repo_internal {
/* Just the repo */
char *name;
char *base_url;
char *kara_dir;
char *get_all_json;
char *get_id_json;
char *get_id_file;
char *get_fav_json;
const uint64_t version;
/* The database and the queue */
struct queue *queue;
volatile sqlite3 *db;
/* Craft a filename for newly downloaded karas. Arguments: