diff --git a/seasoned_api/src/media_classes/mediaInfo.js b/seasoned_api/src/media_classes/mediaInfo.js index c3cb52f..3019f25 100644 --- a/seasoned_api/src/media_classes/mediaInfo.js +++ b/seasoned_api/src/media_classes/mediaInfo.js @@ -1,12 +1,14 @@ class MediaInfo { - constructor(device, platform) { - this.device = undefined; - this.platform = undefined; - this.ip = undefined; - this.product = undefined; - this.title = undefined; - this.state = undefined; - + constructor() { + this.duration = undefined; + this.height = undefined; + this.width = undefined; + this.bitrate = undefined; + this.resolution = undefined; + this.framerate = undefined; + this.protocol = undefined; + this.container = undefined; + this.audioCodec = undefined; } } diff --git a/seasoned_api/src/plex/convertPlexToStream.js b/seasoned_api/src/plex/convertPlexToStream.js index 46ddfcd..1e82173 100644 --- a/seasoned_api/src/plex/convertPlexToStream.js +++ b/seasoned_api/src/plex/convertPlexToStream.js @@ -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; } diff --git a/seasoned_api/src/plex/convertStreamToMediaInfo.js b/seasoned_api/src/plex/convertStreamToMediaInfo.js index cd55477..60d6c1d 100644 --- a/seasoned_api/src/plex/convertStreamToMediaInfo.js +++ b/seasoned_api/src/plex/convertStreamToMediaInfo.js @@ -6,6 +6,7 @@ function convertStreamToMediaInfo(plexStream) { mediaInfo.duration = plexStream.duration; mediaInfo.height = plexStream.height; mediaInfo.width = plexStream.width; + if (plexStream.bitrate) { mediaInfo.bitrate = plexStream.bitrate; } diff --git a/seasoned_api/src/plex/plexRepository.js b/seasoned_api/src/plex/plexRepository.js index 0de89c6..25645a8 100644 --- a/seasoned_api/src/plex/plexRepository.js +++ b/seasoned_api/src/plex/plexRepository.js @@ -51,7 +51,7 @@ class PlexRepository { } }) .catch((err) => { - throw new Error(err); + throw new Error('Error handling plex playing. Error: ' + err); }) } } diff --git a/seasoned_api/src/plex/stream/convertStreamToPlayback.js b/seasoned_api/src/plex/stream/convertStreamToPlayback.js index 555a07e..f4fae2d 100644 --- a/seasoned_api/src/plex/stream/convertStreamToPlayback.js +++ b/seasoned_api/src/plex/stream/convertStreamToPlayback.js @@ -4,6 +4,11 @@ class convertStreamToPlayback { this.width = plexStream.width; this.height = plexStream.height; this.decision = plexStream.decision; + this.audioProfile = plexStream.audioProfile; + this.videoProfile = plexStream.videoProfile; + this.duration = plexStream.duration; + this.container = plexStream.container; + } }