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))