This repository has been archived by the owner on Jun 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
2 Library and Sections
Jose Erick Carreon edited this page Apr 20, 2019
·
2 revisions
The function 'getLibrary' gives us access movies or shows recently added or that are on deck of plex.
// First get library instantiate.
$library = $plex->getServer('my_server')->getLibrary();
$library->getOnDeckItems(); // Get movies or shows that is on deck
$library->getRecentlyAddedItems(); // Get movies or shows recently added
Before continuing, you need to know that the sections are those that is in the panel de plex website, for example:
Having said that, we have 3 functions for the sections:
// Get section of your library.
$sections = $library->getSections(); // Get all Sections.
foreach ($sections as $section){
echo $sections->getTitle();
}
$library->getSection(1); // Get section by index.
$library->getSection('TV Shows'); // Get section by name.
The sections have multiples data like genres, directors, actors and collections.
// Get a section instantiate
$section = $plex->getServer('my_server')->getLibrary()->getSection('Movies');
// Get section tags.
$genres = $section->getGenres(); // Get all genres of the section.
foreach ($genres as $genre){
echo $genre->title;
}
$section->getDirectors(); // Get all directors of the section.
$section->getActors(); // Get all actors of the section.
$section->getCollections(); // Get all collections of the section.
Note: The collections let you gather related movies, For example, you might add all the James Bond movies together in a “Bond” collection, more information here