Plex_Server_Library_Section_Movie
class Plex_Server_Library_Section_Movie extends Plex_Server_Library_SectionAbstract
Class that represents a Plex library movie section and allows retrieval of Plex library movies.
Traits
Constants
| DEFAULT_ADDRESS |
The default address on which a Plex server listens. |
| DEFAULT_PORT |
The default port on which a Plex server listens. |
| ENDPOINT_CLIENT |
The Plex HTTP API endpoint for client listing. |
| ENDPOINT_LIBRARY |
URL endpoint for Plex server library. |
| ENDPOINT_SECTION |
URL endpoint for library sections. |
| ENDPOINT_RECENTLY_ADDED |
URL endpoint for a library's recently added items. |
| ENDPOINT_ON_DECK |
URL endpoint for a library's on deck items. |
| ENDPOINT_METADATA |
URL endpoint for single library items. |
| TYPE_MOVIE |
String that identifies a Plex library movie item type. |
| TYPE_ARTIST |
String that identifies a Plex library artist item type. |
| TYPE_ALBUM |
String that identifies a Plex library album item type. |
| TYPE_TRACK |
String that identifies a Plex library track item type. |
| TYPE_PHOTO |
String that identifies a Plex library photo item type. |
| TYPE_SHOW |
String that identifies a Plex library TV show item type. |
| TYPE_SEASON |
String that identifies a Plex library TV season item type. |
| TYPE_EPISODE |
String that identifies a Plex library episode item type. |
| ENDPOINT_CATEGORY_ALL |
Endpoint for retrieving all items for a section. |
| ENDPOINT_CATEGORY_UNWATCHED |
Endpoint for retrieving all unwatched items for a section. |
| ENDPOINT_CATEGORY_NEWEST |
Endpoint for retrieving the newest items for a section. |
| ENDPOINT_CATEGORY_RECENTLY_ADDED |
Endpoint for retrieving recently added items for a section. |
| ENDPOINT_CATEGORY_RECENTLY_VIEWED |
Endpoint for retrieving recently viewed items for a section. |
| ENDPOINT_CATEGORY_ON_DECK |
Endpoint for retrieving on deck items for a section. |
| ENDPOINT_CATEGORY_COLLECTION |
Endpoint for retrieving items for a section by collection. |
| ENDPOINT_CATEGORY_FIRST_CHARACTER |
Endpoint for retrieving items for a section by first character. |
| ENDPOINT_CATEGORY_GENRE |
Endpoint for retrieving items for a section by genre. |
| ENDPOINT_CATEGORY_YEAR |
Endpoint for retrieving items for a section by year. |
| ENDPOINT_CATEGORY_CONTENT_RATING |
Endpoint for retrieving shows by content rating. |
| ENDPOINT_SEARCH |
Endpoint for searching a section for items. |
| SEARCH_TYPE_MOVIE |
Parameter for searching movies. |
| SEARCH_TYPE_SHOW |
Parameter for searching television shows. |
| SEARCH_TYPE_EPISODE |
Parameter for searching television episodes. |
| SEARCH_TYPE_ARTIST |
Parameter for searching artists. |
| SEARCH_TYPE_TRACK |
Parameter for searching tracks. |
| ENDPOINT_CATEGORY_DECADE |
Endpoint for retrieving movies by four digit decade. |
| ENDPOINT_CATEGORY_DIRECTOR |
Endpoint for retrieving movies by director. |
| ENDPOINT_CATEGORY_ACTOR |
Endpoint for retrieving movies by actor. |
| ENDPOINT_CATEGORY_RESOLUTION |
Endpoint for retrieving movies by resolution. |
Properties
| protected string | $name | The name of the Plex machine on the network. | from Plex_MachineAbstract |
| protected string | $address | The IP address of the Plex machine on the network. | from Plex_MachineAbstract |
| protected integer | $port | The port on which the Plex machine is listening. Typically 32400 for servers and 3000 for clients. | from Plex_MachineAbstract |
| protected string | $token | The token of the Plex machine on the network. | from Plex_MachineAbstract |
| protected string | $art | Reference to the art section's art. | from Plex_Server_Library_SectionAbstract |
| protected boolean | $refreshing | Boolean saying whether or not the section is currently refreshing. | from Plex_Server_Library_SectionAbstract |
| protected integer | $key | The section's key. | from Plex_Server_Library_SectionAbstract |
| protected string | $type | The section's type. | from Plex_Server_Library_SectionAbstract |
| protected string | $title | The section's title. | from Plex_Server_Library_SectionAbstract |
| protected string | $agent | The metadata agent for the section. | from Plex_Server_Library_SectionAbstract |
| protected string | $scanner | The type of scanner for the section. | from Plex_Server_Library_SectionAbstract |
| protected string | $language | The section's language. | from Plex_Server_Library_SectionAbstract |
| protected string | $uuid | Universally unique identifier for the section. | from Plex_Server_Library_SectionAbstract |
| protected DateTime | $updatedAt | Date the section was last updated. | from Plex_Server_Library_SectionAbstract |
| protected DateTime | $createdAt | Date the section was created. | from Plex_Server_Library_SectionAbstract |
Methods
Returns the base URL, which will be standard for all requests made to the Plex machine.
Typically the useful data returned by a Plex machine will containted in XML attributes. This allows a set of XML nodes to be passed and all the attribues extracted and returned as an associated array.
Utilizes php-curl to send a request to the passed URL and returns an XML document reprentation of the returned content.
Universal function so any method belonging to a child class of a Plex machine can discover which function called it. This is used mainly for some of our polymorphic requests as the calling function can tell us what type of item is being requested.
Sets up our Plex server using the minimum amount of data required to interact.
Returns all the available clients to which the Plex server has access indexed by the Plex client name.
Returns the Plex library belonging to the instantiated Plex server.
Generic way of building a url agains the Plex library.
Generic way of requesting Plex library items.
Given a function name, uses that name to decide what Plex library item item type with which the function is associated. This is useful when trying to polymorphically request items because we can use the calling function to abstractly identify what type of item with which we are dealing.
Returns an array of user defined Plex library sections that can be used to interact with the items contained within.
Returns a Plex library section by its given key. Here we simply run self::getSections() because the endpoint /library/sections/ID does not return full section data, it returns the categories below the section.
Returns a Plex library section by its given key or by a exact match on title. Here we simply run self::getSections() because the endpoint /library/sections/ID does not return full section data, it returns the categories below the section.
Returns the recently added items at the library level.
Adds the attributes to the object if they exist.
Generic method for building a Plex library section endpoint.
Builds an endpoint to search a Plex library section.
Generic method allowing a child class to retrieve all items for its section.
Generic method allowing a child class to retrieve all unwatched items for its section.
Generic method allowing a child class to retrieve the newest items for its section.
Generic method allowing a child class to retrieve recently added items for its section. It is named slightly differently as it collided with the library method of the same name.
Generic method allowing a child class to retrieve the on deck items for its section. It is named slightly differently as it collided with the library method of the same name.
Generic method allowing a child class to retrieve recently viewed items for its section.
Generic method allowing a child class to retrieve recently viewed items for its section.
Generic method allowing a child class to retrieve items by first character from its section.
Generic method allowing a child class to retrieve items by genre from its section.
Generic method allowing a child class to retrieve items by four digit year from its section
A generic method to allow polymorphic retrieval of a single library item.
Returns a list with first letter of title, key and size for the child class's section. We use makeCall directly here, because we want to return just the raw array of caracters and not do any post processing on it.
Returns a list of alphanumeric of first letter for the child class's section.
Returns a list of collections for the child class's section. We use makeCall directly here, because we want to return just the raw array of collections and not do any post processing on it.
Returns a list of genres for the child class's section. We use makeCall directly here, because we want to return just the raw array of genres and not do any post processing on it.
Static factory method used to instantiate child section classes by their type.
Sets a reference to the section's art.
Tells whether the section is currently in the process of refreshing.
Sets whether the section is currently in the process of refreshing.
Sets the section's scanner
Sets the section's language.
Returns the section's universally unique identifier.
Sets the section's universally unique identifier.
Returns the time at which the section was last updated.
Sets the time at which the section was last updated.
Returns the time at which the section was created.
Sets the time at which the section was last created.
Returns a list of content ratings for the section. We use makeCall directly here because we want to return just the raw array of content ratings and not do any post processing on it.
Returns all the movies for the given section.
Returns all the unwatched movies for the given section.
Returns the recently released movies for the given section.
Returns the recently added movies for the given section.
Returns the recently viewed movies for the given section.
Returns the on deck movies for the given section.
Returns all the movies contained in a given collection.
Returns all the movies categorized under a given genre.
Returns all the movies from a given four digit year.
Returns all the movies from a given four digit decade.
Returns all the movies categorized under a given director.
Returns all the movies categorized under a given actor.
Returns all the movies categorized under a given content rating.
Returns all the movies categorized under a given resolution.
Returns all movies in the section whose titles start with the given character.
Returns a list of directors for the section. We use makeCall directly here, because we want to return just the raw array of directors and not do any post processing on it.
Returns a list of actors for the section. We use makeCall directly here because we want to return just the raw array of actors and not do any post processing on it.
Returns a list of resolutions for the section. We use makeCall directly here because we want to return just the raw array of resolutions and not do any post processing on it.
Searches movie titles for the passed query and returns the movies that match.
Returns a single movie by its rating key, key, or exact title match.
Details
in Plex_MachineAbstract at line 78
protected string
getBaseUrl()
Returns the base URL, which will be standard for all requests made to the Plex machine.
in Plex_MachineAbstract at line 102
protected array
xmlAttributesToArray(SimpleXMLElement $xml, integer $pass = 0)
Typically the useful data returned by a Plex machine will containted in XML attributes. This allows a set of XML nodes to be passed and all the attribues extracted and returned as an associated array.
in Plex_MachineAbstract at line 149
protected array
makeCall(string $url)
Utilizes php-curl to send a request to the passed URL and returns an XML document reprentation of the returned content.
in Plex_MachineAbstract at line 196
protected string
getCallingFunction(integer $depth = 2)
Universal function so any method belonging to a child class of a Plex machine can discover which function called it. This is used mainly for some of our polymorphic requests as the calling function can tell us what type of item is being requested.
in Plex_Server at line 75
void
__construct(string $name, string $address, integer $port, string $token)
Sets up our Plex server using the minimum amount of data required to interact.
in Plex_Server at line 99
Plex_Client[]
getClients()
Returns all the available clients to which the Plex server has access indexed by the Plex client name.
in Plex_Server at line 138
Plex_Server_Library
getLibrary()
Returns the Plex library belonging to the instantiated Plex server.
in Plex_Server at line 155
string
getName()
Returns the Plex server's name.
in Plex_Server at line 167
string
getAddress()
Returns the Plex server's IP address.
in Plex_Server at line 179
integer
getPort()
Returns the port on which the Plex server listens.
in Plex_Server at line 191
string
getToken()
Returns the token on which the Plex machine listens.
in Plex_Server_Library at line 123
protected string
buildUrl(string $endpoint)
Generic way of building a url agains the Plex library.
in Plex_Server_Library at line 160
protected mixed[]
getItems(string $endpoint)
Generic way of requesting Plex library items.
in Plex_Server_Library at line 204
string
functionToType($function)
Given a function name, uses that name to decide what Plex library item item type with which the function is associated. This is useful when trying to polymorphically request items because we can use the calling function to abstractly identify what type of item with which we are dealing.
in Plex_Server_Library at line 240
mixed[]
getSections()
Returns an array of user defined Plex library sections that can be used to interact with the items contained within.
in Plex_Server_Library at line 280
mixed
getSectionByKey(integer $key)
deprecated
deprecated
Returns a Plex library section by its given key. Here we simply run self::getSections() because the endpoint /library/sections/ID does not return full section data, it returns the categories below the section.
in Plex_Server_Library at line 311
mixed
getSection(integer|string $polymorphicData)
Returns a Plex library section by its given key or by a exact match on title. Here we simply run self::getSections() because the endpoint /library/sections/ID does not return full section data, it returns the categories below the section.
in Plex_Server_Library at line 343
mixed[]
getRecentlyAddedItems()
Returns the recently added items at the library level.
in Plex_Server_Library at line 356
mixed[]
getOnDeckItems()
Returns the on deck items at the library level.
in Plex_Server_Library_SectionAbstract at line 218
void
setAttributes(array $attribute)
Adds the attributes to the object if they exist.
in Plex_Server_Library_SectionAbstract at line 266
protected string
buildEndpoint(string $endpoint)
Generic method for building a Plex library section endpoint.
in Plex_Server_Library_SectionAbstract at line 288
protected string
buildSearchEndpoint(integer $type, string $query)
Builds an endpoint to search a Plex library section.
in Plex_Server_Library_SectionAbstract at line 313
protected Plex_Server_Library_ItemAbstract[]
getAllItems()
Generic method allowing a child class to retrieve all items for its section.
in Plex_Server_Library_SectionAbstract at line 330
protected
getUnwatchedItems()
Generic method allowing a child class to retrieve all unwatched items for its section.
in Plex_Server_Library_SectionAbstract at line 347
protected
getNewestItems()
Generic method allowing a child class to retrieve the newest items for its section.
in Plex_Server_Library_SectionAbstract at line 365
protected Plex_Server_Library_ItemAbstract[]
getRecentlyAddedSectionItems()
Generic method allowing a child class to retrieve recently added items for its section. It is named slightly differently as it collided with the library method of the same name.
in Plex_Server_Library_SectionAbstract at line 383
protected Plex_Server_Library_ItemAbstract[]
getOnDeckSectionItems()
Generic method allowing a child class to retrieve the on deck items for its section. It is named slightly differently as it collided with the library method of the same name.
in Plex_Server_Library_SectionAbstract at line 400
protected Plex_Server_Library_ItemAbstract[]
getRecentlyViewedItems()
Generic method allowing a child class to retrieve recently viewed items for its section.
in Plex_Server_Library_SectionAbstract at line 421
protected Plex_Server_Library_ItemAbstract[]
getItemsByCollection(integer $collectionKey)
Generic method allowing a child class to retrieve recently viewed items for its section.
in Plex_Server_Library_SectionAbstract at line 447
protected Plex_Server_Library_ItemAbstract[]
getItemsByFirstCharacter(string $character)
Generic method allowing a child class to retrieve items by first character from its section.
in Plex_Server_Library_SectionAbstract at line 474
protected Plex_Server_Library_ItemAbstract[]
getItemsByGenre(integer $genreKey)
Generic method allowing a child class to retrieve items by genre from its section.
in Plex_Server_Library_SectionAbstract at line 500
protected Plex_Server_Library_ItemAbstract[]
getItemsByYear(integer $year)
Generic method allowing a child class to retrieve items by four digit year from its section
in Plex_Server_Library_SectionAbstract at line 538
protected Plex_Server_Library_ItemAbstract
getPolymorphicItem(integer|string $polymorphicData, boolean $scopedToItem = FALSE)
A generic method to allow polymorphic retrieval of a single library item.
This will take a rating key, a key, or a string that it will use to attempt an exact title match.
in Plex_Server_Library_SectionAbstract at line 655
array
getFirstCharacters()
Returns a list with first letter of title, key and size for the child class's section. We use makeCall directly here, because we want to return just the raw array of caracters and not do any post processing on it.
in Plex_Server_Library_SectionAbstract at line 671
array
getAlphabet()
Returns a list of alphanumeric of first letter for the child class's section.
in Plex_Server_Library_SectionAbstract at line 688
array
getCollections()
Returns a list of collections for the child class's section. We use makeCall directly here, because we want to return just the raw array of collections and not do any post processing on it.
in Plex_Server_Library_SectionAbstract at line 709
array
getGenres()
Returns a list of genres for the child class's section. We use makeCall directly here, because we want to return just the raw array of genres and not do any post processing on it.
in Plex_Server_Library_SectionAbstract at line 731
static Plex_Server_Library_SectionAbstract
factory(string $type, string $name, string $address, integer $port, string $token)
Static factory method used to instantiate child section classes by their type.
in Plex_Server_Library_SectionAbstract at line 748
string
getArt()
Returns a reference to the section's art.
in Plex_Server_Library_SectionAbstract at line 762
void
setArt(string $art)
Sets a reference to the section's art.
in Plex_Server_Library_SectionAbstract at line 774
boolean
isRefreshing()
Tells whether the section is currently in the process of refreshing.
in Plex_Server_Library_SectionAbstract at line 788
void
setRefreshing(boolean $refreshing)
Sets whether the section is currently in the process of refreshing.
in Plex_Server_Library_SectionAbstract at line 800
integer
getKey()
Returns the section's key.
in Plex_Server_Library_SectionAbstract at line 814
void
setKey(integer $key)
Sets the section's key.
in Plex_Server_Library_SectionAbstract at line 826
string
getType()
Returns the section's type.
in Plex_Server_Library_SectionAbstract at line 840
void
setType(string $type)
Sets the section's type.
in Plex_Server_Library_SectionAbstract at line 852
string
getTitle()
Returns the section's title.
in Plex_Server_Library_SectionAbstract at line 866
void
setTitle(string $title)
sets the section's title.
in Plex_Server_Library_SectionAbstract at line 878
string
getAgent()
Returns the section's agent.
in Plex_Server_Library_SectionAbstract at line 892
void
setAgent(string $agent)
Sets the section's agent.
in Plex_Server_Library_SectionAbstract at line 904
string
getScanner()
Returns the section's scanner
in Plex_Server_Library_SectionAbstract at line 918
void
setScanner(string $scanner)
Sets the section's scanner
in Plex_Server_Library_SectionAbstract at line 930
string
getLanguage()
Returns the section's language.
in Plex_Server_Library_SectionAbstract at line 944
void
setLanguage(string $language)
Sets the section's language.
in Plex_Server_Library_SectionAbstract at line 956
string
getUuid()
Returns the section's universally unique identifier.
in Plex_Server_Library_SectionAbstract at line 970
void
setUuid(string $uuid)
Sets the section's universally unique identifier.
in Plex_Server_Library_SectionAbstract at line 982
DateTime
getUpdatedAt()
Returns the time at which the section was last updated.
in Plex_Server_Library_SectionAbstract at line 997
void
setUpdatedAt(integer $updatedAtTs)
Sets the time at which the section was last updated.
in Plex_Server_Library_SectionAbstract at line 1010
DateTime
getCreatedAt()
Returns the time at which the section was created.
in Plex_Server_Library_SectionAbstract at line 1025
void
setCreatedAt(integer $createdAtTs)
Sets the time at which the section was last created.
in Plex_Server_Library_Section_FilmeTrait at line 55
array
getContentRatings()
Returns a list of content ratings for the section. We use makeCall directly here because we want to return just the raw array of content ratings and not do any post processing on it.
at line 79
Plex_Server_Library_Item_Movie[]
getAllMovies()
Returns all the movies for the given section.
at line 91
Plex_Server_Library_Item_Movie[]
getUnwatchedMovies()
Returns all the unwatched movies for the given section.
at line 103
Plex_Server_Library_Item_Movie[]
getRecentlyReleasedMovies()
Returns the recently released movies for the given section.
at line 115
Plex_Server_Library_Item_Movie[]
getRecentlyAddedMovies()
Returns the recently added movies for the given section.
at line 127
Plex_Server_Library_Item_Movie[]
getRecentlyViewedMovies()
Returns the recently viewed movies for the given section.
at line 139
Plex_Server_Library_Item_Movie[]
getOnDeckMovies()
Returns the on deck movies for the given section.
at line 155
Plex_Server_Library_Item_Movie[]
getMoviesByCollection(integer $collectionKey)
Returns all the movies contained in a given collection.
at line 171
Plex_Server_Library_Item_Movie[]
getMoviesByGenre(integer $genreKey)
Returns all the movies categorized under a given genre.
at line 186
Plex_Server_Library_Item_Movie[]
getMoviesByYear(integer $year)
Returns all the movies from a given four digit year.
at line 203
Plex_Server_Library_Item_Movies[]
getMoviesByDecade(integer $decade)
Returns all the movies from a given four digit decade.
at line 229
Plex_Server_Library_Item_Movie[]
getMoviesByDirector(integer $directorKey)
Returns all the movies categorized under a given director.
at line 255
Plex_Server_Library_Item_Movie[]
getMoviesByActor(integer $actorKey)
Returns all the movies categorized under a given actor.
at line 281
Plex_Server_Library_Item_Movie[]
getMoviesByContentRating(string $contentRating)
Returns all the movies categorized under a given content rating.
at line 307
Plex_Server_Library_Item_Movie[]
getMoviesByResolution(string $resolution)
Returns all the movies categorized under a given resolution.
at line 331
Plex_Server_Library_Item_Movie[]
getMoviesByFirstCharacter(string $character)
Returns all movies in the section whose titles start with the given character.
at line 348
array
getDirectors()
Returns a list of directors for the section. We use makeCall directly here, because we want to return just the raw array of directors and not do any post processing on it.
at line 369
array
getActors()
Returns a list of actors for the section. We use makeCall directly here because we want to return just the raw array of actors and not do any post processing on it.
at line 390
array
getResolutions()
Returns a list of resolutions for the section. We use makeCall directly here because we want to return just the raw array of resolutions and not do any post processing on it.
at line 412
Plex_Server_Library_Item_Movie[]
searchMovies(string $query)
Searches movie titles for the passed query and returns the movies that match.
at line 433
Plex_Server_Library_Item_Movie
getMovie(integer|string $polymorphicData)
Returns a single movie by its rating key, key, or exact title match.