I even made a little program to read the now playing track from the sqlite database which then allowed the lights to follow the music (for complex reasons I don't have time to explain).
Most importantly it worked on the night without missing a beat.
I even made a little program to read the now playing track from the sqlite database which then allowed the lights to follow the music (for complex reasons I don't have time to explain).
Most importantly it worked on the night without missing a beat.
Someone has posted something similar, but it was literally just about 10 lines of python that read the right key in the dictionary and then posted that to a flask web page that another part of the system read to know what track was being played. I'm not a great programmer and it took me maybe 15 minutes to do, so it should be easy enough!
Also, your channel is fantastic. You’re a good teacher and your voice is excellent.
But..... If its always in a SQLite DB you should be able to use DB Browser for SQLite to inspect the DB Schema and then write a bash/python (whatever) script to pull the info out.
RESULTS=$(sqlite-utils "data.db" " SELECT song, artist, duration, FROM my_table WHERE song = 'CURRENT';")
RESULTS=$(sqlite3 data.db <<EOF SELECT song, artist, duration, FROM my_table WHERE song = 'CURRENT'; EOF )
I have no idea what the schema looks like but those are just some examples of how straightforward it might be. Run it on CRON (whatever) update as needed. https://cronitor.io/guides/python-cron-jobs
Once you have the Schema an LLM could most likely do the rest if you are not a programmer, but still need someone to get it added to the site.
(Is there a simpler solution I missed?)
import sqlite3
import time
from pathlib import Path
home = Path.home()
con = sqlite3.connect(f"{home}/.mixxx/mixxxdb.sqlite")
cur = con.cursor()
def get_track_name():
global cur
trackid = cur.execute("SELECT * FROM PlaylistTracks WHERE id=(SELECT max(id) FROM PlaylistTracks);").fetchall()[0][2]
trackname = cur.execute(f"SELECT * FROM library WHERE id={trackid};").fetchall()[0][2]
return trackname
now_playing = get_track_name()
print(now_playing)
while True:
if (np := get_track_name()) != now_playing:
now_playing = np
print(np)
time.sleep(1)
Edit: FWIW, unbox [1] uses the same approach.
Edit 2: yes, I should have cleaned up my SQL statements.[1] https://github.com/erikrichardlarson/unbox/blob/2182f227a0fc...
I'm not surprised that startups haven't tackled this, as you inevitably run headfirst into licensing issues - but I'm curious what exists in the open-source world for this!
Wedding website was a django site, with accounts for everyone I invited. I had a separate part of it where the guests could choose an RGB colour, and then choose tracks by searching. I used a spotify API for this, so when they chose a track, if someone chose a similar one (say a specific mix) then they could see this and vote for that. Each guest could choose 10 tracks. I used some HTMX for this as well (first time) and it generally worked pretty well. Database stored the spotify ID/UUID/whatever for each track
Once everyone had voted, I then bought all the tracks which we were going to play - reason being that I couldn't rely on WiFi on the day, and wanted to be 100% sure it would work, plus I couldn't "DJ" from spotify tracks.
All of the tracks were then renamed including their spotify ID/UUID/whatever, so the system knew who had voted for a specific track.
I then made the playlist up in Mixxx, and trimmed tracks to fit better, and made it work musically (my wife is excellent at this, she made it really work, mix wise). Made sure it all played OK.
The other part of the system was a custom light setup, with sound-reactive LED bars I made up (using ESP8266 and WLED firmware with 150 LEDs per 'stick') with them all being controlled by a custom controller. This system read the track from the Mixxx system (via HTTP request to a flask app I wrote that read the sqlite dB from mixxx to know what track was playing), and then coloured the lights with the colours of the people who had voted for the tracks. Also if you went onto the dancefloor you could 'swipe in' via an RFID label which was in the wristbands, which also reacted to lights and were colour-controlled over DMX.
The light patterns were sometimes random, or if one was good for a specific track then I programmed that into the system.
It was all spaghetti code, and the first time I used FastAPI. The code is terrible, and I'm only making it public as I thought it might be useful to someone.
https://github.com/djaychela/wedding_controller
I've just had a terminal cancer diagnosis and am no longer doing anything other than trying to stay alive. So please, no grief about the code! I'm sharing this to try to help someone else if they ever want to do something like this...
Wishing you all the best, and thank you for contributing to the community with this, especially under such difficult circumstances.
Dude, that is the true hacker spirit - I am a programmer and frankly that setup you described is more creative than anything I have ever made.
Fight on and keep at it - best wishes to you and your family!