mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 03:49:23 +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')
|
||||
|
||||
async function filterFeed() {
|
||||
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
||||
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 retryShowCache = []
|
||||
let urlsToCheck = []
|
||||
|
@ -1,10 +1,10 @@
|
||||
const fs = require('fs');
|
||||
const { config } = require('process');
|
||||
|
||||
|
||||
async function addNewShow(showData) {
|
||||
let config = JSON.parse(fs.readFileSync('config.json'))
|
||||
let shows = JSON.parse(fs.readFileSync('shows.json'))
|
||||
let exist = false
|
||||
for (let show of config.Shows) {
|
||||
for (let show of shows) {
|
||||
if (show.Name == showData.showName) {
|
||||
exist = true
|
||||
}
|
||||
@ -12,12 +12,12 @@ async function addNewShow(showData) {
|
||||
if (exist) {
|
||||
log.error(showData.showName + ' Already exists in list and not added')
|
||||
} else {
|
||||
config.Shows.push({
|
||||
shows.push({
|
||||
"Name": showData.showName,
|
||||
"Quality": showData.quality
|
||||
})
|
||||
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')
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
@ -26,15 +26,15 @@ async function addNewShow(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;
|
||||
});
|
||||
|
||||
config.Shows = myArray
|
||||
shows = myArray
|
||||
try {
|
||||
fs.writeFileSync('config.json', JSON.stringify(config));
|
||||
fs.writeFileSync('shows.json', JSON.stringify(shows));
|
||||
log.info(showData.showName + ' Removed from tracking list.')
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
@ -4,8 +4,9 @@ const { nextLinkCheck, nextRssRefresh } = require('.././utils')
|
||||
module.exports = function (app) {
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
showListLength = JSON.parse(fs.readFileSync('config.json')).Shows.length
|
||||
a =
|
||||
res.render("index", { title: "Home", showListLength: showListLength, version: global.version, rssTime: nextRssRefresh(), linkCheck: nextLinkCheck() });
|
||||
showListLength = JSON.parse(fs.readFileSync('shows.json')).length
|
||||
rssTime = nextRssRefresh()
|
||||
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) {
|
||||
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 });
|
||||
});
|
||||
|
||||
@ -12,7 +12,7 @@ module.exports = function (app) {
|
||||
});
|
||||
|
||||
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 });
|
||||
});
|
||||
|
||||
|
1
shows.json
Normal file
1
shows.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
@ -4,7 +4,7 @@ html
|
||||
head
|
||||
meta(charset="utf-8")
|
||||
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")
|
||||
title #{title} | JDRssDownloader
|
||||
link(rel="stylesheet" href="/style.css")
|
||||
|
Loading…
x
Reference in New Issue
Block a user