1
0
mirror of https://github.com/karl0ss/JDRssDownloader.git synced 2025-05-14 18:58:10 +01:00

move some bits to cache folder

This commit is contained in:
Karl0ss 2022-10-26 10:36:17 +01:00
parent e5987247fe
commit 0cc32b18c9
3 changed files with 9 additions and 9 deletions

@ -7,7 +7,7 @@ const { checkDownloadHistory } = require('./checkDownloadHistory')
async function filterFeed() {
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('./cache/feedCache.json'));
let retryShowCache = []
let urlsToCheck = []
@ -75,7 +75,7 @@ async function filterFeed() {
}
}
log.info('Wiping feed cache')
fs.writeFileSync('./feedCache.json', JSON.stringify(retryShowCache));
fs.writeFileSync('./cache/feedCache.json', JSON.stringify(retryShowCache));
global.linkCheckTime = new Date();
}

@ -11,15 +11,15 @@ async function feedUpdater() {
let items = [];
if (fs.existsSync('./feedCache.json')) {
items = JSON.parse(fs.readFileSync('./feedCache.json'))
if (fs.existsSync('./cache/feedCache.json')) {
items = JSON.parse(fs.readFileSync('./cache/feedCache.json'))
}
// Compare existing cache and new items and merge differences
let updatedArray = lodash.unionBy(feed.items, items, 'title');
// Save the file
log.info(updatedArray.length + ' items in file cache')
fs.writeFileSync('./feedCache.json', JSON.stringify(updatedArray));
fs.writeFileSync('./cache/feedCache.json', JSON.stringify(updatedArray));
global.rssRefreshTime = new Date();
}

@ -2,16 +2,16 @@ const fs = require('fs')
function checkDownloadHistory(urlObj) {
try {
history = JSON.parse(fs.readFileSync('./downloadHistory.json'));
history = JSON.parse(fs.readFileSync('./cache/downloadHistory.json'));
} catch (error) {
fs.writeFileSync('./downloadHistory.json', JSON.stringify([]));
fs.writeFileSync('./cache/downloadHistory.json', JSON.stringify([]));
}
history = JSON.parse(fs.readFileSync('./downloadHistory.json'));
history = JSON.parse(fs.readFileSync('./cache/downloadHistory.json'));
if (history.includes(urlObj.fileName)) {
return true
} else {
history.push(urlObj.fileName)
fs.writeFileSync('./downloadHistory.json', JSON.stringify(history));
fs.writeFileSync('./cache/downloadHistory.json', JSON.stringify(history));
return false
}
}