JDRssDownloader/JDRssDownloader.js

26 lines
1015 B
JavaScript
Raw Permalink Normal View History

2022-06-09 19:08:32 +01:00
const fs = require("fs");
2022-06-09 10:29:05 +01:00
const { feedUpdater } = require('./FeedUpdater')
const { filterFeed } = require('./FeedFilter')
2022-06-18 13:19:45 +01:00
const version = require('./package.json').version;
2022-06-11 18:54:21 +01:00
global.log = require('simple-node-logger').createSimpleLogger({
logFilePath: 'jdrssdownloader.log',
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
});
2022-06-09 10:29:05 +01:00
2022-06-15 18:26:59 +01:00
async function main() {
2022-06-18 13:19:45 +01:00
log.info('Running JDRssDownloader version ' + version)
2022-06-18 13:58:29 +01:00
try {
RSSFeedRefreshMins = JSON.parse(fs.readFileSync('config.json')).RSSFeedRefreshMins
JDPostLinksMins = JSON.parse(fs.readFileSync('config.json')).JDPostLinksMins
} catch (error) {
log.error('config.json file is missing.')
}
2022-06-15 18:26:59 +01:00
log.info('Refreshing RSS Items every ' + RSSFeedRefreshMins + ' Minutes')
log.info('Checking for links and sending to JDdownloader every ' + JDPostLinksMins + ' Minutes')
2022-06-09 19:08:32 +01:00
2022-06-15 18:26:59 +01:00
setInterval(await feedUpdater, RSSFeedRefreshMins * 60000);
setInterval(await filterFeed, JDPostLinksMins * 60000);
}
main()