forked from Mastodon/mastoradio-la-radio-di-mastodon
fix simple status iterator
This commit is contained in:
parent
d7bc1fd266
commit
0587cff625
@ -18,7 +18,7 @@ export const fetchStatus = (domain, id) => fetch(`https://${domain}/api/v1/statu
|
||||
.then(response => response.json())
|
||||
|
||||
export async function* statusIterator({ domain, id }) {
|
||||
const partialTrack = await fetchStatus(domain, id)
|
||||
const partialTrack = processStatus(domain, await fetchStatus(domain, id))
|
||||
|
||||
if (partialTrack !== null) {
|
||||
yield partialTrack
|
||||
|
@ -50,7 +50,7 @@ export const secondsToElapsedTime = (seconds) => {
|
||||
.join(':')
|
||||
}
|
||||
|
||||
export async function* tracksIterator(refererGenerator, cache) {
|
||||
export async function* tracksIterator(partialTrackGenerator, cache) {
|
||||
const notKnow = (values) => {
|
||||
if (cache.has(values)) {
|
||||
console.log(`Drop already processed ${values.join(':')}`)
|
||||
@ -63,7 +63,7 @@ export async function* tracksIterator(refererGenerator, cache) {
|
||||
|
||||
try {
|
||||
yield* execPipe(
|
||||
refererGenerator,
|
||||
partialTrackGenerator,
|
||||
asyncFilter(({ referer: { credentials: { domain, id } } }) => notKnow(['referer', 'mastodon', domain, id])),
|
||||
asyncFilter(({ partialMedia: { credentials: { id } } }) => notKnow(['media', 'youtube', id])),
|
||||
asyncMap(async ({ referer, partialMedia }) => {
|
||||
@ -82,7 +82,7 @@ export async function* tracksIterator(refererGenerator, cache) {
|
||||
})
|
||||
)
|
||||
} finally {
|
||||
refererGenerator.return()
|
||||
partialTrackGenerator.return()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user