diff --git a/Changelog b/Changelog index 4a056bef0..dcd631007 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2015-11-12 DariusIII + uPD: Update TV episodes parsing Fix: Fix Typo for TMDB in series view Upd: TV processing. Parse TV show properly, update Trakt support 2015-11-10 DariusIII diff --git a/misc/testing/DB/reset_postprocessing.php b/misc/testing/DB/reset_postprocessing.php index e8adb352c..525f2251d 100755 --- a/misc/testing/DB/reset_postprocessing.php +++ b/misc/testing/DB/reset_postprocessing.php @@ -23,6 +23,12 @@ if (isset($argv[1]) && $argv[1] === "all") { $pdo->queryExec("TRUNCATE TABLE releasenfo"); $pdo->queryExec("TRUNCATE TABLE releaseextrafull"); $pdo->queryExec("TRUNCATE TABLE xxxinfo"); + $pdo->queryExec("TRUNCATE TABLE videos"); + $pdo->queryExec("TRUNCATE TABLE videos_akas"); + $pdo->queryExec("TRUNCATE TABLE tv_info"); + $pdo->queryExec("TRUNCATE TABLE tv_episodes"); + $pdo->queryExec("TRUNCATE TABLE anidb_info"); + $pdo->queryExec("TRUNCATE TABLE anidb_episodes"); } echo $pdo->log->header("Resetting all postprocessing"); $qry = $pdo->queryDirect("SELECT id FROM releases"); @@ -182,7 +188,7 @@ if (isset($argv[1]) && ($argv[1] === "misc" || $argv[1] === "all")) { if (isset($argv[1]) && ($argv[1] === "tv" || $argv[1] === "all")) { $ran = true; if (isset($argv[3]) && $argv[3] === "truncate") { - $pdo->queryExec("DELETE FROM videos WHERE type = 0"); + $pdo->queryExec("DELETE v, va FROM videos v INNER JOIN videos_akas va ON v.id = va.videos_id WHERE type = 0"); $pdo->queryExec("TRUNCATE TABLE tv_info"); $pdo->queryExec("TRUNCATE TABLE tv_episodes"); } diff --git a/newznab/libraries/TraktAPI.php b/newznab/libraries/TraktAPI.php index 8ea8a2cbe..b349f6250 100644 --- a/newznab/libraries/TraktAPI.php +++ b/newznab/libraries/TraktAPI.php @@ -19,8 +19,6 @@ Class TraktAPI { */ private $clientId; - private $clientPin = 53246463; - /** * List of headers to send to Trakt.tv when making a request. * @@ -168,6 +166,7 @@ HEADERS; 'requestheaders' => $this->requestHeaders ] ); + var_dump($json); if ($json !== false) { $json = json_decode($json, true); @@ -317,11 +316,15 @@ HEADERS; /** * Generate and return a slug for a given ``$phrase``. + * + * @param string $phrase + * + * @return mixed */ public function slugify($phrase) { - $result = preg_replace('#[^a-z0-9\s-]#', '', strtolower($phrase)); - $result = preg_replace('#\s#', '-', trim(preg_replace('#[\s-]+#', ' ', $result))); + $result = preg_replace('#[^a-z0-9\s-]#', '-', strtolower($phrase)); + $result = preg_replace('#\s#', '-', trim(preg_replace('#[\s-]+#', '-', $result))); return $result; } diff --git a/newznab/processing/tv/TMDB.php b/newznab/processing/tv/TMDB.php index e60212e94..df9ad8f3b 100644 --- a/newznab/processing/tv/TMDB.php +++ b/newznab/processing/tv/TMDB.php @@ -67,7 +67,7 @@ class TMDB extends TV $tvcount = $res->rowCount(); - if ($this->echooutput && $tvcount > 1) { + if ($this->echooutput && $tvcount > 0) { echo $this->pdo->log->header("Processing TMDB lookup for " . number_format($tvcount) . " release(s)."); } @@ -233,7 +233,7 @@ class TMDB extends TV foreach ($showAppends->_data['alternative_titles']['results'] AS $aka) { $highest->_data['alternative_titles'][] = $aka['title']; } - $highest->_data['network'] = $showAppends->_data['networks'][0]['name']; + $highest->_data['network'] = (isset($showAppends->_data['networks'][0]['name']) ? $showAppends->_data['networks'][0]['name'] : ''); $highest->_data['external_ids'] = $showAppends->_data['external_ids']; } $return = $this->formatShowArr($highest); diff --git a/newznab/processing/tv/TV.php b/newznab/processing/tv/TV.php index c25a510b1..fe07624b8 100644 --- a/newznab/processing/tv/TV.php +++ b/newznab/processing/tv/TV.php @@ -482,7 +482,7 @@ abstract class TV extends Videos // Get the Season/Episode/Airdate $showInfo += $this->parseShowSeasonEp($relname); - if ((!empty($showInfo['season']) && !empty($showInfo['episode'])) || !empty($showInfo['airdate'])) { + if ((isset($showInfo['season']) && isset($showInfo['episode'])) || !empty($showInfo['airdate'])) { // Check for dates instead of seasons. if (!isset($showInfo['airdate']) && !empty($showInfo['airdate'])) { // If year is present in the release name, add it to the cleaned name for title search @@ -518,7 +518,7 @@ abstract class TV extends Videos $following = '[^a-z0-9](\d\d-\d\d|\d{1,3}x\d{2,3}|\(?(19|20)\d{2}\)?|(480|720|1080)[ip]|AAC2?|BD-?Rip|Blu-?Ray|D0?\d' . '|DD5|DiVX|DLMux|DTS|DVD(-?Rip)?|E\d{2,3}|[HX][-_. ]?26[45]|ITA(-ENG)?|HEVC|[HPS]DTV|PROPER|REPACK|Season|Episode|' . - 'S\d+[^a-z0-9]?(E\d+)?[ab]?|WEB[-_. ]?(DL|Rip)|XViD)[^a-z0-9]'; + 'S\d+[^a-z0-9]?((E\d+)[ab]?)*|WEB[-_. ]?(DL|Rip)|XViD)[^a-z0-9]'; // For names that don't start with the title. if (preg_match('/([^a-z0-9]{2,}|(sample|proof)-)(?P[\w .-]*?)' . $following . '/i', $relname, $matches)) { diff --git a/newznab/processing/tv/TVDB.php b/newznab/processing/tv/TVDB.php index 4df1e79b2..69826e1c5 100644 --- a/newznab/processing/tv/TVDB.php +++ b/newznab/processing/tv/TVDB.php @@ -74,7 +74,7 @@ class TVDB extends TV $tvcount = $res->rowCount(); - if ($this->echooutput && $tvcount > 1) { + if ($this->echooutput && $tvcount > 0) { echo $this->pdo->log->header("Processing TVDB lookup for " . number_format($tvcount) . " release(s)."); } diff --git a/newznab/processing/tv/TVMaze.php b/newznab/processing/tv/TVMaze.php index cc1b62e37..b05b2e879 100644 --- a/newznab/processing/tv/TVMaze.php +++ b/newznab/processing/tv/TVMaze.php @@ -66,7 +66,7 @@ class TVMaze extends TV $tvcount = $res->rowCount(); - if ($this->echooutput && $tvcount > 1) { + if ($this->echooutput && $tvcount > 0) { echo $this->pdo->log->header("Processing TVMaze lookup for " . number_format($tvcount) . " release(s)."); }