From: 2weiEmu Date: Thu, 12 Mar 2026 11:46:25 +0000 (+0100) Subject: updated: loading script to more accurately reflect db X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=7b86c4467472707e818e95b9a80d6be53eea5da3;p=binbsis50-sm.git updated: loading script to more accurately reflect db --- diff --git a/Makefile b/Makefile index a9aceee..f69a822 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,12 @@ default: . # first we must setup the test database + sudo docker stop redis || true + sudo docker rm redis || true sudo docker run -d --name redis -p 6379:6379 redis:latest python3 ./testing/dummy_testing_data.py # now we can run the main app with the right arguments go build . - ./songmanager -port 8000 -binb_location="" -songs_location="" -redis_location="localhost:6379" -container_name="" || true + ./songmanager -port 8000 -binb_location="" -songs_location="" -redis_location="localhost:6379" -container_name="" - docker stop redis || true - docker rm redis || true diff --git a/pkg/dbhandling/dbhandling.go b/pkg/dbhandling/dbhandling.go index 9111ba9..bc551c4 100644 --- a/pkg/dbhandling/dbhandling.go +++ b/pkg/dbhandling/dbhandling.go @@ -3,11 +3,16 @@ package dbhandling import ( "context" "encoding/json" + "fmt" "net/http" "github.com/redis/go-redis/v9" ) +type DBSong struct { + +} + type DBStatusMessage struct { TotalSongCount int } @@ -39,6 +44,7 @@ func (dbw *DBWrapper) GetDBStatus(w http.ResponseWriter, r *http.Request) { if err != nil { panic(err) } + fmt.Println(keys) key_count := len(keys) m := DBStatusMessage{ diff --git a/songmanager b/songmanager index 0796529..64fb0a7 100755 Binary files a/songmanager and b/songmanager differ diff --git a/testing/dummy_testing_data.py b/testing/dummy_testing_data.py index 3dd24c2..a80a698 100644 --- a/testing/dummy_testing_data.py +++ b/testing/dummy_testing_data.py @@ -6,11 +6,35 @@ def main(): for i in range(0, 100): r.hmset(f"song:{i}", { - "artistNames": "firstartist, secondartist", - "songNames": "firstsongname, secondsongname" + "artistName": "firstartist~secondartist", + "trackName": "hot n cold", + "trackViewUrl": "http:///somehwere", + "previewUrl": "http://somewhere", + "artworkUrl60": "http://somewhere", + "artworkUrl100": "http://somewhere", + "displayArtistNames": "firstartist, secondartist", + "displayTrackName": "Hot n cold", }) r.zadd("hits", {i: i}) + # 'song:' + i, + # 'artistName', + # artistValues, + # 'trackName', + # trackNames, + # 'trackViewUrl', + # viewUrl, + # 'previewUrl', + # previewName, + # 'artworkUrl60', + # "", + # 'artworkUrl100', + # '', + # 'displayArtistNames', + # displayArtist, + # 'displayTrackName', + # displayTrack, + if __name__ == "__main__": main()