forked from Outils-PeerTube/peertube-plugin-auto-import-ytb
adapted to listener-rss v 0.0.3
This commit is contained in:
parent
85d38f7939
commit
f26ac80aa5
22
src/main.ts
22
src/main.ts
|
@ -47,16 +47,10 @@ async function register({
|
|||
});
|
||||
|
||||
myManager.on('newEntries', (entries: any) => {
|
||||
if (firstUpdate) {
|
||||
logger.warn('Premiere update');
|
||||
const datas = listenersDataBinding.get(entries.addressListener);
|
||||
if (!datas) return;
|
||||
|
||||
firstUpdate = false;
|
||||
return;
|
||||
}
|
||||
|
||||
logger.warn(
|
||||
'Nouvelles baba entrées détéctées: ' + JSON.stringify(entries)
|
||||
);
|
||||
logger.warn('Nouvelles entrées détéctées: ' + JSON.stringify(entries));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -68,13 +62,17 @@ async function addListeners(listenerInput: string) {
|
|||
logger.warn('Erreur: malformé');
|
||||
return;
|
||||
}
|
||||
let newListeners = listeners.filter(item => !listenersDataBinding.has(item.address));
|
||||
let removedUrls = Array.from(listenersDataBinding.keys()).filter(url => !listeners.some(listener => listener.url === url));
|
||||
let newListeners = listeners.filter(
|
||||
(item) => !listenersDataBinding.has(item.address)
|
||||
);
|
||||
let removedUrls = Array.from(listenersDataBinding.keys()).filter(
|
||||
(url) => !listeners.some((listener) => listener.address === url)
|
||||
);
|
||||
|
||||
for (const newItem of newListeners) {
|
||||
listenersDataBinding.set(newItem.address, {
|
||||
ChannelId: newItem.ChannelId,
|
||||
firstUpdate: newItem.firstUpdate,
|
||||
firstUpdate: true,
|
||||
address: newItem.address,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user