Get currently playing track info

kataleen

Member
Joined
Dec 11, 2024
Messages
8
Hi, is there a way to get the currently playing track information from a WiiM Mini via the API? I looked through the documentation and tried the /httpapi.asp?command=getPlayerStatus command but it does not include any track information.

Thanks.
 
Thanks.
Before I start digging in there to see how they're doing it, do you have some insights on how they achieve it? An API endpoint? Due to my current setup I am not able to add git code to my current project so the only way I can use that is to try to find the part of code that does it and duplicate it in my application.

Tx.
 
I did a bit more digging into this project and it seems that it's using uPnP to get the media info. I tried the GetMediaInfo uPnP call but unfortunately it does not return the information I need. Here is a bit more background:
I am using this in a more complex setup but the short version is that to start playing music I am using the following API call:

{DeviceIP}/httpapi.asp?command=setPlayerCmd: Playlist:{AudioServerIP}/AudioStack/playlist.m3u:0

The command works just fine and starts playing the mp3 files in the playlist. The files are served by a local http server, so the items in the m3u are essentially mp3 file URLs.

When querying the uPnP getMediaInfo action, this is the response:

Code:
<?xml version="1.0"?>
<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/"
           xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/"
           xmlns:song="www.wiimu.com/song/"
           xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/">
    <upnp:class>object.item.audioItem.musicTrack</upnp:class>
    <item id="0">
        <song:subid></song:subid>
        <song:description></song:description>
        <song:skiplimit>0</song:skiplimit>
        <song:id>0</song:id>
        <song:like>0</song:like>
        <song:singerid>0</song:singerid>
        <song:albumid>0</song:albumid>
        <song:guibehavior>
            {
                "pause": {"enabled": true},
                "prev": {"enabled": false},
                "next": {"enabled": false, "message": ""},
                "seek": {"enabled": true}
            }
        </song:guibehavior>
        <res protocolInfo="http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=01;" duration="00:00:00"></res>
        <dc:title>{AudioServer IP}/AudioStack/playlist.m3u</dc:title>
        <dc:creator></dc:creator>
        <upnp:artist></upnp:artist>
        <upnp:album></upnp:album>
        <upnp:albumArtURI></upnp:albumArtURI>
        <song:rate_hz>44100</song:rate_hz>
        <song:format_s>16</song:format_s>
        <song:bitrate>320</song:bitrate>
    </item>
</DIDL-Lite>

It shows the correct playlist but not the currently playing song in the playlist. Any thoughts?

Thanks
 
I generally use GetInfoEx, but not sure why you’re not getting any values. It’s useful to use a good UPnP browser tool to see all the endpoints and methods offered by WiiM.

Here’s some basic code to get current track, but there are plenty of queue endpoints as well to explore, such as BrowseQueue under PlayQueue.


You can view the PlayQueue methods xml as shown here
IMG_3354.jpeg
 
Last edited:
A great UPnP reference with shell script examples in this post on the Arylic forum:

 
I think I am starting to understand what's going on here. I've been successfully querying the upnp protocol via postman. Thanks for the screenshot from uPnP mate. I installed the app and shows exactly what I've been seeing in postman. The advantage with postman is that I can actually call those services and methods.
The big problem that I notice is that it seems that the device looks at a m3u playlist as one single item that it plays and because of that can't seem to get any song info from a m3u file (obviously).
This m3u is not a WiiM queue (for which the PlayQueue1 service applies). That is the queue you build on the device itself. Apparently the m3u is not transformed into a queue internally.

Unless the above assumption is wrong, now that I understand how the uPnP protocol works, I think I will use the queue mechanism on the device to add songs.

Again, a bit of background on why this is: I am playing from my custom audio UI application and when I click on an album track, I want to play the entire album starting at that specific track, in the order of track numbers stored in the mp3/flac files. What I was doing, was that when the user clicks on the track, I create a m3u dynamically with all songs starting at that track number and feed that to the Mini via the playlist API call. But, as mentioned before, that results in the factory UI on the Mini to show just the m3u filename on the currently playing screen as well as all API/uPnP calls.

So now I will try to dynamically use the uPnP calls to create a WiiM Mini internal queue and play that. See if that solves it.

PS: didn't get a chance to look into the Arylic API. Is that the underlying API for the WiiM Mini?
 
Also attempted to give it a playlist with some more information but no luck.

#EXTM3U
#PLAYLIST JMJ Playlist
#EXTURL:http://mediasource/AudioStack/Jean Michel Jarre/Albums/(1993) - Chronologie/cover.jpg
#EXTART Jean Michel Jarre
#EXTALB Chronologie
#EXTINF:652,Jean Michel Jarre - Chronologie Part 1
http://mediasource/AudioStack/Jean Michel Jarre/Albums/(1993) - Chronologie/1 Chronologie Part 1.mp3
#EXTART Jean Michel Jarre
#EXTALB Chronologie
#EXTINF:365,Jean Michel Jarre - Chronologie Part 2
http://mediasource/AudioStack/Jean Michel Jarre/Albums/(1993) - Chronologie/2 Chronologie Part 2.mp3

Song information still shows m3u file only.
 
PS: didn't get a chance to look into the Arylic API. Is that the underlying API for the WiiM Mini?
Arylic uses Linkplay modules. Linkplay owns WiiM.

Velleman is developing a Linkplay lib for Python. I haven't tried it yet, as it's rapidly changing. Maybe when it's stable.

 
Looking at Arylic API I could not find a way clean cut way to get any clear information on the currently playing track. However, in the end I combined what WAS working and came up with a Frankenstein, but hey, "It's alive!"

Here's what I did:
1. In the UI I show artist albums with a vinyl style cover.
2. Clicking on a track will make a call to the uPnP CreateQueue action in the PlayQueue service with ALL tracks on the album
3. Subsequently call the uPnP PlayQueueWithIndex action in the same service with the number of the track the user selected
4. At the same time, I keep track of the currently playing album
5. To get the currently playing track info I call the getPlayerStatus standard API command which will give me the following relevant info: "plicount":"11","plicurr":"1", where plicount confirms the number of tracks I just added and the plicurr tells me the index of the currently playing track
6. Knowing the currently playing album and index of the track, I just go ahead and get that track info directly from the source and display it.

In my case this works because I play locally stored media, not streaming online.
 
Back
Top