|
@@ -177,7 +177,7 @@ if (function_exists('curl_version')) :
|
|
|
function plugin_auth_plex($username, $password) {
|
|
function plugin_auth_plex($username, $password) {
|
|
|
// Quick out
|
|
// Quick out
|
|
|
if ((strtolower(PLEXUSERNAME) == strtolower($username)) && $password == PLEXPASSWORD) {
|
|
if ((strtolower(PLEXUSERNAME) == strtolower($username)) && $password == PLEXPASSWORD) {
|
|
|
- writeLog("success", $username." authenticated by plex");
|
|
|
|
|
|
|
+ writeLog("success", $username." authenticated by plex");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -194,7 +194,7 @@ if (function_exists('curl_version')) :
|
|
|
foreach($userXML AS $child) {
|
|
foreach($userXML AS $child) {
|
|
|
if(isset($child['username']) && strtolower($child['username']) == $usernameLower) {
|
|
if(isset($child['username']) && strtolower($child['username']) == $usernameLower) {
|
|
|
$isUser = true;
|
|
$isUser = true;
|
|
|
- writeLog("success", $usernameLower." was found in plex friends list");
|
|
|
|
|
|
|
+ writeLog("success", $usernameLower." was found in plex friends list");
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -217,16 +217,19 @@ if (function_exists('curl_version')) :
|
|
|
if (isset($result['content'])) {
|
|
if (isset($result['content'])) {
|
|
|
$json = json_decode($result['content'], true);
|
|
$json = json_decode($result['content'], true);
|
|
|
if (is_array($json) && isset($json['user']) && isset($json['user']['username']) && strtolower($json['user']['username']) == $usernameLower) {
|
|
if (is_array($json) && isset($json['user']) && isset($json['user']['username']) && strtolower($json['user']['username']) == $usernameLower) {
|
|
|
- writeLog("success", $json['user']['username']." was logged into plex and pulled credentials");
|
|
|
|
|
|
|
+ writeLog("success", $json['user']['username']." was logged into organizr using plex credentials");
|
|
|
return array(
|
|
return array(
|
|
|
'email' => $json['user']['email'],
|
|
'email' => $json['user']['email'],
|
|
|
'image' => $json['user']['thumb']
|
|
'image' => $json['user']['thumb']
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }else{
|
|
|
|
|
+ writeLog("error", "$username is not an authorized user or entered invalid password");
|
|
|
}
|
|
}
|
|
|
|
|
+ }else{
|
|
|
|
|
+ writeLog("error", "error occured logging into plex might want to check curl.cainfo=/path/to/downloaded/cacert.pem in php.ini");
|
|
|
}
|
|
}
|
|
|
- writeLog("error", "error occured logging into plex might want to check curl.cainfo=/path/to/downloaded/cacert.pem in php.ini");
|
|
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
else :
|
|
else :
|
|
@@ -3013,7 +3016,7 @@ function searchPlex($query){
|
|
|
// Perform API requests
|
|
// Perform API requests
|
|
|
$api = @curl_get($address."/search?query=".rawurlencode($query)."&X-Plex-Token=".PLEXTOKEN);
|
|
$api = @curl_get($address."/search?query=".rawurlencode($query)."&X-Plex-Token=".PLEXTOKEN);
|
|
|
$api = simplexml_load_string($api);
|
|
$api = simplexml_load_string($api);
|
|
|
- $pre = "<table class=\"table table-hover table-stripped\"><thead><tr><th>Cover</th><th>Title</th><th>Genre</th><th>Year</th><th>Type</th><th>Added</th></tr></thead><tbody>";
|
|
|
|
|
|
|
+ $pre = "<table class=\"table table-hover table-stripped\"><thead><tr><th>Cover</th><th>Title</th><th>Genre</th><th>Year</th><th>Type</th><th>Added</th><th>Extra Info</th></tr></thead><tbody>";
|
|
|
$items = "";
|
|
$items = "";
|
|
|
$albums = $movies = $shows = 0;
|
|
$albums = $movies = $shows = 0;
|
|
|
|
|
|
|
@@ -3030,6 +3033,7 @@ function searchPlex($query){
|
|
|
"key" => (string)$child['key'],
|
|
"key" => (string)$child['key'],
|
|
|
"genre" => (string)$child->Genre['tag'],
|
|
"genre" => (string)$child->Genre['tag'],
|
|
|
"added" => $time->format('Y-m-d'),
|
|
"added" => $time->format('Y-m-d'),
|
|
|
|
|
+ "extra" => "",
|
|
|
);
|
|
);
|
|
|
switch ($child['type']){
|
|
switch ($child['type']){
|
|
|
case "album":
|
|
case "album":
|
|
@@ -3040,19 +3044,28 @@ function searchPlex($query){
|
|
|
$albums++;
|
|
$albums++;
|
|
|
break;
|
|
break;
|
|
|
case "movie":
|
|
case "movie":
|
|
|
|
|
+ $push = array(
|
|
|
|
|
+ "extra" => "Content Rating: ".(string)$child['contentRating']."<br/>Movie Rating: ".(string)$child['rating'],
|
|
|
|
|
+ );
|
|
|
|
|
+ $results = array_replace($results,$push);
|
|
|
$movies++;
|
|
$movies++;
|
|
|
break;
|
|
break;
|
|
|
case "show":
|
|
case "show":
|
|
|
|
|
+ $push = array(
|
|
|
|
|
+ "extra" => "Seasons: ".(string)$child['childCount']."<br/>Episodes: ".(string)$child['leafCount'],
|
|
|
|
|
+ );
|
|
|
|
|
+ $results = array_replace($results,$push);
|
|
|
$shows++;
|
|
$shows++;
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
$items .= '<tr>
|
|
$items .= '<tr>
|
|
|
<th scope="row"><img src="ajax.php?a=plex-image&img='.$results['image'].'&height=100&width=50&key='.$results['key'].'"></th>
|
|
<th scope="row"><img src="ajax.php?a=plex-image&img='.$results['image'].'&height=100&width=50&key='.$results['key'].'"></th>
|
|
|
- <td class="col-xs-3 nzbtable nzbtable-row"'.$style.'>'.$results['title'].'</td>
|
|
|
|
|
- <td class="col-xs-4 nzbtable nzbtable-row"'.$style.'>'.$results['genre'].'</td>
|
|
|
|
|
|
|
+ <td class="col-xs-2 nzbtable nzbtable-row"'.$style.'>'.$results['title'].'</td>
|
|
|
|
|
+ <td class="col-xs-3 nzbtable nzbtable-row"'.$style.'>'.$results['genre'].'</td>
|
|
|
<td class="col-xs-1 nzbtable nzbtable-row"'.$style.'>'.$results['year'].'</td>
|
|
<td class="col-xs-1 nzbtable nzbtable-row"'.$style.'>'.$results['year'].'</td>
|
|
|
<td class="col-xs-1 nzbtable nzbtable-row"'.$style.'>'.$results['type'].'</td>
|
|
<td class="col-xs-1 nzbtable nzbtable-row"'.$style.'>'.$results['type'].'</td>
|
|
|
<td class="col-xs-3 nzbtable nzbtable-row"'.$style.'>'.$results['added'].'</td>
|
|
<td class="col-xs-3 nzbtable nzbtable-row"'.$style.'>'.$results['added'].'</td>
|
|
|
|
|
+ <td class="col-xs-2 nzbtable nzbtable-row"'.$style.'>'.$results['extra'].'</td>
|
|
|
</tr>';
|
|
</tr>';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|