Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • b48c8789f30557304ee2a7473742a214b758ffb9
  • master par défaut protégée
  • postdominancefrontier
  • Rapport_presentation
4 résultats

plugin.cpp

Blame
  • module_repo.c 27,38 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;
        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;
    
        /* Worker threads */
        struct worker_pool workers;
        pthread_mutex_t mtx; /* Protect the updating field */
        // *INDENT-OFF*
        volatile unsigned int updating : REPO_UPDATE_TYPE_COUNT; /* The correct size */
        // *INDENT-ON*