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 |
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 |
an analysis of your plex library
object
# getLibraryCollections()
get collections from a single library, by libraryId
# list(prop) → {array}
list movies with a given property
Parameters:
| Name | Type | Description |
|---|---|---|
prop |
string
|
property i.e. "director" "writer" "genre" etc |
writers
array
# searchActors(query) → {array}
search arctors in movies
Parameters:
| Name | Type | Description |
|---|---|---|
query |
string
|
your search query |
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
# searchDirectors(query) → {array}
search directors of movies
Parameters:
| Name | Type | Description |
|---|---|---|
query |
string
|
your search query |
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 |
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 |
movies with queried writer
array
Example
plex.searchWriters("charlie kauffman").then(console.log)