Class

Plex

Plex(config)

Constructor

# new Plex(config)

Plex
Parameters:
Name Type Attributes Default Description
config object plex config
host string ip address of computer running plex server
token string plex token
useCachedLibrary boolean <optional>
true set to false to always get library from server

View Source src.js, line 59

Example
const Plex = require("@ryanforever/plex")
const plex = new Plex({
	token: process.env.PLEX_TOKEN,
	host: "192.168.1.128"
})

Methods

# analyzeMovies(config) → {object}

analyze your plex library
Parameters:
Name Type Default Description
config object
max object 25 max amount of items to list

View Source src.js, line 729

an analysis of your plex library
object

# cacheLibrary()

get library from server and save locally

View Source src.js, line 686

# findCollection()

find a collection by name or id

View Source src.js, line 188

# findLibrary()

find library by name or id

View Source src.js, line 119

# getCollectionById()

get a collection by it's id

View Source src.js, line 171

# getCollections()

get all collections from all libraryies

View Source src.js, line 155

# getLibraries()

get all libraries

View Source src.js, line 129

# getLibrary() → {array}

get the full plex library

View Source src.js, line 642

plex items
array

# getLibraryCollections()

get collections from a single library, by libraryId

View Source src.js, line 140

# getMovies() → {array}

get only movies

View Source src.js, line 662

movies
array

# list(prop) → {array}

list movies with a given property
Parameters:
Name Type Description
prop string property i.e. "director" "writer" "genre" etc

View Source src.js, line 625

writers
array

# listActors() → {array}

list all actors

View Source src.js, line 594

actors
array

# listCountries() → {array}

list all countries

View Source src.js, line 601

countries
array

# listDirectors() → {array}

list all directors

View Source src.js, line 580

directors
array

# listGenres() → {array}

list all genres

View Source src.js, line 608

genres
array

# listWriters() → {array}

list all writers

View Source src.js, line 587

writers
array
wrapper around plex's search function

View Source src.js, line 209

# searchActors(query) → {array}

search arctors in movies
Parameters:
Name Type Description
query string your search query

View Source src.js, line 550

movies with queried actor
array
Example
plex.searchActors("denzel washington").then(console.log)

# searchCollections()

search collections with given input. if an id is given, will return that collection

View Source src.js, line 196

# searchDirectors(query) → {array}

search directors of movies
Parameters:
Name Type Description
query string your search query

View Source src.js, line 489

movies with queried director
array
Example
plex.searchDirectors("stanley kubrick").then(console.log)

# searchMovies(query) → {array}

search all movies
Parameters:
Name Type Description
query string your search query

View Source src.js, line 461

array of movies
array
Example
plex.searchMovies("adaptation").then(console.log)

# searchWriters(query) → {array}

search writers of movies
Parameters:
Name Type Description
query string your search query

View Source src.js, line 518

movies with queried writer
array
Example
plex.searchWriters("charlie kauffman").then(console.log)

# setCollectionVisibility()

set visibility of collection by id

View Source src.js, line 364

# updateCollection()

update collection

View Source src.js, line 295