Merge pull request #23 from KevinMidboe/bugfix_api/plex/playing

Bugfix api/plex/playing #21
This commit is contained in:
2017-09-07 23:57:41 +02:00
committed by GitHub
5 changed files with 22 additions and 12 deletions

View File

@@ -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;
}
}

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

@@ -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;
}

View File

@@ -51,7 +51,7 @@ class PlexRepository {
}
})
.catch((err) => {
throw new Error(err);
throw new Error('Error handling plex playing. Error: ' + err);
})
}
}

View File

@@ -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;
}
}