From 5b04ce97a9def9eee44907607da69d7149edaecf Mon Sep 17 00:00:00 2001 From: Cynthia Date: Wed, 21 Dec 2022 16:46:13 -0700 Subject: [PATCH] anonradio: fix timer dying --- src/modules/anonradio.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/anonradio.js b/src/modules/anonradio.js index 7a3e8e8..cd4a3d3 100644 --- a/src/modules/anonradio.js +++ b/src/modules/anonradio.js @@ -38,13 +38,19 @@ async function updateNowPlaying() { } } - if (!playing || !schedule) return; + if (!playing || !schedule) { + hf.__anonradio_timeout = setTimeout(updateNowPlaying, 2000); + return; + } let lines = schedule.split("\n"); lines = lines.slice(4, lines.length - 2); const line = lines[0]; - if (!line) return; + if (!line) { + hf.__anonradio_timeout = setTimeout(updateNowPlaying, 2000); + return; + } const [_, _time, id, name] = line.match(/^(.{3,4} .{4})\s+(.+?) {2}(.+?)$/);