Discover Sonarr episode downloads and keep live tracker updating
This commit is contained in:
@@ -445,12 +445,8 @@ export default function RequestTimelinePage() {
|
||||
|
||||
const liveDownloadKey = useMemo(() => {
|
||||
const downloadStage = snapshot?.presentation?.pipeline?.find((stage) => stage.id === 'download')
|
||||
if (!downloadStage?.visible || downloadStage.state !== 'active') return ''
|
||||
return (downloadStage.torrents ?? [])
|
||||
.filter((torrent) => (torrentProgress(torrent) ?? 100) < 100)
|
||||
.map((torrent) => String(torrent.hash ?? torrent.name ?? 'download'))
|
||||
.sort()
|
||||
.join('|')
|
||||
if (!downloadStage || downloadStage.state === 'complete') return ''
|
||||
return 'discover-and-track'
|
||||
}, [snapshot])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -459,7 +455,7 @@ export default function RequestTimelinePage() {
|
||||
let timer: number | undefined
|
||||
let controller: AbortController | null = null
|
||||
const schedule = () => {
|
||||
if (!stopped) timer = window.setTimeout(() => void refresh(), 2_000)
|
||||
if (!stopped) timer = window.setTimeout(() => void refresh(), 5_000)
|
||||
}
|
||||
const refresh = async () => {
|
||||
if (document.visibilityState === 'hidden') {
|
||||
@@ -890,6 +886,7 @@ export default function RequestTimelinePage() {
|
||||
const progress = torrentProgress(torrent)
|
||||
return (
|
||||
<div className="request-torrent" key={torrent.hash ?? torrent.name}>
|
||||
{torrent.episodeLabel && <small>{torrent.episodeLabel}</small>}
|
||||
<div><strong>{torrent.name ?? 'Download'}</strong><span>{progress === null ? 'Progress unavailable' : formatProgress(progress)}</span></div>
|
||||
{progress !== null && (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user