JDRssDownloader/utils.js

29 lines
719 B
JavaScript
Raw Normal View History

2022-10-25 16:41:45 +01:00
const fs = require('fs');
config = JSON.parse(fs.readFileSync('config.json'))
var moment = require('moment');
function returnUpdatedDate(date, offset) {
var newDate = moment(date);
newDate.add(offset, 'm');
return new moment(newDate).format("ddd, LTS")
}
2022-10-25 16:41:45 +01:00
function nextRssRefresh() {
return returnUpdatedDate(global.rssRefreshTime, config.RSSFeedRefreshMins)
2022-10-25 16:41:45 +01:00
}
function nextLinkCheck() {
return returnUpdatedDate(global.linkCheckTime, config.JDPostLinksMins)
2022-10-25 16:41:45 +01:00
}
function get_last_downloaded(){
history = JSON.parse(fs.readFileSync('./cache/downloadHistory.json'))
last = history.slice(-1)[0]
return last
}
2022-10-25 16:41:45 +01:00
module.exports = {
nextRssRefresh, nextLinkCheck, get_last_downloaded
2022-10-25 16:41:45 +01:00
}