INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MCWS Help Please  (Read 755 times)

Striker

  • World Citizen
  • ***
  • Posts: 176
MCWS Help Please
« on: February 11, 2024, 05:36:49 pm »

Hi, I'm trying to get some of the MCWS commands working.  I currently am running v30 so I can't test this myself.  I'm working on an alternative to my use of the PlayingNow plugin which only works on the 32 bit version of MC.  If I can get the info I need using MCWS then I can give up the PlayingNow plugin and I'd purchase MC 32.

For the v31 command: http://127.0.0.1:52199/MCWS/v1/Playback/Info?Fields=Genre

Can I query for user fields too?

Can I query for the next track fields?  (PlayingNow lets me select fields like "next.artist")
If not, then I guess I could query for the NextFileKey using GetInfo, but it's not working for me.

This does not work for me:

http://localhost:52199/MCWS/v1/Playback/GetInfo?File=54404   // which is a valid key


Quote
      Info
         Get information about the current playback.
         Parameters:
            Zone: The zone the command is targetted for. (default: -1)
            ZoneType: The type of value provided in 'Zone' (ID: zone id; Index: zone index; Name: zone name). (default: ID)
         Response:
            ZoneID: The zone ID of this zone.
            ZoneName: The display name of this zone.
            State: The playback state of the player.
            FileKey: The database key of the playing file.
            NextFileKey: The database key of the next file to play.
            PositionMS: The position of the playback in milliseconds.
            DurationMS: The duration of the playing file in milliseconds.
            ElapsedTimeDisplay: The elapsed playback time as a display friendly string.
            RemainingTimeDisplay: The remaining playback time as a display friendly string.
            TotalTimeDisplay: The total playback time as a display friendly string.
            PositionDisplay: The playback position as a display friendly string.
            PlayingNowPosition: The index of the current track in Playing Now.
            PlayingNowTracks: The number of files in Playing Now.
            PlayingNowPositionDisplay: The current Playing Now position formatted for display.
            PlayingNowChangeCounter: A counter that increments any time the playlist is changed.
            Bitrate: The current bitrate, in kbps.
            Bitdepth: The current bitdepth.
            SampleRate: The current sample rate in Hz.
            Channels: The number of audio channels in the current output.
            Chapter: The current playback chapter.
            Volume: The current volume.
            VolumeDisplay: A display friendly string version of the current volume.
            ImageURL: An image URL for the current file.
            Artist: Artist of current file.
            Album: Album of current file.
            Name: Name of current file.
            Rating: Rating of current file.
            Status: Playback status as a displayable string.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: MCWS Help Please
« Reply #1 on: February 11, 2024, 05:42:40 pm »

There's no parameter file for getinfo, keys is the right parameter for that call

the quoted doc is for a different API so it's not entirely clear what you are trying to ask though
Logged

Striker

  • World Citizen
  • ***
  • Posts: 176
Re: MCWS Help Please
« Reply #2 on: February 11, 2024, 06:09:21 pm »

http://localhost:52199/MCWS/v1/Playback/GetInfo?Keys=54404

doesn't work for me either.  Is this a valid MCWS command for MC v30?

This does work for me.

http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1

I'm trying to get info about the current and next track and the playback status.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: MCWS Help Please
« Reply #3 on: February 12, 2024, 01:37:17 am »

It's Files/GetInfo so you need to read the doc more carefully to make sure you have the right URL, use the example link if in doubt then copy that
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: MCWS Help Please
« Reply #4 on: February 12, 2024, 04:42:22 am »

/File/GetInfo to get info about a specific file:
http://localhost:52199/MCWS/v1/File/Getinfo?File=54404&Action=json

/Playback/Info gives you the current and next file being played:
http://localhost:52199/MCWS/v1/Playback/Info

You can use /Playback/Playlist to get all files in the current playlist too.
http://localhost:52199/MCWS/v1/Playback/Playlist?ActiveFileOnly=1&Action=json&Fields=Name,Album,Artist,Genre

(bug? it looks like ActiveFileOnly=1 returns all files in playlist if there's nothing playing, instead of an empty list)
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MCWS Help Please
« Reply #5 on: February 12, 2024, 10:54:05 am »

If you set ActiveFileOnly, you need to also set ActiveFile.
Logged
Matt Ashland, JRiver Media Center

MrBiff

  • World Citizen
  • ***
  • Posts: 151
Re: MCWS Help Please
« Reply #6 on: February 12, 2024, 11:18:16 am »

Here are the calls in the debug lines.
Logged

Striker

  • World Citizen
  • ***
  • Posts: 176
Re: MCWS Help Please
« Reply #7 on: February 12, 2024, 11:36:16 am »

Thank You for the reply.

Quote
/Playback/Info gives you the current and next file being played:
http://localhost:52199/MCWS/v1/Playback/Info

For the v31 command which adds the Fields keyword: http://127.0.0.1:52199/MCWS/v1/Playback/Info?Fields=Genre [;...]

Can I query for user fields too?

Can I query for the next track fields?  (PlayingNow lets me select fields like "next.artist")

Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2618
Re: MCWS Help Please
« Reply #8 on: February 12, 2024, 11:46:52 am »

No, you can't get Field info for the next file like that.
You first need to call /Playback/Info with no parameters, and that gives you the current FileKey and the NextFileKey:

http://localhost:52199/MCWS/v1/Playback/Info
Response:
(...)
<Item Name="FileKey">44809</Item>
<Item Name="NextFileKey">121604</Item>
(...)

Then you call /File/GetInfo for each of those keys to get all the field values (or just the ones you need) for each of them:
http://localhost:52199/MCWS/v1/File/Getinfo?File=44809&Action=json
http://localhost:52199/MCWS/v1/File/Getinfo?File=121604&Action=json
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: MCWS Help Please
« Reply #9 on: February 12, 2024, 12:05:58 pm »

You can at least save one call by adding the fields to the first call
Logged

Striker

  • World Citizen
  • ***
  • Posts: 176
Re: MCWS Help Please
« Reply #10 on: February 12, 2024, 12:12:00 pm »

You can at least save one call by adding the fields to the first call

Agree... but...

For the v31 command which adds the Fields keyword: http://127.0.0.1:52199/MCWS/v1/Playback/Info?Fields=Genre [;...]

Can I query for user fields too?
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4226
Re: MCWS Help Please
« Reply #11 on: February 12, 2024, 12:20:19 pm »

any field is fine
Logged

Striker

  • World Citizen
  • ***
  • Posts: 176
Re: MCWS Help Please
« Reply #12 on: February 12, 2024, 06:32:08 pm »

Thanks to all who helped out.
Logged
Pages: [1]   Go Up