From 2dfbb5b499cd809f936da74b7c9d9ee6a8809808 Mon Sep 17 00:00:00 2001 From: navewindre Date: Sat, 23 Nov 2024 20:40:33 +0100 Subject: sda --- nowplaying/playing.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'nowplaying') diff --git a/nowplaying/playing.js b/nowplaying/playing.js index cef25fb..e7a50b9 100755 --- a/nowplaying/playing.js +++ b/nowplaying/playing.js @@ -2,13 +2,8 @@ const WebSocket = require( "ws" ); -process.on( "uncaughtException", () => { - console.log(); -} ); - -process.on( "unhandledRejection", () => { - console.log(); -} ); +process.on( "uncaughtException", () => { console.log(); } ); +process.on( "unhandledRejection", () => { console.log(); } ); let ws = null; let idc = 1; @@ -46,10 +41,8 @@ const setupws = () => { ret += ' - '; } - const homedir = require( "os" ).homedir(); - if( title.startsWith( homedir ) ) { - const path = title.substring( homedir.length + 1 ); - const file = path.split( "/" ).pop(); + if( title.startsWith( '/' ) ) { + const file = title.split( "/" ).pop(); ret += file; } else ret += title; @@ -73,6 +66,4 @@ const sendreq = () => { ws.send( JSON.stringify( obj ) ); } -try { - setupws(); -} catch ( e ) {} +setupws(); -- cgit v1.2.3