mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 20:03:40 +01:00
working link deletion
This commit is contained in:
parent
26658fdf8a
commit
0bbd83f375
@ -7,10 +7,11 @@ async function filterFeed() {
|
|||||||
let myshowlist = JSON.parse(fs.readFileSync('config.json')).Shows
|
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 feed = JSON.parse(fs.readFileSync('./feedCache.json'));
|
let feed = JSON.parse(fs.readFileSync('./feedCache.json'));
|
||||||
|
let retry_show_cache = []
|
||||||
|
|
||||||
|
|
||||||
if (hevcSwitch) {
|
if (hevcSwitch) {
|
||||||
myshowlist.forEach(async show => {
|
for (let show of myshowlist) {
|
||||||
try {
|
try {
|
||||||
// Find show on feed
|
// Find show on feed
|
||||||
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
|
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
|
||||||
@ -39,9 +40,11 @@ async function filterFeed() {
|
|||||||
linkAdder(download_list)
|
linkAdder(download_list)
|
||||||
} else {
|
} else {
|
||||||
// No HEVC links found
|
// No HEVC links found
|
||||||
log.info(download_list.length + ' HEVC links for ' + show.Name + ' have been found')
|
log.info(download_list.length + ' HEVC links for ' + show.Name + ' have been found, will recheck next time.')
|
||||||
|
for (let feed_item of list_filtered_for_show) {
|
||||||
|
retry_show_cache.push(feed_item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Show not found on the current feed cache
|
// Show not found on the current feed cache
|
||||||
log.info(show.Name + ' not on feed')
|
log.info(show.Name + ' not on feed')
|
||||||
@ -49,10 +52,9 @@ async function filterFeed() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error('Something went wrong ' + error)
|
log.error('Something went wrong ' + error)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
myshowlist.forEach(async show => {
|
for (let show of myshowlist) {
|
||||||
try {
|
try {
|
||||||
// Find show on feed
|
// Find show on feed
|
||||||
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
|
let list_filtered_for_show = feed.filter(item => item.title.includes(show.Name))
|
||||||
@ -73,9 +75,11 @@ async function filterFeed() {
|
|||||||
linkAdder(download_list)
|
linkAdder(download_list)
|
||||||
} else {
|
} else {
|
||||||
// No links found
|
// No links found
|
||||||
log.info(download_list.length + ' links for ' + show.Name + ' have been found')
|
log.info(download_list.length + ' HEVC links for ' + show.Name + ' have been found, will recheck next time.')
|
||||||
|
for (let feed_item of list_filtered_for_show) {
|
||||||
|
retry_show_cache.push(feed_item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Show not found on the current feed cache
|
// Show not found on the current feed cache
|
||||||
log.info(show.Name + ' not on feed')
|
log.info(show.Name + ' not on feed')
|
||||||
@ -83,13 +87,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')
|
log.info('Wiping feed cache')
|
||||||
fs.writeFileSync('./feedCache.json', JSON.stringify('[]'));
|
fs.writeFileSync('./feedCache.json', JSON.stringify(retry_show_cache));
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -6,12 +6,16 @@ global.log = require('simple-node-logger').createSimpleLogger({
|
|||||||
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
|
timestampFormat: 'YYYY-MM-DD HH:mm:ss.SSS'
|
||||||
});
|
});
|
||||||
|
|
||||||
let RSSFeedRefreshMins = JSON.parse(fs.readFileSync('config.json')).RSSFeedRefreshMins
|
async function main() {
|
||||||
let JDPostLinksMins = JSON.parse(fs.readFileSync('config.json')).JDPostLinksMins
|
let RSSFeedRefreshMins = JSON.parse(fs.readFileSync('config.json')).RSSFeedRefreshMins
|
||||||
|
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(await feedUpdater, RSSFeedRefreshMins * 60000);
|
||||||
setInterval(filterFeed, JDPostLinksMins * 60000);
|
setInterval(await filterFeed, JDPostLinksMins * 60000);
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
Loading…
x
Reference in New Issue
Block a user