Creates a stream object that converts the plex now_playing json format to contain only the wanted information about the palyer, user, transcode, and whats playing

This commit is contained in:
2017-05-10 19:57:49 -06:00
parent f6a77660db
commit baa8515bd4

View File

@@ -0,0 +1,17 @@
const convertPlexToMovie = require('src/plex/convertPlexToMovie');
const convertStreamToMediaInfo = require('src/plex/convertStreamToMediaInfo');
const convertStreamToPlayer = require('src/plex/stream/convertStreamToPlayer');
const convertStreamToUser = require('src/plex/stream/convertStreamToUser');
const ConvertStreamToPlayback = require('src/plex/stream/convertStreamToPlayback');
function convertPlexToStream(plexStream) {
const stream = convertPlexToMovie(plexStream);
stream.mediaInfo = convertStreamToMediaInfo(plexStream.Media);
stream.player = convertStreamToPlayer(plexStream.Player);
stream.user = convertStreamToUser(plexStream.User);
stream.playback = new ConvertStreamToPlayback(plexStream.Media.Part);
return stream;
}
module.exports = convertPlexToStream;