• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). There are daily reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Simple Python Web App for WiiM Mini Display

OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
Actually, you may not need the webserver at all and use a static page that you can host anywhere. You can probably just read the XML file in the browser and process it just fine (this would work if the XML serving server has the proper CROS headers). You could have an input screen for the URL, and store it in local storage, and next time read it from there. I don't have a WiiM Mini so I can't check if this would be possible.
Nope. WiiM Mini doesn't allow CORS. So, we're stuck with an intermediary web server.

1656681635062.png
 
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
I've eliminated the Pi Zero from my local config - now running 100% on my Chromebox. As ChromeOS supports Linux virtual machines, I've set it up as a service, so it's always running. The Linux system does need to be restarted after a reboot, but it's always running otherwise. Works as both a full browser window via localhost, and as a Chrome extension. Note that the Chrome extension files can't be on the Linux partition, as the extension will simply disappear if the Linux subsystem isn't running, and won't reappear once it starts. Save them to a directory under "My Files" to make it permanent.

1656804815678.png
 
Last edited:
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
Looking into Musicbrainz and Listenbrainz. There's a very simple Python lib for Listenbrainz, makes it pretty easy to "scrobble" listens on the WiiM Mini. Interesting stuff, we'll see how it goes...

1657405086426.png
 
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
Last edited:

Brantome

Major Contributor
Joined
Apr 4, 2020
Messages
1,051
Likes
872
Thanks - got this working happily on Windows. I just fire off a small batch file to run the server up and use the Chrome extension to display the window when required :)
 
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
Thanks - got this working happily on Windows. I just fire off a small batch file to run the server up and use the Chrome extension to display the window when required :)
I haven't had a Windoze PC for a couple of decades, but you can start a script as a service, which means it will always be available.

 
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
Managed to get ahold of a Pi Pico W during the approximately 5-minute period that Adafruit had them in stock, lol. A little app called Thonny makes it really simple to program these. A stripped-down version of the script, sans buttons and auto-refresh, is working nicely on the Pico W so far...

1658327527563.png
 
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
OK, the Pi Pico W version has run OK for a day now, pushed it up to github: https://github.com/retired-guy/WiiM-Web-Pi-PicoW It's a bit sluggish, going to stick with running the Python script on my ChromeBox.

Will try to add an Infrared remote control to the WiiM using the Pico W. Should be fun...
 
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
Updated the web app. If you're playing from Tidal, the WiiM Mini will have Tidal IDs for artist and album in metadata, which can be used in a URL to directly open Tidal (app or webpage) to the artist or album. Clicking the ellipsis (...) after the artist or album will now do this.


Screenshot 2022-07-27 2.18.44 PM.png
 
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
Working on a Tidal-specific version. I primarily use Tidal because, unlike Amazon, it provides artist bios, album reviews, and lots of links to artists who performed with / influenced, etc, the primary artist. As a jazz fan, this stuff is essential. Tidal is also just $5.99/month for their HiFi tier for veterans, which is very nice; thanks, Tidal!

While Tidal doesn't provide a public API, there's a nice Python lib on github that uses the current OAuth login method that Tidal has moved to, and is quite easy to use. I'm keeping it as a WiiM client app for now, but it would be possible to build a standalone app for a Pi or similar, though that might be too much like Moode or Volumio, neither of which I care for.

Anyhoo, here's progress so far. Album review and artist bio. The "more" section will display any clicked link from the other two sections.

Screenshot 2022-07-31 1.28.33 PM.png

Screenshot 2022-07-31 1.28.40 PM.png

Screenshot 2022-07-31 1.28.49 PM.png
 

monkeybrainz

New Member
Joined
Aug 6, 2022
Messages
2
Likes
0
sorry - windows user here. I have python installed and i have the browser displaying current song but I can't get refresh to automagically work with song change. ideas?

I should add - I have python running in a powershell window and I see the 1 second Get requests. I can refresh and get current song playing. I just can't get the browser to refresh on its own.

VERY THANKFUL for this project.. would love to keep a browser window open on my cabinet with this running full time.
 
Last edited:
OP
Ralph_Cramden

Ralph_Cramden

Major Contributor
Joined
Dec 6, 2020
Messages
2,397
Likes
3,196
sorry - windows user here. I have python installed and i have the browser displaying current song but I can't get refresh to automagically work with song change. ideas?

I should add - I have python running in a powershell window and I see the 1 second Get requests. I can refresh and get current song playing. I just can't get the browser to refresh on its own.

VERY THANKFUL for this project.. would love to keep a browser window open on my cabinet with this running full time.
I've only tested this under ChromeOS with the Chrome browser. Browsers are supposed to be pretty much standardized these days, but who knows?

If you look at the html file, this line:

setInterval(getStatus,1000);

is what calls the getStatus() function every second. It simply queries the WiiM to determine whether something is playing, and if so, calls another function to get the details. The Python back end doesn't do anything unless the browser page tells it to.

So, I'd check out the Chrome browser if you're using something else. Beyond that, I'm blind.

Also, @photodesignch in another thread posted a really promising app to do the same thing, which looks a lot more robust than mine. I've moved on to concentrate on Tidal, but this app does all services except Tidal, looks like. May want to give it a look. It's on github here:

https://github.com/chrishuangcf/wiim-mini-ui
 

monkeybrainz

New Member
Joined
Aug 6, 2022
Messages
2
Likes
0
I've only tested this under ChromeOS with the Chrome browser. Browsers are supposed to be pretty much standardized these days, but who knows?

If you look at the html file, this line:

setInterval(getStatus,1000);

is what calls the getStatus() function every second. It simply queries the WiiM to determine whether something is playing, and if so, calls another function to get the details. The Python back end doesn't do anything unless the browser page tells it to.

So, I'd check out the Chrome browser if you're using something else. Beyond that, I'm blind.

Also, @photodesignch in another thread posted a really promising app to do the same thing, which looks a lot more robust than mine. I've moved on to concentrate on Tidal, but this app does all services except Tidal, looks like. May want to give it a look. It's on github here:

https://github.com/chrishuangcf/wiim-mini-ui
Thank you. I tried the app but had no luck figuring out the install and using with windows. This code of yours works, i just can't get the browser to refresh regardless of what I use unless I force a refresh with something like document.location.reload() in the code but then it happens at the rate of the setInterval - every second. Thanks for the response. I'll keep playing and let you know if I can figure it out. I am not a coder .. just know enough to tinker.
 

JeremyFife

Addicted to Fun and Learning
Joined
Jan 8, 2022
Messages
557
Likes
613
Location
Scotland
This is fascinating stuff, thank you for sharing :)

Is there an idiot's guide to actually getting this started ... I'm a Window's user, not a coder (although I can cope with VBA and SQL). I have Python installed but I've never used it and I have your download from Github.
Hints on a batch file to start this running would be really helpful

Cheers
 
Top Bottom