1.0.0 • Published 6 years ago
plex-protocol v1.0.0
Plex Protocol
Plex HTTP API protocol
Install via npm
$ npm install --save plex-protocol
Usage
var Plex = require( 'plex-protocol' )
Creating a Client
var client = new Plex.Client({
url: `http://127.0.0.1:32400/`,
})
Identity
client.identity( function( error, data ) {
console.log( error || data )
})
{
_element: 'MediaContainer',
size: '0',
machineIdentifier: '990745400819dd8281d74fff91def2ec0056714c',
version: '1.5.5.3634-995f1dead'
}
General Information
client.getInfo( function( error, info ) {
console.log( error || info )
})
{
identity: {
machineIdentifier: '990745400819dd8281d74fff91def2ec0056714c',
version: '1.5.6.3790-4613ce077'
},
friendlyName: 'something',
features: ['download_certificates', 'federated-auth', 'news'],
myPlex: {
enabled: true,
mappingState: 'mapped',
signinState: 'ok',
subscription: false,
username: 'user@host.tld'
},
allowCameraUpload: false,
allowChannelAccess: true,
allowSharing: true,
allowSync: false,
backgroundProcessing: true,
certificate: true,
companionProxy: true,
eventStream: true,
hubSearch: true,
multiuser: true,
pluginHost: true,
readOnlyLibraries: false,
requestParametersInCookie: true,
sync: true,
updater: true,
transcoder: {
audio: true,
lyrics: true,
photo: true,
subtitles: true,
video: true,
videoBitrates: [ 64, 96, 208, 320, 720, 1500, 2000, 3000, 4000, 8000, 10000, 12000, 20000 ],
videoQualities: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ],
videoResolutions: [ 128, 128, 160, 240, 320, 480, 768, 720, 720, 1080, 1080, 1080, 1080 ]
},
directories: {
activities: { count: 1, title: 'activities' },
butler: { count: 1, title: 'butler' },
channels: { count: 1, title: 'channels' },
clients: { count: 1, title: 'clients' },
diagnostics: { count: 1, title: 'diagnostics' },
hubs: { count: 1, title: 'hubs' },
library: { count: 1, title: 'library' },
livetv: { count: 2, title: 'livetv' },
media: { count: 3, title: 'media' },
neighborhood: { count: 1, title: 'neighborhood' },
playQueues: { count: 1, title: 'playQueues' },
player: { count: 1, title: 'player' },
playlists: { count: 1, title: 'playlists' },
resources: { count: 1, title: 'resources' },
search: { count: 1, title: 'search' },
server: { count: 1, title: 'server' },
servers: { count: 1, title: 'servers' },
statistics: { count: 1, title: 'statistics' },
system: { count: 1, title: 'system' },
transcode: { count: 1, title: 'transcode' },
updater: { count: 1, title: 'updater' }
}
}
Search
client.search({
query: 'Something',
year: '2016',
}, function( error, data ) {
console.log( error || data )
})
Making requests
client.get( '/library/sections/2/all', function( error, data ) {
// ...
})
Getting account information
client.account( function( error, data ) {
// ...
})
List clients
client.clients( function( error, data ) {
// ...
})
List sessions
client.sessions( function( error, data ) {
// ...
})
List servers
client.servers( function( error, data ) {
// ...
})
Get preferences
client.preferences( function( error, data ) {
// ...
})
client.systemPreferences( function( error, data ) {
// ...
})
Examples
Remotely installing a plugin
var pluginId = 'com.plexapp.plugins.vice'
var client = new Plex.Client({
url: 'http://127.0.0.1:32400/',
})
client.get( `/system/appstore/apps/${pluginId}/install`, function( error, result ) {
// ...
})
1.0.0
6 years ago