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 {
|
class MediaInfo {
|
||||||
constructor(device, platform) {
|
constructor() {
|
||||||
this.device = undefined;
|
this.duration = undefined;
|
||||||
this.platform = undefined;
|
this.height = undefined;
|
||||||
this.ip = undefined;
|
this.width = undefined;
|
||||||
this.product = undefined;
|
this.bitrate = undefined;
|
||||||
this.title = undefined;
|
this.resolution = undefined;
|
||||||
this.state = 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');
|
const ConvertStreamToPlayback = require('src/plex/stream/convertStreamToPlayback');
|
||||||
|
|
||||||
function convertPlexToStream(plexStream) {
|
function convertPlexToStream(plexStream) {
|
||||||
const stream = convertPlexToSeasoned(plexStream);
|
const stream = convertPlexToSeasoned(plexStream)
|
||||||
stream.mediaInfo = convertStreamToMediaInfo(plexStream.Media);
|
const plexStreamMedia = plexStream.Media[0]
|
||||||
|
stream.mediaInfo = convertStreamToMediaInfo(plexStreamMedia);
|
||||||
stream.player = convertStreamToPlayer(plexStream.Player);
|
stream.player = convertStreamToPlayer(plexStream.Player);
|
||||||
|
|
||||||
stream.user = convertStreamToUser(plexStream.User);
|
stream.user = convertStreamToUser(plexStream.User);
|
||||||
stream.playback = new ConvertStreamToPlayback(plexStream.Media.Part);
|
stream.playback = new ConvertStreamToPlayback(plexStreamMedia.Part[0]);
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ function convertStreamToMediaInfo(plexStream) {
|
|||||||
mediaInfo.duration = plexStream.duration;
|
mediaInfo.duration = plexStream.duration;
|
||||||
mediaInfo.height = plexStream.height;
|
mediaInfo.height = plexStream.height;
|
||||||
mediaInfo.width = plexStream.width;
|
mediaInfo.width = plexStream.width;
|
||||||
|
|
||||||
if (plexStream.bitrate) {
|
if (plexStream.bitrate) {
|
||||||
mediaInfo.bitrate = plexStream.bitrate;
|
mediaInfo.bitrate = plexStream.bitrate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class PlexRepository {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.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.width = plexStream.width;
|
||||||
this.height = plexStream.height;
|
this.height = plexStream.height;
|
||||||
this.decision = plexStream.decision;
|
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