mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 17:58:59 +00:00
Update searchId function in TraktAPI
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2015-10-30 DariusIII
|
||||
Upd: searchId function in TraktAPI
|
||||
Upd: Change the ordering of TV processing
|
||||
2015-10-29 DariusIII
|
||||
Fix: Fix the firstaired request
|
||||
|
||||
@@ -226,21 +226,34 @@ HEADERS;
|
||||
* Search for entry using on of the supported site IDs.
|
||||
*
|
||||
* @param integer $id The ID to look for.
|
||||
* @param string $type Site whose ID should be searched for.
|
||||
* @param string $site One of the supported sites ('imdb', 'tmdb', 'trakt', 'tvdb', 'tvrage')
|
||||
* @param string $type videos.type flag (-1 for episodes).
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function searchId($id, $type = 'trakt')
|
||||
public function searchId($id, $site = 'trakt', $type = 0)
|
||||
{
|
||||
if (!in_array($type, $this->types) || !ctype_digit($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($type == 'imdb') {
|
||||
if (!in_array($site, $this->types) || !ctype_digit($id)) {
|
||||
return null;
|
||||
} else if ($site == 'imdb') {
|
||||
$id = 'tt' . $id;
|
||||
}
|
||||
|
||||
switch (true) {
|
||||
case $site == 'trakt' && ($type == 0 || $type == 2):
|
||||
$type = $site . '-show';
|
||||
break;
|
||||
case $site == 'trakt' && $type == 1:
|
||||
$type = $site . '-movie';
|
||||
break;
|
||||
case $site == 'trakt' && $type == -1:
|
||||
$type = $site . '-episode';
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
$url = self::API_URL . "search?id_type=$type&id=$id";
|
||||
|
||||
return $this->getJsonArray($url, '');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user