4 ms·
Can you share the program that reads the now playing track? We use Mixxx at a student radio station and we could maybe try using something like this to show the
by jesprenj 2y ago
Can you share the program that reads the now playing track? We use Mixxx at a student radio station and we could maybe try using something like this to show the now-playing track on the website.
- djaychela 2y agoI will see... Not being evasive but I'm experiencing terminal illness at the moment so I'm all over the place. It wasn't a complex bit of code though, but I'll see what I can find.
- corint 2y agoWishing you well - sorry to hear that you're in ill health.
- djaychela 2y agoThank you. Sorry, I had a look but I didn't find the code (it's not in the github repo for the rest of the system I made, and I no longer own the laptop I wrote it on so it's my bad). 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!
- tomcam 2y agoSo sorry, brofus. My best to you and yours. Also, your channel is fantastic. You’re a good teacher and your voice is excellent.
- Mashimo 2y ago* https://github.com/erikrichardlarson/unbox https://github.com/erikrichardlarson/unbox * https://github.com/ViktorNova/mixxx-now-playing https://github.com/ViktorNova/mixxx-now-playing
- Sn0wCoder 2y agoI have not used Mixxx nor do I have it installed, but might download to check it out. 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 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.
- raphman 2y agoNot sure whether that's the correct way but it seems to work. AFAICT, there is no "now_playing" field in the sqlite db - but tracks that start playing are added to the `PlaylistTracks` table. That means that if you started two tracks and then pause one or the other and restart it, no row will be added. Only adding a track from the library and then playing it will add to the PlaylistTracks list. (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/2182f227a0fc8f6a93ebaf37f55ed184de9c3588/src/poller.js#L543 https://github.com/erikrichardlarson/unbox/blob/2182f227a0fc...