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 {
|
} else {
|
||||||
log.tele(download_list.length + ' links for ' + urlObj.fileName + ' have been sent to JDdownloader.')
|
log.tele(download_list.length + ' links for ' + urlObj.fileName + ' have been sent to JDdownloader.')
|
||||||
linkAdder(download_list)
|
linkAdder(download_list)
|
||||||
|
global.link_check_time = new Date();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No HEVC links found
|
// No HEVC links found
|
||||||
@ -61,6 +62,7 @@ async function filterFeed() {
|
|||||||
for (let feed_item of list_filtered_for_show) {
|
for (let feed_item of list_filtered_for_show) {
|
||||||
retry_show_cache.push(feed_item)
|
retry_show_cache.push(feed_item)
|
||||||
}
|
}
|
||||||
|
global.link_check_time = new Date();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -69,10 +71,12 @@ async function filterFeed() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error('Something went wrong ' + error)
|
log.error('Something went wrong ' + error)
|
||||||
|
global.link_check_time = new Date();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info('Wiping feed cache')
|
log.info('Wiping feed cache')
|
||||||
fs.writeFileSync('./feedCache.json', JSON.stringify(retry_show_cache));
|
fs.writeFileSync('./feedCache.json', JSON.stringify(retry_show_cache));
|
||||||
|
global.link_check_time = new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -20,8 +20,7 @@ async function feedUpdater() {
|
|||||||
// Save the file
|
// Save the file
|
||||||
log.info(updatedArray.length + ' items in file cache')
|
log.info(updatedArray.length + ' items in file cache')
|
||||||
fs.writeFileSync('./feedCache.json', JSON.stringify(updatedArray));
|
fs.writeFileSync('./feedCache.json', JSON.stringify(updatedArray));
|
||||||
|
global.rss_refresh_time = new Date();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -3,6 +3,7 @@ const { feedUpdater } = require('./FeedUpdater')
|
|||||||
const { filterFeed } = require('./FeedFilter')
|
const { filterFeed } = require('./FeedFilter')
|
||||||
const { telegrambot } = require('./telegramCommunication')
|
const { telegrambot } = require('./telegramCommunication')
|
||||||
const { addNewShow, removeShow } = require('./apiFunctions')
|
const { addNewShow, removeShow } = require('./apiFunctions')
|
||||||
|
const { next_rss_refresh, next_link_check } = require('./utils')
|
||||||
const version = require('./package.json').version;
|
const version = require('./package.json').version;
|
||||||
config = JSON.parse(fs.readFileSync('config.json'))
|
config = JSON.parse(fs.readFileSync('config.json'))
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
@ -24,24 +25,27 @@ app.use(basicAuth({
|
|||||||
}))
|
}))
|
||||||
const port = config.WebUIPort;
|
const port = config.WebUIPort;
|
||||||
|
|
||||||
|
global.rss_refresh_time = new Date();
|
||||||
|
global.link_check_time = new Date();
|
||||||
global.log = require('simple-node-logger').createSimpleLogger({
|
global.log = require('simple-node-logger').createSimpleLogger({
|
||||||
logFilePath: 'jdrssdownloader.log',
|
logFilePath: 'jdrssdownloader.log',
|
||||||
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
|
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
|
||||||
});
|
});
|
||||||
|
|
||||||
log.tele = function() {
|
log.tele = function () {
|
||||||
var args = Array.prototype.slice.call( arguments ),
|
var args = Array.prototype.slice.call(arguments),
|
||||||
entry = log.log('info', args);
|
entry = log.log('info', args);
|
||||||
process.nextTick(function() {
|
process.nextTick(function () {
|
||||||
if (config.TelegramBot) {
|
if (config.TelegramBot) {
|
||||||
telegrambot(entry.msg[0])
|
telegrambot(entry.msg[0])
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
showListLength = JSON.parse(fs.readFileSync('config.json')).Shows.length
|
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) => {
|
app.get("/shows", (req, res) => {
|
||||||
@ -55,7 +59,7 @@ app.get("/shows/add", (req, res) => {
|
|||||||
|
|
||||||
app.get("/shows/remove", (req, res) => {
|
app.get("/shows/remove", (req, res) => {
|
||||||
showList = JSON.parse(fs.readFileSync('config.json')).Shows
|
showList = JSON.parse(fs.readFileSync('config.json')).Shows
|
||||||
res.render("removeshow", { title: "Remove Show", showList: showList });
|
res.render("removeshow", { title: "Remove Show", showList: showList });
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/logs", (req, res) => {
|
app.get("/logs", (req, res) => {
|
||||||
@ -67,7 +71,7 @@ app.get("/logs", (req, res) => {
|
|||||||
logFile.push(line)
|
logFile.push(line)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
logFile = logFile.slice((logFile.length - 50), logFile.length)
|
logFile = logFile.slice((logFile.length - 50), logFile.length)
|
||||||
res.render("logs", { title: "App Logs", logFile: logFile });
|
res.render("logs", { title: "App Logs", logFile: logFile });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"jdownloader-client": "^1.0.0",
|
"jdownloader-client": "^1.0.0",
|
||||||
"line-reader": "^0.4.0",
|
"line-reader": "^0.4.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"moment": "^2.29.4",
|
||||||
"node-telegram-bot-api": "^0.59.0",
|
"node-telegram-bot-api": "^0.59.0",
|
||||||
"pug": "^3.0.2",
|
"pug": "^3.0.2",
|
||||||
"rss-parser": "^3.12.0",
|
"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
|
div.Message
|
||||||
h3 Number of Tracked Shows
|
h3 Number of Tracked Shows
|
||||||
h1 #{showListLength}
|
h1 #{showListLength}
|
||||||
|
h3 Next RSS Refresh
|
||||||
|
h1 #{rss_time}
|
||||||
|
h3 Next Link Check
|
||||||
|
h1 #{link_check}
|
||||||
div.NavButtons
|
div.NavButtons
|
||||||
a(href="/shows")
|
a(href="/shows")
|
||||||
div.NavButton Show List
|
div.NavButton Show List
|
||||||
|
Loading…
x
Reference in New Issue
Block a user