INTERACT FORUM

Windows => Plug-in Development => Topic started by: zybex on March 25, 2023, 05:24:37 am

Title: MCWS request - formatted=1
Post by: zybex 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
Title: Re: MCWS request - formatted=1
Post by: Matt 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).
Title: Re: MCWS request - formatted=1
Post by: zybex 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)
}]
Title: Re: MCWS request - formatted=1
Post by: Matt 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.
Title: Re: MCWS request - formatted=1
Post by: zybex on March 27, 2023, 08:31:09 am
Cool, thanks!