Here is my output from qry_alb.sh:
Artists are:
artists 0 20 search%3A_supertramp tags%3Aa
Artist check zero is: artists 0 20 search%3A_supertramp tags%3Aa
qry_alb.sh: line 14: [: too many arguments
Artist found so moving on to albums....
Album check zero is: albums 0 20 artist_id%3Aartists 0 20 search0X0P%2B0_supertramp tags0X0P%2B0a search%3A_breakfast _in_america tags%3Aal
Albums are:
albums 0 20 artist_id%3Aartists 0 20 search0X0P%2B0_supertramp tags0X0P%2B0a search%3A_breakfast_in_america tags%3Aal
qry_alb.sh: line 53: [: too many arguments
Artist ID is:artists 0 20 search%3A_supertramp tags%3Aa
Album ID is: albums 0 20 artist_id%3Aartists 0 20 search0X0P%2B0_supertramp tags0X0P%2B0a search%3A_breakfast_in_amer ica tags%3Aal
now Posting results
{"attributes": {}, "context": {"id": "c006ab421c63435b82fc2aea73428c5a", "user_id": null}, "entity_id": "sensor.art_i d", "last_changed": "2018-10-24T00:20:41.190793+00:00", "last_updated": "2018-10-24T00:20:41.190793+00:00", "state": "artists 0 20 search%3A_supertramp tags%3Aa"}
{"attributes": {}, "context": {"id": "299e07f6762f481cb97c2ea0320b6a18", "user_id": null}, "entity_id": "sensor.alb_i d", "last_changed": "2018-10-24T00:43:56.234218+00:00", "last_updated": "2018-10-24T00:43:56.234218+00:00", "state": "albums 0 20 artist_id%3Aartists 0 20 search0X0P%2B0_supertramp tags0X0P%2B0a search%3A_breakfast_in_america tags%3Aa l"}
Here is my output from qry_alb_song.sh:
Artists are:
artists 0 20 search%3A_pearl_jam tags%3Aa
Artist check zero is: artists 0 20 search%3A_pearl_jam tags%3Aa
qry_alb_song.sh: line 14: [: too many arguments
Artist found so moving on to albums....
Album check zero is: albums 0 20 artist_id%3Aartists 0 20 search0X0P%2B0_pearl_jam tags0X0P%2B0a search%3A_alive tags%3Aal
Albums are:
albums 0 20 artist_id%3Aartists 0 20 search0X0P%2B0_pearl_jam tags0X0P%2B0a search%3A_alive tags%3Aal
qry_alb_song.sh: line 90: [: too many arguments
Album found so moving on to songs....
qry_alb_song.sh: line 115: printf: `B': invalid format character
But it hangs and does not finish.
Where do I enter username/password for CLI interface port 9090? I think that is my issue.
Results 21 to 30 of 228
-
2018-10-23, 18:04 #21
- Join Date
- Dec 2017
- Posts
- 8
-
2018-10-24, 05:03 #22
- Join Date
- Feb 2017
- Posts
- 141
You are quite right, didn't realize you were using secure system (mine is open and only exposed to local network).
So that being said, reviewing the LMS CLI documentation (On your LMS: http://localhost:9000/html/docs/cli-api.html (replace "localhost" with your server's address), you need to issue the login request upon initial connection before submitting any requests. The command is in the form of "login username correctpassword" to open, proceed with your queries and you can then close the connection (not sure is you really need to) using "login username wrongpassword".
Basically modify each shell script that queries the LMS server to include the login and give it a try. You can always issue the commands by typing them in manually as well to ensure proper syntax.
If you make this work, I would appreciate a copy of one of the shell scripts and I will include this as an optional format on the GitHub project for other users. If you can't make it work, let me know and I'll see if I can make some time to test on my install over the next week or two.
Ynot.Software - Logitech Media Server Version: 8.0 (Docker), Home Assistant 0.105.5, DialogFlow - V.2 API, LMS Controls App - Voice Control of LMS, OpenMediaVault 5.2
Add-ons - Spotty, UPnP / DLNA Bridge, Cast Bridge,
Players - Sonos, UPnP, PI3 - PI Core Player 3.5.0 with IQAudio TopHat, Android- SB Player with Viper4Android Convolution Engine, GoogleHome and Google Minis
Hardware - HP Desktop - i7-3.4Ghz, 4GB Ram, 6TB storage, Debian
-
2018-10-24, 07:28 #23
- Join Date
- Dec 2017
- Posts
- 8
-
2018-10-24, 16:52 #24
- Join Date
- Feb 2017
- Posts
- 141
Software - Logitech Media Server Version: 8.0 (Docker), Home Assistant 0.105.5, DialogFlow - V.2 API, LMS Controls App - Voice Control of LMS, OpenMediaVault 5.2
Add-ons - Spotty, UPnP / DLNA Bridge, Cast Bridge,
Players - Sonos, UPnP, PI3 - PI Core Player 3.5.0 with IQAudio TopHat, Android- SB Player with Viper4Android Convolution Engine, GoogleHome and Google Minis
Hardware - HP Desktop - i7-3.4Ghz, 4GB Ram, 6TB storage, Debian
-
2018-10-25, 16:47 #25
- Join Date
- Dec 2017
- Posts
- 8
I have not been able to get the query to work without authentication. Removing the password protection allows it to work. I think that the main issue with the password is that it only works in a telnet session. There does not seem to be a log in/log out. I am currently using HTML webhooks through IFTTT. The usage is http://USERNAME
assword@HA_Link.duckdns.org:9000/anyurl?p0=radiotime&p1=playlist&p2=play&p3=item_id :0.5<lf>&player=XX:XX:XX:XX:XX:XX. But you have to issue it each time. If I use this: | nc 192.168.1.X | \login USERNAME password ) I get a password prompt when I run the script. But it will not take the typed password.
-
2018-10-25, 16:54 #26
- Join Date
- Feb 2017
- Posts
- 141
Software - Logitech Media Server Version: 8.0 (Docker), Home Assistant 0.105.5, DialogFlow - V.2 API, LMS Controls App - Voice Control of LMS, OpenMediaVault 5.2
Add-ons - Spotty, UPnP / DLNA Bridge, Cast Bridge,
Players - Sonos, UPnP, PI3 - PI Core Player 3.5.0 with IQAudio TopHat, Android- SB Player with Viper4Android Convolution Engine, GoogleHome and Google Minis
Hardware - HP Desktop - i7-3.4Ghz, 4GB Ram, 6TB storage, Debian
-
2018-10-25, 17:10 #27
- Join Date
- Feb 2017
- Posts
- 141
Looking at the way the shell scripts are written, it opens and closes the connection each time it asks for something from the LMS CLI interface. In order to make the login thing work, I believe you would need to issue two lines at each call, the first for login, the second being the request.
As an example:
query=$(printf "artists 0 20 search:$1 tags:a \nexit\n" | nc localhost 9090 )
becomes
query=$(printf "login username password\nartists 0 20 search:$1 tags:a \nexit\n" | nc localhost 9090 )
Give something like that a shot and let me know. YnotSoftware - Logitech Media Server Version: 8.0 (Docker), Home Assistant 0.105.5, DialogFlow - V.2 API, LMS Controls App - Voice Control of LMS, OpenMediaVault 5.2
Add-ons - Spotty, UPnP / DLNA Bridge, Cast Bridge,
Players - Sonos, UPnP, PI3 - PI Core Player 3.5.0 with IQAudio TopHat, Android- SB Player with Viper4Android Convolution Engine, GoogleHome and Google Minis
Hardware - HP Desktop - i7-3.4Ghz, 4GB Ram, 6TB storage, Debian
-
2018-10-26, 15:08 #28
- Join Date
- Feb 2017
- Posts
- 141
I have updated the shell LMS query scripts on the GITHUB https://github.com/ynot123/LMS_Contr...t/config/shell to allow for username and password on LMS installations.
- The script qry_alb_sec.sh should be renamed to replace the existing script qry_alb.sh. Remember to update the username, password, ip address, HA_link and HA_API_Password.
- The script qry_alb_song_sec.sh should be renamed to replace the existing script qry_alb_song.sh. Remember to update the username, password, ip address, HA_link and HA_API_Password.
Give that a go, seems to work for me here. Ynot.
The change log for those interested is:
- Added an extra line "login username password" to the CLI query to authenticate before executing the query
- Replaced nc command with socat for additional flexibility and to allow the connection to stay open to process multiple commands.
Typical query statement would be:Code:query=$(printf "login username password\nartists 0 20 search:$1 tags:a \n" | socat stdio tcp:192.168.0.XX:9090,shut-none )
Last edited by ynot1234567890; 2018-10-27 at 04:20. Reason: Added link to GitHub location
Software - Logitech Media Server Version: 8.0 (Docker), Home Assistant 0.105.5, DialogFlow - V.2 API, LMS Controls App - Voice Control of LMS, OpenMediaVault 5.2
Add-ons - Spotty, UPnP / DLNA Bridge, Cast Bridge,
Players - Sonos, UPnP, PI3 - PI Core Player 3.5.0 with IQAudio TopHat, Android- SB Player with Viper4Android Convolution Engine, GoogleHome and Google Minis
Hardware - HP Desktop - i7-3.4Ghz, 4GB Ram, 6TB storage, Debian
-
2018-10-27, 10:01 #29
- Join Date
- Dec 2017
- Posts
- 8
Success!! Thank you. On another note, any chance that you could add playing Favorites and Random Mixes (song, album, artist)?
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.0<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.1<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.2<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.3<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.4<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.5<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.6<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.7<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.8<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.9<lf>&
p0=radiotime& p1=playlist& p2=play& p3=item_id:0.10<lf>&
p0=randomplay& p1=tracks&
-
2018-10-28, 16:16 #30
- Join Date
- Feb 2017
- Posts
- 141
Glad it worked out. As for the Favorite and Random mix, I've never really made use of those features in LMS, I use a similar feature with Spotify via LMS.
I will consider the implementation of these LMS features in my Winter upgrade (should have some free time). There are a few other items on the to do list as well.
Stay Tuned. YnotSoftware - Logitech Media Server Version: 8.0 (Docker), Home Assistant 0.105.5, DialogFlow - V.2 API, LMS Controls App - Voice Control of LMS, OpenMediaVault 5.2
Add-ons - Spotty, UPnP / DLNA Bridge, Cast Bridge,
Players - Sonos, UPnP, PI3 - PI Core Player 3.5.0 with IQAudio TopHat, Android- SB Player with Viper4Android Convolution Engine, GoogleHome and Google Minis
Hardware - HP Desktop - i7-3.4Ghz, 4GB Ram, 6TB storage, Debian