dlhist: rename to proc-cache.
A new datastructure is about to take dlhist place. dlhist is currently implemented as a mixture of an "process cache" that should record what rss items has been processed (that is why the url is used as a unique identifier), but right now it only stores an url if it has been downloaded. A new datastructure that should be "download history" shall be implemented, that will keep track of what title and where it has been downloaded to. this will make it possible to only download an rss title to a location once. Splitting this datastructure into two separated structures is trivial as a "process cache" will threat URL's as a unique identifier and a "download history" will threat the title in an rss item as a unique identifier (and also track it's destinations). This commit does not change any functionality, I just rename this to keep the "dlhist" prefix and source files clear for when implementing the real dlhist.
This commit is contained in:
parent
90365e9de2
commit
1350330dd2
4 changed files with 34 additions and 33 deletions
14
dlight.c
14
dlight.c
|
|
@ -9,12 +9,12 @@
|
|||
#include "env.h"
|
||||
#include "error.h"
|
||||
#include "cconf.h"
|
||||
#include "dlhist.h"
|
||||
#include "proc-cache.h"
|
||||
#include "filter.h"
|
||||
#include "http.h"
|
||||
#include "rss.h"
|
||||
|
||||
#define DLHIST_PURGE_INTERVAL (60*60*6) /* 6 hours (in seconds) */
|
||||
#define PROC_CACHE_PURGE_INTERVAL (60*60*6) /* 6 hours (in seconds) */
|
||||
|
||||
static int write_http_file(struct http_file *file, const char *dest) {
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ static void process_items(rss_t rss, struct target *t) {
|
|||
|
||||
struct http_file *file = NULL;
|
||||
|
||||
if (dlhist_lookup(item.link))
|
||||
if (proc_cache_lookup(item.link))
|
||||
continue;
|
||||
|
||||
for(i=0; i < t->nr; i++) {
|
||||
|
|
@ -70,7 +70,7 @@ static void process_items(rss_t rss, struct target *t) {
|
|||
printf("Downloaded: %s (%s) to %s\n",
|
||||
item.title, item.link, filter->dest);
|
||||
|
||||
dlhist_update(item.link);
|
||||
proc_cache_update(item.link);
|
||||
}
|
||||
|
||||
http_free_file(file);
|
||||
|
|
@ -82,7 +82,7 @@ static void process(struct cconf *config) {
|
|||
int i;
|
||||
struct buffer *data;
|
||||
|
||||
dlhist_purge(DLHIST_PURGE_INTERVAL);
|
||||
proc_cache_purge(PROC_CACHE_PURGE_INTERVAL);
|
||||
|
||||
for(i=0; i < config->nr; i++) {
|
||||
struct target *t = config->target + i;
|
||||
|
|
@ -118,12 +118,12 @@ int main(int argc, char *argv[]) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (dlhist_open() < 0)
|
||||
if (proc_cache_open() < 0)
|
||||
return 1;
|
||||
|
||||
process(config);
|
||||
|
||||
dlhist_close();
|
||||
proc_cache_close();
|
||||
cconf_free(config);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Reference in a new issue