PDA

View Full Version : CLI command: get list of all artists?



afriend
2018-06-02, 06:04
Hello.

I'd like to know if there is a CLI command that will make LMS return a list of all artists? (like one entry per line, plain text, something like that)


If there is, I would then like to use this list in an Applescript. So I need to get the CLI command working within Applescript. The pattern for requesting the list should be similar to this working Applescript example:



-- example code for determining the rescan status

property LMSserverIP : "10.1.178.34"
property LMSusername : "myusername"
property LMSuserPW : "myuserPW"

set rescanStatus to do shell script "curl -v -H -X --user '" & LMSusername & ":" & LMSuserPW & "' POST -d '{\"id\":1,\"method\":\"slim.request\",\"params\":[\"ab:01:02:35:30:14\",[\"rescanprogress\",\"rescan\"]]}' http://" & LMSserverIP & ":9000/jsonrpc.js"

I do have my problems with correct formatting of CLI commands. For example, I couldn't even get the "info total artists ?" to work with Applescript.

I would really appreciate your input on this.
Thanks a lot.

AF

mherger
2018-06-02, 07:39
> I'd like to know if there is a *-CLI command- that will make LMS return
> a -list of all artists-*?

Believe it or not, that command is called "artists" :-)

http://htmlpreview.github.io/?https://raw.githubusercontent.com/Logitech/slimserver/public/7.9/HTML/EN/html/docs/cli-api.html#artists

> (like one entry per line, plain text, something like that)

This, otoh, can't be done. It's not that plain, but would come with
additional metadata. You best use json/rpc to get JSON formatted data back.

> If there is, I would then like to use this list in an Applescript. So I

There seems to be a JSON helper for AppleScript you might be able to use:

http://www.mousedown.net/mouseware/JSONHelper.html

> I do have my problems with correct formatting of CLI commands. For
> example, I couldn't even get the "info total artists ?" to work with

That would likely be ["00:04...", ["info","total","artists","?"]]

--

Michael

afriend
2018-06-05, 03:39
Thank you. That was very valuable information. Sometimes I'm just blind. Now I know what I did wrong.

So I managed to get a file with a simple plain text list with one artist entry per line. I've started going through that list and I've discovered that there are many "almost-duplicates", due to missing articles/letters or case sensitiy issues. Like this:


The Bad Brains
the Bad Brains
The bad Brains
Bad Brains, The

Bad brains
bad Brains
Bad Brainz

The Bad Brain (missing letter at the end)

The Bad Brains And Some Other Artists
The Bad Brains & Some Other Artists


There are too many of those to correct them manually. And I'd probably miss half of them because they are not always so obvious.

Using duplicate filter in editors like BBEdit I can track down duplicates with a very high similarity, e.g. when they differ only in capitalization.

But anything more complicated (missing/different letter(s) at the end, missing/different article at the beginning, and vs. &, blank spaces at end/beginning, and especially a combination of all those at the same time, that's not possible for me with standard filters.

BUT I think once somebody told me such magic was possible. I don't remember if it was with regex or if there was some kind of app, helper, command... because I've never had any use for it - until now.

You don't happen to know how to track down more complex duplicates in a long text list?

Thank you.