mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 03:49:23 +01:00
latest working with builds
This commit is contained in:
parent
1365236bdc
commit
32aa5c7c1b
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,3 +4,7 @@ config.json
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
jdrssdownloader.log
|
jdrssdownloader.log
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
|
feedCache.json
|
||||||
|
dist/jdrssdownloader-linux
|
||||||
|
dist/jdrssdownloader-win.exe
|
||||||
|
dist/jdrssdownloader-macos
|
||||||
|
@ -5,7 +5,7 @@ const log = require('simple-node-logger').createSimpleLogger('jdrssdownloader.lo
|
|||||||
|
|
||||||
async function filterFeed() {
|
async function filterFeed() {
|
||||||
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
||||||
let feed = JSON.parse(fs.readFileSync(global.fileName));
|
let feed = JSON.parse(fs.readFileSync('./feedCache.json'));
|
||||||
|
|
||||||
myshowlist.forEach(async show => {
|
myshowlist.forEach(async show => {
|
||||||
try {
|
try {
|
||||||
@ -44,7 +44,10 @@ async function filterFeed() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error('Something went wrong ' + error)
|
log.error('Something went wrong ' + error)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
// log.info('Wiping feed cache')
|
||||||
|
// fs.writeFileSync(global.fileName, JSON.stringify('[]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -12,18 +12,15 @@ async function feedUpdater() {
|
|||||||
|
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
// Clean up the string and replace reserved characters
|
if (fs.existsSync('./feedCache.json')) {
|
||||||
global.fileName = `${feed.title.replace(/\s+/g, "-").replace(/[/\\?%*:|"<>]/g, '').toLowerCase()}.json`;
|
items = JSON.parse(fs.readFileSync('./feedCache.json'))
|
||||||
|
|
||||||
if (fs.existsSync(global.fileName)) {
|
|
||||||
items = require(`./${global.fileName}`);
|
|
||||||
}
|
}
|
||||||
// Compare existing cache and new items and merge differences
|
// Compare existing cache and new items and merge differences
|
||||||
let updatedArray = lodash.unionBy(feed.items, items, 'title');
|
let updatedArray = lodash.unionBy(feed.items, items, 'title');
|
||||||
|
|
||||||
// Save the file
|
// Save the file
|
||||||
log.info(updatedArray.length + ' items in file cache')
|
log.info(updatedArray.length + ' items in file cache')
|
||||||
fs.writeFileSync(fileName, JSON.stringify(updatedArray));
|
fs.writeFileSync('./feedCache.json', JSON.stringify(updatedArray));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
"name": "jdrssdownloader",
|
"name": "jdrssdownloader",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "main.js",
|
"main": "JDRssDownloader.js",
|
||||||
|
"bin": "JDRssDownloader.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
@ -11,10 +12,12 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
"cheerio": "^1.0.0-rc.11",
|
"cheerio": "^1.0.0-rc.11",
|
||||||
"extract-urls": "^1.3.2",
|
|
||||||
"jdownloader-client": "^1.0.0",
|
"jdownloader-client": "^1.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"rss-parser": "^3.12.0",
|
"rss-parser": "^3.12.0",
|
||||||
"simple-node-logger": "^21.8.12"
|
"simple-node-logger": "^21.8.12"
|
||||||
|
},
|
||||||
|
"pkg": {
|
||||||
|
"outputPath": "dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user