mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 20:03:40 +01:00
move shows to own file
This commit is contained in:
parent
cefd13c8da
commit
12d8c65c39
@ -5,8 +5,8 @@ const { checkFileName } = require('./checkFileName')
|
|||||||
const { checkDownloadHistory } = require('./checkDownloadHistory')
|
const { checkDownloadHistory } = require('./checkDownloadHistory')
|
||||||
|
|
||||||
async function filterFeed() {
|
async function filterFeed() {
|
||||||
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
|
||||||
let hevcSwitch = JSON.parse(fs.readFileSync('config.json')).OnlyHEVC
|
let hevcSwitch = JSON.parse(fs.readFileSync('config.json')).OnlyHEVC
|
||||||
|
let myshowlist = JSON.parse(fs.readFileSync('shows.json'))
|
||||||
let feed = JSON.parse(fs.readFileSync('./feedCache.json'));
|
let feed = JSON.parse(fs.readFileSync('./feedCache.json'));
|
||||||
let retryShowCache = []
|
let retryShowCache = []
|
||||||
let urlsToCheck = []
|
let urlsToCheck = []
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { config } = require('process');
|
|
||||||
|
|
||||||
async function addNewShow(showData) {
|
async function addNewShow(showData) {
|
||||||
let config = JSON.parse(fs.readFileSync('config.json'))
|
let shows = JSON.parse(fs.readFileSync('shows.json'))
|
||||||
let exist = false
|
let exist = false
|
||||||
for (let show of config.Shows) {
|
for (let show of shows) {
|
||||||
if (show.Name == showData.showName) {
|
if (show.Name == showData.showName) {
|
||||||
exist = true
|
exist = true
|
||||||
}
|
}
|
||||||
@ -12,12 +12,12 @@ async function addNewShow(showData) {
|
|||||||
if (exist) {
|
if (exist) {
|
||||||
log.error(showData.showName + ' Already exists in list and not added')
|
log.error(showData.showName + ' Already exists in list and not added')
|
||||||
} else {
|
} else {
|
||||||
config.Shows.push({
|
shows.push({
|
||||||
"Name": showData.showName,
|
"Name": showData.showName,
|
||||||
"Quality": showData.quality
|
"Quality": showData.quality
|
||||||
})
|
})
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync('config.json', JSON.stringify(config));
|
fs.writeFileSync('shows.json', JSON.stringify(shows));
|
||||||
log.info(showData.showName + ' Added to the list, checking for ' + showData.quality + 'p')
|
log.info(showData.showName + ' Added to the list, checking for ' + showData.quality + 'p')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@ -26,15 +26,15 @@ async function addNewShow(showData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function removeShow(showData) {
|
async function removeShow(showData) {
|
||||||
let config = JSON.parse(fs.readFileSync('config.json'))
|
let shows = JSON.parse(fs.readFileSync('shows.json'))
|
||||||
|
|
||||||
myArray = config.Shows.filter(function (obj) {
|
myArray = shows.filter(function (obj) {
|
||||||
return obj.Name !== showData.showName;
|
return obj.Name !== showData.showName;
|
||||||
});
|
});
|
||||||
|
|
||||||
config.Shows = myArray
|
shows = myArray
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync('config.json', JSON.stringify(config));
|
fs.writeFileSync('shows.json', JSON.stringify(shows));
|
||||||
log.info(showData.showName + ' Removed from tracking list.')
|
log.info(showData.showName + ' Removed from tracking list.')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
@ -4,8 +4,9 @@ const { nextLinkCheck, nextRssRefresh } = require('.././utils')
|
|||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
|
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
showListLength = JSON.parse(fs.readFileSync('config.json')).Shows.length
|
showListLength = JSON.parse(fs.readFileSync('shows.json')).length
|
||||||
a =
|
rssTime = nextRssRefresh()
|
||||||
res.render("index", { title: "Home", showListLength: showListLength, version: global.version, rssTime: nextRssRefresh(), linkCheck: nextLinkCheck() });
|
linkCheck = nextLinkCheck()
|
||||||
|
res.render("index", { title: "Home", showListLength: showListLength, version: global.version, rssTime: rssTime, linkCheck: linkCheck });
|
||||||
});
|
});
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ const { addNewShow, removeShow } = require('.././apiFunctions')
|
|||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
app.get("/shows", (req, res) => {
|
app.get("/shows", (req, res) => {
|
||||||
showList = JSON.parse(fs.readFileSync('config.json')).Shows
|
showList = JSON.parse(fs.readFileSync('shows.json'))
|
||||||
res.render("shows", { title: "Show List", showList: showList });
|
res.render("shows", { title: "Show List", showList: showList });
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ module.exports = function (app) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
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('shows.json'))
|
||||||
res.render("removeshow", { title: "Remove Show", showList: showList });
|
res.render("removeshow", { title: "Remove Show", showList: showList });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
1
shows.json
Normal file
1
shows.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
@ -4,7 +4,7 @@ html
|
|||||||
head
|
head
|
||||||
meta(charset="utf-8")
|
meta(charset="utf-8")
|
||||||
link(rel="shortcut icon", href="/favicon.ico")
|
link(rel="shortcut icon", href="/favicon.ico")
|
||||||
meta(name="viewport", content="width=device-width, initial-scale=1, shrink-to-fit=no")
|
meta(name="viewport", content="width=device-width, initial-scale=1, shrink-to-fit=yes")
|
||||||
meta(name="theme-color", content="#000000")
|
meta(name="theme-color", content="#000000")
|
||||||
title #{title} | JDRssDownloader
|
title #{title} | JDRssDownloader
|
||||||
link(rel="stylesheet" href="/style.css")
|
link(rel="stylesheet" href="/style.css")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user