mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 20:03:40 +01:00
working dynamic fileName again
This commit is contained in:
parent
a6df6aae5f
commit
1365236bdc
@ -4,9 +4,8 @@ const { getLinksFromURL } = require('./LinkGrabber')
|
|||||||
const log = require('simple-node-logger').createSimpleLogger('jdrssdownloader.log');
|
const log = require('simple-node-logger').createSimpleLogger('jdrssdownloader.log');
|
||||||
|
|
||||||
async function filterFeed() {
|
async function filterFeed() {
|
||||||
fileName = './releasebb.json'
|
|
||||||
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
||||||
let feed = JSON.parse(fs.readFileSync(fileName));
|
let feed = JSON.parse(fs.readFileSync(global.fileName));
|
||||||
|
|
||||||
myshowlist.forEach(async show => {
|
myshowlist.forEach(async show => {
|
||||||
try {
|
try {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
// Import dependencies
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const Parser = require("rss-parser");
|
const Parser = require("rss-parser");
|
||||||
const { filterFeed } = require("./FeedFilter");
|
|
||||||
const lodash = require('lodash');
|
const lodash = require('lodash');
|
||||||
const log = require('simple-node-logger').createSimpleLogger('jdrssdownloader.log');
|
const log = require('simple-node-logger').createSimpleLogger('jdrssdownloader.log');
|
||||||
|
|
||||||
@ -15,10 +13,10 @@ async function feedUpdater() {
|
|||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
// Clean up the string and replace reserved characters
|
// Clean up the string and replace reserved characters
|
||||||
const fileName = `${feed.title.replace(/\s+/g, "-").replace(/[/\\?%*:|"<>]/g, '').toLowerCase()}.json`;
|
global.fileName = `${feed.title.replace(/\s+/g, "-").replace(/[/\\?%*:|"<>]/g, '').toLowerCase()}.json`;
|
||||||
|
|
||||||
if (fs.existsSync(fileName)) {
|
if (fs.existsSync(global.fileName)) {
|
||||||
items = require(`./${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');
|
||||||
@ -27,11 +25,8 @@ async function feedUpdater() {
|
|||||||
log.info(updatedArray.length + ' items in file cache')
|
log.info(updatedArray.length + ' items in file cache')
|
||||||
fs.writeFileSync(fileName, JSON.stringify(updatedArray));
|
fs.writeFileSync(fileName, JSON.stringify(updatedArray));
|
||||||
|
|
||||||
// run next part
|
|
||||||
// return fileName
|
|
||||||
// filterFeed(fileName)
|
|
||||||
}
|
}
|
||||||
// ();
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
feedUpdater
|
feedUpdater
|
||||||
|
@ -9,5 +9,6 @@ let JDPostLinksMins = JSON.parse(fs.readFileSync('config.json')).JDPostLinksMins
|
|||||||
log.info('Refreshing RSS Items every ' + RSSFeedRefreshMins + ' Minutes')
|
log.info('Refreshing RSS Items every ' + RSSFeedRefreshMins + ' Minutes')
|
||||||
log.info('Checking for links and sending to JDdownloader every ' + JDPostLinksMins + ' Minutes')
|
log.info('Checking for links and sending to JDdownloader every ' + JDPostLinksMins + ' Minutes')
|
||||||
|
|
||||||
|
|
||||||
setInterval(feedUpdater, RSSFeedRefreshMins * 60000);
|
setInterval(feedUpdater, RSSFeedRefreshMins * 60000);
|
||||||
setInterval(filterFeed, JDPostLinksMins * 60000);
|
setInterval(filterFeed, JDPostLinksMins * 60000);
|
||||||
|
@ -4,6 +4,15 @@ JDownloader 2 is a great tool, but since V1 has been missing a way to automatica
|
|||||||
|
|
||||||
I have put together this simple project to allow me to do that, people may find useful.
|
I have put together this simple project to allow me to do that, people may find useful.
|
||||||
|
|
||||||
|
- Automatically check RSS feed and send to JDownloader
|
||||||
|
- Uses MyJDownloader API to allow running on separate system
|
||||||
|
- Local file cache of RSS feed
|
||||||
|
- Specify time to check RSS feed
|
||||||
|
- Specify time to check file cache to send links to JDownloader
|
||||||
|
- Ability to add multiple shows to check for
|
||||||
|
- Ability to check for different qualities per show you are looking for
|
||||||
|
|
||||||
|
|
||||||
You will need NodeJS installed, then you can checkout this repo.
|
You will need NodeJS installed, then you can checkout this repo.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user