If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Announcement
Collapse
No announcement yet.
Oneliner to get currentsong or now playing artist + songtitle on specific player
Oneliner to get currentsong or now playing artist + songtitle on specific player
> I need a one line URL to get the now playing song and artist info.
What kine of one liner do you need? A URL? A script returning data in a
specific format? What's going to execute the one line, and what is
consuming it?
Oneliner to get currentsong or now playing artist + songtitle on specific player
Hi,
I have been wading through this forums vast content, but can not seem to find a working answer.
I need a one line URL to get the now playing song and artist info.
When I try this http://192.168.1.29:9000/status.html#currentsong. I still get the complete server xml/html.
I know i need to include the mac address of the player, but the syntax is not clear to me.
Is it possible?
Or should I maybe use the CLI interface to make a txt file I can scan?
If yes, some good pointers in the right direction would be greatly appreciated.
Thanks in advance.
I need a line for a program called radiocaster it can point to an URL or a txt file to show artist title info in the stream it catches from audio output (which has no info) or even a networksource.
I found a little more info using this command;
curl -v 'http://192.168.1.29:9000/jsonrpc.js' --data-raw '{"id":1,"method":"slim.request","params":["08:00:27:6c:e1:a2",["stop"]]}'
It controls my player play/stop. Is there also command to only show the current song from that player??
But since I don't know any of the parameters I don't know how to proceed I use squeezelite-x as a client and the material interface.
Greetings,
Henk
NB: Thx for the help on my ID3tag problem the other day.
I need a line for a program called radiocaster it can point to an URL or a txt file to show artist title info in the stream it catches from audio output (which has no info) or even a networksource.
What OS is this little program going to run on Linux, PCP, MacOS, Windows ?
What are your capabilities: None, Perl, Python, VB, bash etc.
What OS is this little program going to run on Linux, PCP, MacOS, Windows ?
What are your capabilities: None, Perl, Python, VB, bash etc.
Hi,
Its running on Windows: programming capabilities are very limited, but i'm not scared to try something
LMS is running inside a docker container on a Raspberry PI 4.
If you are rebroadcasting from a stream in LMS ... then it looks to me like it could extract the metadata that LMS inserts into the stream.mp3
Paul Webster Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin
stream.mp3 is a real player.
When you connect to it you will see a new player appear in the list and you can then queue songs to it
Paul Webster Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin
Not sure it can be done with a one liner, because you first need a path to or id of the current song, then a second query gets the songinfo.
I haven't coded with PowerShell in a while, but there's the Invoke-Webrequest method that will allow you to post both queries, then PS can easily parse the json return objects.
The Invoke-WebRequest cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements. This cmdlet was introduced in PowerShell 3.0. Beginning in PowerShell 7.0, Invoke-WebRequest supports proxy configuration defined by environment variables. See the Notes section of this article. Important The examples in this article reference hosts in the contoso.com domain. This is a fictitious domain used by Microsoft for examples. The examples are designed to show how to use the cmdlets. However, since the contoso.com sites don't exist, the examples don't work. Adapt the examples to hosts in your environment.
The queries are documented here:
http://<LMS Server IP>:9000/html/docs/cli-api.html
Here's how I do it from an RPi in the C language:
(mac is the macId of the player, tags is an optional list of tags to be returned)
... (grab the name/value pairs from the returned json for album, artist, etc.)
Here's a typical result:
id=-1173897872
title=It's You or No One
artist=Lurlean Hunter
duration=191
samplesize=16
coverart=0
artwork_url=http://resources.tidal.com/images/66aeadee/09e1/43c4/ab0d/a007c1f240c2/1280x1280.jpg
album=Lonesome Gal
info_link=plugins/wimp/trackinfo.html
type=FLAC
bitrate=424kbps
samplerate=44100
url=wimp://11062173.flac
year=0
piTouchâ„¢ w/JustBoom DigiHat -> RME ADI-2 DAC FS -> JBL 305P MkII monitors; LMS 8.2 on piCorePlayer/Pi 4; Material Skin.
stream.mp3 is a real player.
When you connect to it you will see a new player appear in the list and you can then queue songs to it
So that URL seems to show up every now and then in LMS, if put the URL in the browser it shows as a html5 player, but then when i put a playlist in it of any kind its racing through all songs. If use it in the app it can be used as a network stream source, but then it says 200 ok and errorcode -1 every second. So it looks this stream.mp3 is not behaving like the progam is expecting. I only get some hackling bad quality sounds from it every now and then.
How about the oneliner i'm looking for if I use squeezelite-x as a client for the program. It gives me the control I want and the the audio quality i want. Can it be done also?
Not sure it can be done with a one liner, because you first need a path to or id of the current song, then a second query gets the songinfo.
I haven't coded with PowerShell in a while, but there's the Invoke-Webrequest method that will allow you to post both queries, then PS can easily parse the json return objects.
Thx for the tip. Maybe my rusty Powershell knowledge can help me some
An alternative would be to use the "ncat" package (part of the nmap package ) https://nmap.org/ncat/
It is available for Windows and Linux. It is like the standard linux netcat/nc utility but has a built in a lua script engine.
Attached is a sample lua script ( cli_status.lua cli_status.lua.txt ) uses LMS CLI port 9090 to get the current title,artist and album for a specified player (you need to edit to include your own MAC address)
After renaming the attached script to just "cli_status.lua" The command is invoked by
When run from a command prompt it generates log messages to console and writes out to a file in /tmp "/tmp/cliresult.txt"
Nice
Windows defender was stopping me from running this executable (will work on that)
Luckily i already have an installed nmap on my mac, so the command works out of the box from there.
Have to work on the output though;
:Title:08:00:27:6c:e1:a2 title Heat Miser :Artists: 08:00:27:6c:e1:a2 artist Massive Attack :Album: 08:00:27:6c:e1:a2 album Spirits Of Nature 2
Should be;
Title: Heat Miser Artists: Massive Attack Album: Spirits Of Nature 2
And the most important; because it's not part of the streaming process itself, it needs a process that runs on title change so the file is updated.
Maybe some radio broadcaster programs can do that, but that's a bit too much for a hobby project.
Could maybe make a powershell script for that.
LUA is not my kind of language, but it keeps me busy
g me from running this executable (will work on that)
Luckily i already have an installed nmap on my mac, so the command works out of the box from there.
Have to work on the output though;
:Title:08:00:27:6c:e1:a2 title Heat Miser :Artists: 08:00:27:6c:e1:a2 artist Massive Attack :Album: 08:00:27:6c:e1:a2 album Spirits Of Nature 2
Should be;
Title: Heat Miser Artists: Massive Attack Album: Spirits Of Nature 2
And the most important; because it's not part of the streaming process itself, it needs a process that runs on title change so the file is updated.
Maybe some radio broadcaster programs can do that, but that's a bit too much for a hobby project.
Could maybe make a powershell script for that.
LUA is not my kind of language, but it keeps me busy
1. It is proof of concept - to show access to LMS CLI and generate a text file with currently playing artist, album and title.
2. If you want notification on changes you use the CLI command "listen 1" - then unsolicited changes will be sent. The script then has to change into a loop whose action looks at strings received, waits for a "newmetadata" message, then does inquiry.
look at LMS WebGUI /Help/Technical Information/Command Line Interface as there are alternatives such as "subscribe status"
3. Lua - the scripts won't have to do complicated stuff and there are plenty of resources. I don't know Lua either - I just cobbled it together. KISS principle.
To get used to CLI, I'd advise play around using the "telnet" command - just make sure your commands end with CTRL/J - CLI will only respond t0 lines which end with CTRL/J and not "Return".
edit:
As well as "newmetdata", you'll have to look for "playlist newsong" - it seem there are more than a few ways to indicate change.
Have to work on the output though;
:Title:08:00:27:6c:e1:a2 title Heat Miser :Artists: 08:00:27:6c:e1:a2 artist Massive Attack :Album: 08:00:27:6c:e1:a2 album Spirits Of Nature 2
Should be;
Title: Heat Miser Artists: Massive Attack Album: Spirits Of Nature 2
Following chnage does what you want.
Code:
-- Write out results in a one line
[color=red]curtitle = curtitle:sub(25,-1)
curartist = curartist:sub(26,-1)
curalbum = curalbum:sub(25,-1)
f:write("Title: " .. curtitle .. " Artists: " .. curartist .. " Album: " .. curalbum )[/color]
f:flush()
f:close()
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment