Now both Media and Media.Part in the JSON object about a stream is a list and need to index the first element of the stream to get this info.

This commit is contained in:
2017-09-07 23:47:11 +02:00
parent 28d0b63960
commit cd52d295b0
2 changed files with 7 additions and 3 deletions

View File

@@ -5,11 +5,13 @@ const convertStreamToUser = require('src/plex/stream/convertStreamToUser');
const ConvertStreamToPlayback = require('src/plex/stream/convertStreamToPlayback');
function convertPlexToStream(plexStream) {
const stream = convertPlexToSeasoned(plexStream);
stream.mediaInfo = convertStreamToMediaInfo(plexStream.Media);
const stream = convertPlexToSeasoned(plexStream)
const plexStreamMedia = plexStream.Media[0]
stream.mediaInfo = convertStreamToMediaInfo(plexStreamMedia);
stream.player = convertStreamToPlayer(plexStream.Player);
stream.user = convertStreamToUser(plexStream.User);
stream.playback = new ConvertStreamToPlayback(plexStream.Media.Part);
stream.playback = new ConvertStreamToPlayback(plexStreamMedia.Part[0]);
return stream;
}

View File

@@ -15,6 +15,8 @@ function convertStreamToMediaInfo(plexStream) {
mediaInfo.container = plexStream.container;
mediaInfo.audioCodec = plexStream.audioCodec;
console.log(mediaInfo)
return mediaInfo;
}