wp-net / WordPressPCL

This is a portable library for consuimg the WordPress REST-API in (almost) any C# application
MIT License
338 stars 129 forks source link

MediaItem.MediaDetails only correctly describes images #184

Open MuiBienCarlota opened 4 years ago

MuiBienCarlota commented 4 years ago

When requesting for audio files uploaded to WP (for exemple getting /wp-json/wp/v2/media?media_type=audio&per_page=100), each media item contains:

"mime_type": "audio/mpeg",
"media_details": {
   "dataformat": "mp3",
   "channels": 2,
   "sample_rate": 44100,
   "bitrate": 256000,
   "channelmode": "stereo",
   "bitrate_mode": "cbr",
   "lossless": false,
   "encoder_options": "CBR256",
   "compression_ratio": 0.18140589569160998,
   "fileformat": "mp3",
   "filesize": 1545929,
   "mime_type": "audio/mpeg",
   "length": 48,
   "ength_formatted": "0:48",
   "genre": "Blues",
   "year": "2019",
   "date": "0813",
   "text": "Author name",
   "sizes": { }
},

but your MediaItem.MediaDetails does not have provision to describe anythink else than images properties.

The details of the media seems to be dependent on mime_type property.

ThomasPe commented 4 years ago

These could certainly be added as optional Properties to the MediaDetails model, care to open a PR for this? https://github.com/wp-net/WordPressPCL/blob/master/WordPressPCL/Models/MediaDetails.cs