Merge pull request #23 from KevinMidboe/bugfix_api/plex/playing
Bugfix api/plex/playing #21
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class PlexRepository {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error(err);
|
||||
throw new Error('Error handling plex playing. Error: ' + err);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user