INTERACT FORUM

Windows => Third Party Plug-ins, Programs, and Skins => Topic started by: Chili-Jam on September 01, 2011, 01:19:18 am

Title: MCWS broken for Values in MC16?
Post by: Chili-Jam on September 01, 2011, 01:19:18 am
Hi,

i just realized that none of your examples for MCWS/v1/Library/Values works for MC16.
It just responds ok but no values. I have a parallel installation for MC15 on the same computer
where it works as expected. Is it broken or am I missing something?


Two other questions:

1) I want to query MC to give me all managed library fields for a filter (e.g. show only audio fields)
similar to the Manage Library Fields Options dialog. I need the field names and if possible meta-data
(data type, relational, edit type, acceptable values).
Is something like this already possible ( maybe as a workaround) or can you create a webservice method for that?

2) I want to get all fields with values for a file (playing or not, identified by filekey).
Is this possible or can you implement it?

That would be awesome since i want to be able to tag files with a remote.

Thanks
Title: Re: MCWS broken for Values in MC16?
Post by: PaulSinnema on September 01, 2011, 05:23:34 am
Hi,

You must be doing something wrong. I just tested it and it works fine for me.

Here's what I do:
First make sure the Library Server is enabled:

Start a browser and do the following:

If I, for instance, click the 'Alive' example (which fires http://localhost:52199/MCWS/v1/Alive) you should see something like:

Code: [Select]
 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <Response Status="OK">
  <Item Name="RuntimeGUID">{AEBD3140-649A-4A12-9991-304CA839AA38}</Item>
  <Item Name="LibraryVersion">20</Item>
  <Item Name="ProgramName">JRiver Media Center</Item>
  <Item Name="ProgramVersion">16.0.164</Item>
  <Item Name="FriendlyName">Speedy</Item>
  <Item Name="AccessKey">CNcvbV</Item>
  </Response>

If you only want to see library items with type 'audio' do the following:

http://localhost:52199/MCWS/v1/Files/Search?Query=[Media Type]=Audio&Action=mpl

This causes MC to collect all Audio Types and will send you a search result in the form of a 'Search1.mpl' file which has results like this:

Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<MPL Version="2.0" Title="MCWS - Files - 9244">
<Item>
<Field Name="Key">373</Field>
<Field Name="Filename">C:\Users\Public\Music\Sample Music\Kalimba.mp3</Field>
<Field Name="Name">Kalimba</Field>
<Field Name="Artist">Mr. Scruff</Field>
<Field Name="Album">Ninja Tuna</Field>
<Field Name="Genre">Electronic</Field>
<Field Name="Comment">Ninja Tune Records</Field>
<Field Name="Date">39448</Field>
<Field Name="Bitrate">192</Field>
<Field Name="Image File">INTERNAL</Field>
<Field Name="Duration">348,0550000000000068</Field>
<Field Name="Track #">1</Field>
<Field Name="Disc #">1</Field>
<Field Name="Media Type">Audio</Field>
<Field Name="Album Artist">Mr. Scruff</Field>
<Field Name="Date Imported">1303378644</Field>
<Field Name="Skip Count">7</Field>
<Field Name="Last Skipped">1305186408</Field>
<Field Name="File Type">mp3</Field>
<Field Name="File Size">8424803</Field>
<Field Name="Date Created">1247549558</Field>
<Field Name="Date Modified">1304683245</Field>
<Field Name="Compression">CBR (MPEG-1 Layer 3)</Field>
<Field Name="Publisher">Ninja Tune</Field>
<Field Name="Composer">A. Carthy and A. Kingslow</Field>
<Field Name="Sample Rate">44100</Field>
<Field Name="Channels">2</Field>
<Field Name="Bit Depth">16</Field>
</Item>
<Item>
   ...
</Item>
</MPL>

Take a close look at the options in the different interfaces and you'll see that there's almost nothing you can not do with MC.

Regards
Paul Sinnema
Title: Re: MCWS broken for Values in MC16?
Post by: Chili-Jam on September 01, 2011, 06:52:52 am
Hi Paul,

thanks for answering.

I can open the webservice documentation page at http://localhost:52199/MCWS/v1/doc
or the way you navigate to it.
I can succesfully call the services that should give a response, e.g. alive or authenticate are working.
Also retrieving a mpl file is working.

But can you confirm that
http://localhost:52199/MCWS/v1/Library/Values?Field=Artist
gives you any result for MC16?
It doesn't do it for me but the same library opened in MC15 does.

For my other questions:
i can see that it might be a workaround to request a mpl file and parse it.
I was just hoping i could get a plain xml response without needing to download a file.

My first question was more about getting the metadata of the library (also as xml response)
but maybe i could extract that from the real data as well.

Regards
Title: Re: MCWS broken for Values in MC16?
Post by: JimH on September 01, 2011, 07:07:56 am

But can you confirm that
http://localhost:52199/MCWS/v1/Library/Values?Field=Artist
gives you any result for MC16?

I get this:
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<Response Status="OK"/>
Title: Re: MCWS broken for Values in MC16?
Post by: MrC on September 01, 2011, 07:13:57 am
Good coincidence, I happened to notice the missing Artists just the other day.
Title: Re: MCWS broken for Values in MC16?
Post by: Chili-Jam on September 01, 2011, 07:40:50 am
I get this:
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<Response Status="OK"/>

Yes, that's what i get as well.
But there should be some artists listed if your library contains any ?
Title: Re: MCWS broken for Values in MC16?
Post by: Matt on September 01, 2011, 07:52:53 am
This function uses the new value search engine introduced in v16.  It does fuzzy matching, a better job of sorting matches by relevance, and includes logical things like the album "New Morning" when you search for Bob Dylan even though the album value (obviously) doesn't contain the search term.

This is used by Theater View, Gizmo, and the search suggestions in the search box.

You need to provide a filter for it to work.  

For example:
http://localhost:52199/MCWS/v1/Library/Values?Field=Artist&Filter=Dylan&Field=Artist,Album

Results:
Code: [Select]
<Response Status="OK">
<Item Name="Artist">Bob Dylan</Item>
<Item Name="Album">Dylan</Item>
<Item Name="Album">Baez Sings Dylan</Item>
<Item Name="Album">The Freewheelin' Bob Dylan</Item>
<Item Name="Artist">Jakob Dylan Featuring Dhani Harrison</Item>
<Item Name="Name">Bob Dylan's Dream</Item>
<Item Name="Name">Bob Dylan's Blues</Item>
<Item Name="Album">New Morning</Item>
<Item Name="Album">Modern Times</Item>
</Response>

It might be good to make the no-filter method work as well, although the function is really designed for searching.
Title: Re: MCWS broken for Values in MC16?
Post by: Chili-Jam on September 01, 2011, 08:06:26 am
Thanks Matt,

doing it as in your example gives me results.
I was mislead by the webservice description to asume that wildcards (defaults) should work.

What about my other two questions?
Can you give me a hint how to do it with the existing services or is it not possible?
Title: Re: MCWS broken for Values in MC16?
Post by: Matt on September 01, 2011, 08:44:54 am
You can get information about a specific file using:
http://localhost:52199/MCWS/v1/Files/Search?Query=[Key]=[1]&Action=MPL

Switch the "1" to the file key in question.
Title: Re: MCWS broken for Values in MC16?
Post by: Matt on November 11, 2011, 02:44:52 pm
In 17.0.33 (and newer):
SDK: Improved MCWS/v1/Library/Values so it can return all values for a given field or search any number of fields for matches.
Title: Re: MCWS broken for Values in MC16?
Post by: Lespaul on February 12, 2012, 07:32:15 am
Hi Matt,

When using a query like this:
http://localhost:52199/MCWS/v1/Library/Values?Field=Artist&Filter=Dylan&Field=Artist,Album

How do you get the itemID of the items returned? They are not much use without them when used in a search.
I can see that WebGizmo is able to retieve these values.
Title: Re: MCWS broken for Values in MC16?
Post by: jitterjames on February 21, 2012, 04:23:01 pm
In 17.0.33 (and newer):
SDK: Improved MCWS/v1/Library/Values so it can return all values for a given field or search any number of fields for matches.

It would be really great if you could release a fix for this issue.  Clearly it is supposed to work since it works in MC15 and MC17 and all your examples in the doc use this format and none of them work.

This is taken from the doc generated by MC16:

 
Quote
   Values
         Get a list of values from the database (artists, albums, etc.).
         Parameters:
            Field: The field to get values from. (default: )
            Files: A search to use to get the files to retrieve values from (use empty to use all imported files). (default: )
            Filter: Only return values that match this filter (empty returns all). (default: )
            Limit: Maximum number of values to return. (default: )
         Response:
         Examples:
            All artists   ---- link goes to: http://xxxx:52199/MCWS/v1/Library/Values?Field=Artist
            Audio artists 
            Rock artists

            Image keywords

If it is not possible to get a fix for this could you please suggest a workaround for those of us who are trying to get a list of: "all artists", "all album" etc. in XML format.

Thanks
Title: Re: MCWS broken for Values in MC16?
Post by: Matt on February 21, 2012, 08:14:32 pm
If it is not possible to get a fix for this could you please suggest a workaround for those of us who are trying to get a list of: "all artists", "all album" etc. in XML format.

Library/Values can only be used for searching in MC 16.

With MC 17, it can do both:
http://localhost:52199/MCWS/v1/Library/Values?Field=Artist

MC 17 is the current version.  No changes will be made to MC 16.
Title: Re: MCWS broken for Values in MC16?
Post by: jitterjames on February 22, 2012, 07:12:49 am
Wow.  Too bad.
Title: Re: MCWS broken for Values in MC16?
Post by: JimH on February 22, 2012, 07:37:51 am
We don't go backward.  We only go forward.
Title: Re: MCWS broken for Values in MC16?
Post by: Lespaul on March 01, 2012, 05:54:31 am
Hi Jim, is there any way to get the itemID back in these queries?
The current search functionality in the webservice is lacking the option to group by artist,album etc.
A few additions to the "Values" call, could easily replace the current search.
Title: Re: MCWS broken for Values in MC16?
Post by: Matt on March 01, 2012, 11:22:24 am
Hi Jim, is there any way to get the itemID back in these queries?
The current search functionality in the webservice is lacking the option to group by artist,album etc.
A few additions to the "Values" call, could easily replace the current search.

The results from this function are not browse ids.  For example, you could get results for all the composers but there's no rule that composers are listed in the browse tree.

Gizmo uses the Library/Values function for searching.  For example:
http://localhost:52199/MCWS/v1/Library/Values?Filter=Dylan

First result from call above:
<Item Name="Artist">Bob Dylan</Item>

Play the result:
http://localhost:52199/MCWS/v1/Files/Search?query=[Artist]=[Bob Dylan]&Action=Play

Someday we may add searching to the Browse interface, but it's not currently possible.
Title: Re: MCWS broken for Values in MC16?
Post by: cliff_g on March 04, 2012, 09:19:32 am
Is it possible to use wildcards in the search function?

So I would be able to pass though dylan instead of bob dylan to allow free text searching..

http://localhost:52199/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Artist]=[dylan]

This would be more relevant when searching for tracks that contain the word "mud" for example.

In the Web Remote you have a search function - what is this using?

Cheers
Cliff