mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 20:03:40 +01:00
add next refresh time
This commit is contained in:
parent
949b1c668c
commit
ec8501d279
@ -54,6 +54,7 @@ async function filterFeed() {
|
||||
} else {
|
||||
log.tele(download_list.length + ' links for ' + urlObj.fileName + ' have been sent to JDdownloader.')
|
||||
linkAdder(download_list)
|
||||
global.link_check_time = new Date();
|
||||
}
|
||||
} else {
|
||||
// No HEVC links found
|
||||
@ -61,6 +62,7 @@ async function filterFeed() {
|
||||
for (let feed_item of list_filtered_for_show) {
|
||||
retry_show_cache.push(feed_item)
|
||||
}
|
||||
global.link_check_time = new Date();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -69,10 +71,12 @@ async function filterFeed() {
|
||||
}
|
||||
} catch (error) {
|
||||
log.error('Something went wrong ' + error)
|
||||
global.link_check_time = new Date();
|
||||
}
|
||||
}
|
||||
log.info('Wiping feed cache')
|
||||
fs.writeFileSync('./feedCache.json', JSON.stringify(retry_show_cache));
|
||||
global.link_check_time = new Date();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -20,8 +20,7 @@ async function feedUpdater() {
|
||||
// Save the file
|
||||
log.info(updatedArray.length + ' items in file cache')
|
||||
fs.writeFileSync('./feedCache.json', JSON.stringify(updatedArray));
|
||||
|
||||
|
||||
global.rss_refresh_time = new Date();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -3,6 +3,7 @@ const { feedUpdater } = require('./FeedUpdater')
|
||||
const { filterFeed } = require('./FeedFilter')
|
||||
const { telegrambot } = require('./telegramCommunication')
|
||||
const { addNewShow, removeShow } = require('./apiFunctions')
|
||||
const { next_rss_refresh, next_link_check } = require('./utils')
|
||||
const version = require('./package.json').version;
|
||||
config = JSON.parse(fs.readFileSync('config.json'))
|
||||
const express = require('express');
|
||||
@ -24,6 +25,8 @@ app.use(basicAuth({
|
||||
}))
|
||||
const port = config.WebUIPort;
|
||||
|
||||
global.rss_refresh_time = new Date();
|
||||
global.link_check_time = new Date();
|
||||
global.log = require('simple-node-logger').createSimpleLogger({
|
||||
logFilePath: 'jdrssdownloader.log',
|
||||
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
|
||||
@ -41,7 +44,8 @@ log.tele = function() {
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
showListLength = JSON.parse(fs.readFileSync('config.json')).Shows.length
|
||||
res.render("index", { title: "Home", showListLength:showListLength, version:version });
|
||||
a =
|
||||
res.render("index", { title: "Home", showListLength: showListLength, version: version, rss_time: next_rss_refresh(), link_check: next_link_check() });
|
||||
});
|
||||
|
||||
app.get("/shows", (req, res) => {
|
||||
|
@ -18,6 +18,7 @@
|
||||
"jdownloader-client": "^1.0.0",
|
||||
"line-reader": "^0.4.0",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.29.4",
|
||||
"node-telegram-bot-api": "^0.59.0",
|
||||
"pug": "^3.0.2",
|
||||
"rss-parser": "^3.12.0",
|
||||
|
21
utils.js
Normal file
21
utils.js
Normal file
@ -0,0 +1,21 @@
|
||||
const fs = require('fs');
|
||||
config = JSON.parse(fs.readFileSync('config.json'))
|
||||
var moment = require('moment');
|
||||
|
||||
|
||||
function next_rss_refresh() {
|
||||
var date1 = moment(global.rss_refresh_time);
|
||||
date1.add(config.RSSFeedRefreshMins, 'm');
|
||||
return new moment(date1).format("ddd, LTS")
|
||||
}
|
||||
|
||||
function next_link_check() {
|
||||
var date1 = moment(global.link_check_time);
|
||||
date1.add(config.JDPostLinksMins, 'm');
|
||||
return new moment(date1).format("ddd, LTS")
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
next_rss_refresh, next_link_check
|
||||
}
|
||||
|
@ -7,6 +7,10 @@ block layout-content
|
||||
div.Message
|
||||
h3 Number of Tracked Shows
|
||||
h1 #{showListLength}
|
||||
h3 Next RSS Refresh
|
||||
h1 #{rss_time}
|
||||
h3 Next Link Check
|
||||
h1 #{link_check}
|
||||
div.NavButtons
|
||||
a(href="/shows")
|
||||
div.NavButton Show List
|
||||
|
Loading…
x
Reference in New Issue
Block a user