INTERACT FORUM

Please login or register.

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

Author Topic: MCWS request - formatted=1  (Read 625 times)

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2365
MCWS request - formatted=1
« on: March 25, 2023, 05:24:37 am »

Would it be possible to add a &Formatted=1 flag to /File/GetInfo and /Playlist/Files calls? Currently all dates are returned in raw format.
SetInfo has it, and the Automation API also has it.

Other calls that take a Fields arg but not a Formatted flag:
/Playback/Playlist
/Playlist/Files
/Files/Search
/Files/Current
/Files/GetInfo
/Files/GetLinkExpanded
/File/GetInfo
/Browse/Files
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41935
  • Shoes gone again!
Re: MCWS request - formatted=1
« Reply #1 on: March 27, 2023, 07:22:53 am »

The call to GetInfo returns an MPL.  When we save an MPL, we add this field if date is found: Date (readable).
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2365
Re: MCWS request - formatted=1
« Reply #2 on: March 27, 2023, 08:05:37 am »

There's an option for JSON formatting, like so:
http://localhost:52199/MCWS/v1/File/GetInfo?file=165604&action=json

Date (readable) is added, but I'm talking about formatting all fields, not just "Date". There are many other fields containing dates, times or floats that can be formatted in MC, like [duration] vs [duration,0]. The automation API has an arg "bFormatted=1" which can be used with any field to return either the formatted or unformatted value, and I'd like the same on MCWS so that their display on external tools is the same as within MC.

[{
    "Key": 165604,
    "Date (readable)": "2022",
    "Date": 44562,
    "Date (release)": 44899,
    "Duration": 6142.89,
    "Date Imported": 1673180854,
    "Last Played": 1673638020,
    "File Size": 1711095652,
    "Date Created": 1673006534,
    "Date Modified": 1673006866,
    "FPS": 23.97602081298828,
    "Last Played (album)": 1673638020,

    (truncated)
}]
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41935
  • Shoes gone again!
Re: MCWS request - formatted=1
« Reply #3 on: March 27, 2023, 08:21:51 am »

Got it.  I'll add this today.  I'll make MPL and JSON respect a new formatted variable.

Thanks for the suggestion.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2365
Re: MCWS request - formatted=1
« Reply #4 on: March 27, 2023, 08:31:09 am »

Cool, thanks!
Logged
Pages: [1]   Go Up