Compare commits
No commits in common. "fb3acf41b503be2a30cd692d9806c27933e3454b" and "dadddb79d9e72c4e5ad98c4864684ea807430e27" have entirely different histories.
fb3acf41b5
...
dadddb79d9
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
PREFIX = ~/.local
|
PREFIX = ~/.local
|
||||||
VERSION = 0.3
|
VERSION = 0.2
|
||||||
|
|
||||||
PKG_CONFIG = pkg-config
|
PKG_CONFIG = pkg-config
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ You should have received a copy of the GNU General Public License along with thi
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
const char *url;
|
const char *url;
|
||||||
const char *feedName;
|
const char *feedName;
|
||||||
const time_t update;
|
|
||||||
} linkStruct;
|
} linkStruct;
|
||||||
|
|
||||||
/* Example link:
|
/* Example link:
|
||||||
@ -22,8 +21,6 @@ typedef struct {
|
|||||||
.url = "https://example.com/rss/feed.rss",
|
.url = "https://example.com/rss/feed.rss",
|
||||||
// This will be used as the folder name for the feed.
|
// This will be used as the folder name for the feed.
|
||||||
.feedName = "examplefeed",
|
.feedName = "examplefeed",
|
||||||
// The time in seconds between checks for updates.
|
|
||||||
.update = 3600,
|
|
||||||
},
|
},
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -31,7 +28,6 @@ static const linkStruct links[] = {
|
|||||||
{
|
{
|
||||||
.url = "",
|
.url = "",
|
||||||
.feedName = "",
|
.feedName = "",
|
||||||
.update = 0,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
24
minrss.c
24
minrss.c
@ -13,8 +13,6 @@ You should have received a copy of the GNU General Public License along with thi
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
|
||||||
#include <utime.h>
|
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
#include <libxml/tree.h>
|
#include <libxml/tree.h>
|
||||||
#include <libxml/xmlreader.h>
|
#include <libxml/xmlreader.h>
|
||||||
@ -217,20 +215,10 @@ main(int argc, char *argv[])
|
|||||||
outputStruct outputs[LEN(links)];
|
outputStruct outputs[LEN(links)];
|
||||||
memset(outputs, 0, sizeof(outputs));
|
memset(outputs, 0, sizeof(outputs));
|
||||||
|
|
||||||
time_t timeNow = time(NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < LEN(links); i++) {
|
for (i = 0; i < LEN(links); i++) {
|
||||||
struct stat feedDir;
|
|
||||||
|
|
||||||
if (links[0].url[0] == '\0')
|
if (links[0].url[0] == '\0')
|
||||||
logMsg(0, "No feeds, add them in config.def.h\n");
|
logMsg(0, "No feeds, add them in config.def.h\n");
|
||||||
|
|
||||||
if (stat(links[i].feedName, &feedDir) == 0) {
|
|
||||||
time_t deltaTime = timeNow - feedDir.st_atim.tv_sec;
|
|
||||||
if (deltaTime < links[i].update)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
logMsg(4, "Requesting %s\n", links[i].url);
|
logMsg(4, "Requesting %s\n", links[i].url);
|
||||||
createRequest(links[i].url, &outputs[i]);
|
createRequest(links[i].url, &outputs[i]);
|
||||||
}
|
}
|
||||||
@ -243,17 +231,7 @@ main(int argc, char *argv[])
|
|||||||
logMsg(5, "Parsing %s\n", links[i].url);
|
logMsg(5, "Parsing %s\n", links[i].url);
|
||||||
|
|
||||||
if (outputs[i].buffer && outputs[i].buffer[0]) {
|
if (outputs[i].buffer && outputs[i].buffer[0]) {
|
||||||
if (readDoc(outputs[i].buffer, links[i].feedName, itemAction) == 0) {
|
readDoc(outputs[i].buffer, links[i].feedName, itemAction);
|
||||||
struct stat feedDir;
|
|
||||||
|
|
||||||
if (stat(links[i].feedName, &feedDir) == 0) {
|
|
||||||
struct utimbuf update;
|
|
||||||
|
|
||||||
update.actime = timeNow;
|
|
||||||
update.modtime = feedDir.st_mtim.tv_sec;
|
|
||||||
utime(links[i].feedName, &update);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(outputs[i].buffer);
|
free(outputs[i].buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user