PHP code example of pxgamer / plex-picker
1. Go to this page and download the library: Download pxgamer/plex-picker library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pxgamer / plex-picker example snippets
use \pxgamer\PlexPicker\Picker;
// Create a new Picker class
$client = new Picker();
// Create the data object
$data = [
'unwatched' => 1, // You can search by watched/unwatched videos
'actor' => 1, // You can search by actor ID
'duplicate' => 1, // You can check for duplicates
'year' => 2017, // You can search by year
];
// In fact, you can use any of the filters.
// Initialise the base URL of your server
$client->_setBaseUrl('https://demo.plex.local:32400');
// Set your token (will soon have a login function to get a token)
$client->setToken('5KaVLQiL531414faD7PfZ3');
// Set the data (using an array)
$client->setData($data);
// Get the list of videos from the server
$client->_get();
// Select the video
$client->chooseVideo();
echo 'Chosen Film: '. $client->videoData['title'] . ' (' . $client->videoData['year'] . ')';