From 77e1adb6747aab686c10b23ee68f54c36facd3b6 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sun, 23 Jan 2022 21:02:31 +0400 Subject: [PATCH] Removed debug prints. Removed unnecessary convert to utc. Removed title and description vars. --- radio/index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/radio/index.js b/radio/index.js index 8ae50f8..4d00d8e 100644 --- a/radio/index.js +++ b/radio/index.js @@ -36,17 +36,15 @@ async function getRadioStatus() { async function getLastPlayedSongs(count, tz) { try { const { stdout, _ } = await exec(`tail -n${count} /var/log/icecast/playlist.log | head -n-1 | cut -d"|" -f1,4`); - console.log(tz); let songs = stdout.trim().split("\n"); for (let i = 0; i < songs.length; ++i) { let [t, s] = songs[i].split('|'); - t = moment(t, "DD/MMM/YYYY:HH:mm:ss ZZ").utc(false).tz(tz).format("HH:mm"); + t = moment(t, "DD/MMM/YYYY:HH:mm:ss ZZ").tz(tz).format("HH:mm"); let song = s.split(' - '); - songs[i] = { "start_time_local": t,"artist": song[0], "title": song[1] }; + songs[i] = { "start_time_local": t, "artist": song[0], "title": song[1] }; } return songs; - } catch(err) { - console.log(err); + } catch { return []; } } @@ -54,8 +52,6 @@ async function getLastPlayedSongs(count, tz) { function setRoutes() { return koaRouter().get('/', async ctx => { await ctx.render('index', { - title: "/ Radio", - description: "Internet-radio broadcasting from under my desk.", main_site: util.getServiceByHost(ctx.header.host), radio_status: await getRadioStatus(), last_songs: await getLastPlayedSongs(11, util.getClientTimezone(ctx))