From: 2weiEmu Date: Thu, 12 Mar 2026 11:32:26 +0000 (+0100) Subject: updated: makefile, better sync write function X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=6378a1dbcd8a9522a99236605cf8d4113015a398;p=binbsis50.git updated: makefile, better sync write function --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2f51fd9 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ + +default: + npm run minify + sudo docker run -d --name redis -p 6379:6379 redis:latest + + node util/set-custom-sis50.js + + node app.js + + sudo docker stop redis || true + sudo docker rm redis || true + diff --git a/lib/rooms.js b/lib/rooms.js index ad4b29e..d8e43e2 100644 --- a/lib/rooms.js +++ b/lib/rooms.js @@ -570,7 +570,7 @@ Room.prototype.sendLoadTrack = function() { } room.artworkUrl = replies[3]; room.trackViewUrl = replies[4]; - room.displayArtistNames = replies[5].replace("~", ", "); + room.displayArtistNames = replies[5].replace("~", ", ").replace(""); room.displayTrackName = replies[6]; primus.room(room.roomname).send('loadtrack', room.previewUrl); diff --git a/public/css/style.css b/public/css/style.css index 4c61b45..6129fbf 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -232,7 +232,7 @@ form .clearfix { } .loading-block { background-color: #6184B7; - border: 1px solid #466085; + border: 1px solid #7B352E; float: left; height: 12px; margin-left: 1px; diff --git a/util/set-custom-sis50.js b/util/set-custom-sis50.js index c9f3843..a8a5dff 100644 --- a/util/set-custom-sis50.js +++ b/util/set-custom-sis50.js @@ -6,14 +6,14 @@ const fs = require("node:fs") const songsclient = new Redis(6379, "localhost"); // Read from the pre-process file that I made -fs.readFile("util/song-map.csv", "utf8", (err, data) => { - if (err) { - console.error(err); - return; - } +let data = fs.readFileSync("util/song-map.csv", "utf8") +console.log(data) + +let setfunc = async (data) => { // here we process the data let values = data.split("\n"); + console.log(values.length) for (let i = 0; i < values.length; i++) { let line = values[i].split(","); @@ -23,9 +23,9 @@ fs.readFile("util/song-map.csv", "utf8", (err, data) => { let displayTrack = line[3] let previewName = line[4] let viewUrl = "" - console.log("adding song: " + i) + //console.log("adding song: " + i) - songsclient.hmset( + await songsclient.hmset( 'song:' + i, 'artistName', artistValues, @@ -46,5 +46,9 @@ fs.readFile("util/song-map.csv", "utf8", (err, data) => { ); songsclient.zadd("hits", i, i); } -}); + console.log("end of function") + songsclient.disconnect() +} + +setfunc(data)