Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

3 Movies

Jose Erick Carreon edited this page Apr 20, 2019 · 1 revision

How access to the Movies and its information?

Access to multiple Movies

You can access to multiples moves of different forms since those that unwatched, recently added, recently viewed, by year, by actor, etc; Of course, all this from the select section of type movie.

// First get a section of type movie.
$section = $server->getLibrary()->getSection('Movies');

// Get multiple movies form section.
$section->getAll();                // Get all movies.
$section->getUnwatched();          // Get all movies not unwatched.
$section->getRecentlyReleased();   // Get movies recently released.
$section->getRecentlyAdded();      // Get movies recently added.
$section->getRecentlyViewed();     // Get movies recently viewed.
$section->getOnDeck();             // Get movies that have not been seen in less than 16 weeks.
$section->getByYear(1983);         // Get movies released in 1993.
$section->getByDecade(1980);       // Get movies released in 80's. 
$section->getByContentRating('R'); // Get movies by 'R' content rating.
$section->getByResolution('1080'); // Get movies of 1080 pixels.
$section->getByGenre(1252);        // Get movies by genre key (id).
$section->getByDirector(357);      // Get movies by director key (id).
$section->getByActor(3903);        // Get movies by actor key (id).
$section->getByCollection(13206);  // Get movies by collection key (id).
$movies = $section->getByFirstCharacter('Q'); // Get movies that start with the letter 'Q'.

foreach($movies as $movie){
	echo $movie->getTitle();
}

// You can also get movies use the plex search engine. 
$section->search('fly'); // Get movies by search.

Access to one Movie

For get a movie in specific there is 3 forms:

// First get a section of type movie.
$section = $server->getLibrary()->getSection('Movies');

// Get a movie from section.
$section->get(83696); // Get movie by key (id).
$section->get('Pulp Fiction'); // Get movie by exact title.
$section->get('/library/metadata/83696'); // Get movie by API URL

Access to Movie information

List all functions for access of the data of a movie, more information here.

// First get a movie.
$movie = $server->getLibrary()->getSection('Movies')->get('Pulp Fiction');

$movie->getTitle();         // Get title of the movie.
$movie->getTitleSort();     // Get title sort, usually is the same title.
$movie->getYear();          // Get release year.
$movie->getKey();           // Get unique key (id).
$movie->getType();          // Get type.
$movie->getSummary();       // Get summary of the movie.
$movie->getIndex();         // Get position intro the section.
$movie->getThumb();         // Get url of the thumnail image
$movie->getArt();           // Get the url of the background image.
$movie->getDuration();      // Get duretion in secons.
$movie->getStudio();        // Get studio or company that created the movie.
$movie->getAddedAt();       // Get date on which it was added to the section.
$movie->getUpdatedAt();     // Get date on which it was modified.
$movie->getViewCount();     // Get number of times you've seen the movie.
$movie->getContentRating(); // Get content rating like 'R', 'PG-13', etc.
$movie->getTagline();
$movie->getRating();
$movie->getViewOffset();
$movie->getLeafCount();
$movie->getViewedLeafCount();

// This functions return tag object.
$movie->getDirector(); // Get director.
$movie->getWriter();   // Get writer.
$movie->getProducer(); // Get producer.
$county = $movie->getCountry(); // Get country.
// For access to data 
$country->getName();

// this functions return tags object inside a array.
$movie->getRoles(); // Get a array of roles.
$genres = $movie->getGenres(); // Get a array of genres.
foreach ($genres as $genre){
	echo $genre->getName();
}