mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 17:58:59 +00:00
Merge branch 'dev-regexless-tv' into dev-regexless-tmdb
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2015-10-31 DariusIII
|
||||
Upd: Add all sources that are avalable to series view
|
||||
Upd: Add first batch of changes for akas processing
|
||||
2015-10-30 DariusIII
|
||||
Fix: ApiIO errors.
|
||||
Fix: Some of the problems created by moving TVMaze up in processing
|
||||
|
||||
@@ -33,6 +33,7 @@ abstract class Videos
|
||||
const TYPE_TV = 0; // Type of video is a TV Programme/Show
|
||||
const TYPE_FILM = 1; // Type of video is a Film/Movie
|
||||
const TYPE_ANIME = 2; // Type of video is a Anime
|
||||
|
||||
/**
|
||||
* @var \newznab\db\Settings
|
||||
*/
|
||||
@@ -94,4 +95,266 @@ abstract class Videos
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt a local lookup via the title first by exact match and then by like.
|
||||
* Returns a false for no match or the Video ID of the match.
|
||||
*
|
||||
* @param $title
|
||||
* @param $type
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getByTitle($title, $type)
|
||||
{
|
||||
// Check if we already have an entry for this show.
|
||||
$res = $this->getByTitleQuery($title, $type);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
|
||||
$title2 = str_replace(' and ', ' & ', $title);
|
||||
if ($title != $title2) {
|
||||
$res = $this->getByTitleQuery($title2, $type);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
$pieces = explode(' ', $title2);
|
||||
$title4 = '%';
|
||||
foreach ($pieces as $piece) {
|
||||
$title4 .= str_replace(["'", "!"], "", $piece) . '%';
|
||||
}
|
||||
$res = $this->getByTitleLikeQuery($title4, $type);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Some words are spelled correctly 2 ways
|
||||
// example theatre and theater
|
||||
$title3 = str_replace('er', 're', $title);
|
||||
if ($title != $title3) {
|
||||
$res = $this->getByTitleQuery($title3, $type);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
$pieces = explode(' ', $title3);
|
||||
$title4 = '%';
|
||||
foreach ($pieces as $piece) {
|
||||
$title4 .= str_replace(["'", "!"], "", $piece) . '%';
|
||||
}
|
||||
$res = $this->getByTitleLikeQuery($title4, $type);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// If there was not an exact title match, look for title with missing chars
|
||||
// example release name :Zorro 1990, tvrage name Zorro (1990)
|
||||
// Only search if the title contains more than one word to prevent incorrect matches
|
||||
$pieces = explode(' ', $title);
|
||||
if (count($pieces) > 1) {
|
||||
$title4 = '%';
|
||||
foreach ($pieces as $piece) {
|
||||
$title4 .= str_replace(["'", "!"], "", $piece) . '%';
|
||||
}
|
||||
$res = $this->getByTitleLikeQuery($title4, $type);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplementary function for getByTitle that queries for exact match
|
||||
*
|
||||
* @param $title
|
||||
* @param $type
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getByTitleQuery($title, $type)
|
||||
{
|
||||
$return = false;
|
||||
if ($title) {
|
||||
$return = $this->pdo->queryOneRow(
|
||||
sprintf("
|
||||
SELECT v.id
|
||||
FROM videos v
|
||||
LEFT JOIN videos_akas va ON v.id = va.videos_id
|
||||
WHERE (v.title = %1\$s OR va.title = %1\$s)
|
||||
AND v.type = %d",
|
||||
$this->pdo->escapeString($title),
|
||||
$type
|
||||
)
|
||||
);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplementary function for getByTitle that queries for a like match
|
||||
*
|
||||
* @param $title
|
||||
* @param $type
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getByTitleLikeQuery($title, $type)
|
||||
{
|
||||
$return = false;
|
||||
$string = '"\'"';
|
||||
if ($title) {
|
||||
$return = $this->pdo->queryOneRow(
|
||||
sprintf("
|
||||
SELECT id
|
||||
FROM videos
|
||||
WHERE REPLACE(REPLACE(title, %s, ''), '!', '') %s
|
||||
AND type = %d",
|
||||
$string,
|
||||
$this->pdo->likeString(rtrim($title, '%'), false, false),
|
||||
$type
|
||||
)
|
||||
);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts aliases for videos
|
||||
*
|
||||
* @param $videoId
|
||||
* @param array $aliasArr
|
||||
*/
|
||||
public function addAliases($videoId, $aliasArr = array())
|
||||
{
|
||||
if (is_array($aliasArr) && $videoId > 0) {
|
||||
foreach ($aliasArr AS $alias) {
|
||||
// Check if we have the AKA already
|
||||
$check = $this->getAliases(0, $alias);
|
||||
|
||||
if ($check === false) {
|
||||
$this->pdo->queryInsert(
|
||||
sprintf('
|
||||
INSERT IGNORE INTO videos_akas
|
||||
(videos_id, title)
|
||||
VALUES (%d, %s)',
|
||||
$videoId,
|
||||
$this->pdo->escapeString($alias)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all aliases for given VideoID or VideoID for a given alias
|
||||
*
|
||||
* @param int $videoId
|
||||
* @param string $alias
|
||||
*
|
||||
* @return bool|\PDOStatement
|
||||
*/
|
||||
public function getAliases($videoId = 0, $alias = '')
|
||||
{
|
||||
$return = false;
|
||||
$sql = '';
|
||||
|
||||
if ($videoId > 0) {
|
||||
$sql = 'videos_id = ' . $videoId;
|
||||
} elseif ($alias !== '') {
|
||||
$sql = 'title = ' . $this->pdo->escapeString($alias);
|
||||
}
|
||||
|
||||
if ($sql !== '') {
|
||||
$return = $this->pdo->queryDirect('
|
||||
SELECT *
|
||||
FROM videos_akas
|
||||
WHERE ' . $sql
|
||||
);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function turns a roman numeral into an integer
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return int $e
|
||||
*/
|
||||
public function convertRomanToInt($string) {
|
||||
switch ($string) {
|
||||
case 'i': $e = 1;
|
||||
break;
|
||||
case 'ii': $e = 2;
|
||||
break;
|
||||
case 'iii': $e = 3;
|
||||
break;
|
||||
case 'iv': $e = 4;
|
||||
break;
|
||||
case 'v': $e = 5;
|
||||
break;
|
||||
case 'vi': $e = 6;
|
||||
break;
|
||||
case 'vii': $e = 7;
|
||||
break;
|
||||
case 'viii': $e = 8;
|
||||
break;
|
||||
case 'ix': $e = 9;
|
||||
break;
|
||||
case 'x': $e = 10;
|
||||
break;
|
||||
case 'xi': $e = 11;
|
||||
break;
|
||||
case 'xii': $e = 12;
|
||||
break;
|
||||
case 'xiii': $e = 13;
|
||||
break;
|
||||
case 'xiv': $e = 14;
|
||||
break;
|
||||
case 'xv': $e = 15;
|
||||
break;
|
||||
case 'xvi': $e = 16;
|
||||
break;
|
||||
case 'xvii': $e = 17;
|
||||
break;
|
||||
case 'xviii': $e = 18;
|
||||
break;
|
||||
case 'xix': $e = 19;
|
||||
break;
|
||||
case 'xx': $e = 20;
|
||||
break;
|
||||
default:
|
||||
$e = 0;
|
||||
}
|
||||
return $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a country code for a country name.
|
||||
*
|
||||
* @param string $country
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function countryCode($country)
|
||||
{
|
||||
if (!is_array($country) && strlen($country) > 2) {
|
||||
$code = $this->pdo->queryOneRow(
|
||||
sprintf('
|
||||
SELECT id
|
||||
FROM countries
|
||||
WHERE country = %s',
|
||||
$this->pdo->escapeString($country)
|
||||
)
|
||||
);
|
||||
if (isset($code['id'])) {
|
||||
return $code['id'];
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
+11
-204
@@ -222,15 +222,17 @@ abstract class TV extends Videos
|
||||
}
|
||||
|
||||
if ($videoId === false) {
|
||||
$videoId = $this->getByTitleQuery($showArr['title']);
|
||||
$videoId = $this->getByTitleQuery($showArr['title'], $showArr['type']);
|
||||
}
|
||||
|
||||
if ($videoId === false) {
|
||||
// Insert the Show
|
||||
$videoId = $this->pdo->queryInsert(
|
||||
sprintf('
|
||||
INSERT INTO videos
|
||||
(type, title, countries_id, started, source, tvdb, trakt, tvrage, tvmaze, imdb, tmdb)
|
||||
VALUES (0, %s, %s, %s, %d, %d, %d, %d, %d, %d, %d)',
|
||||
VALUES (%d, %s, %s, %s, %d, %d, %d, %d, %d, %d, %d)',
|
||||
$showArr['type'],
|
||||
$this->pdo->escapeString($showArr['title']),
|
||||
$this->pdo->escapeString((isset($showArr['country']) ? $showArr['country'] : '')),
|
||||
$this->pdo->escapeString($showArr['started']),
|
||||
@@ -243,6 +245,7 @@ abstract class TV extends Videos
|
||||
$showArr['tmdb']
|
||||
)
|
||||
);
|
||||
// Insert the supplementary show info
|
||||
$this->pdo->queryInsert(
|
||||
sprintf("
|
||||
INSERT INTO tv_info (videos_id, summary, publisher)
|
||||
@@ -252,7 +255,12 @@ abstract class TV extends Videos
|
||||
$this->pdo->escapeString($showArr['publisher'])
|
||||
)
|
||||
);
|
||||
// If we have AKAs\aliases, insert those as well
|
||||
if (is_array($showArr['aliases'])) {
|
||||
$this->addAliases($videoId, $showArr['aliases']);
|
||||
}
|
||||
} else {
|
||||
// If a local match was found, just update missing video info
|
||||
$this->update($videoId, $showArr);
|
||||
}
|
||||
return (int)$videoId;
|
||||
@@ -290,8 +298,6 @@ abstract class TV extends Videos
|
||||
return $episodeId;
|
||||
}
|
||||
|
||||
// If the video already exists, update the site specific column to collect its ID for that scrape
|
||||
|
||||
/**
|
||||
* Updates the show info with data from the supplied array
|
||||
* Only called when a duplicate show is found during insert
|
||||
@@ -345,6 +351,7 @@ abstract class TV extends Videos
|
||||
FROM videos v
|
||||
LEFT JOIN tv_info tvi ON v.id = tvi.videos_id
|
||||
LEFT JOIN tv_episodes tve ON v.id = tve.videos_id
|
||||
LEFT JOIN videos_akas va ON v.id = va.videos_id
|
||||
WHERE v.id = %d",
|
||||
$id
|
||||
)
|
||||
@@ -368,126 +375,6 @@ abstract class TV extends Videos
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt a local lookup via the title first by exact match and then by like.
|
||||
* Returns a false for no match or the Video ID of the match.
|
||||
*
|
||||
* @param $title
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getByTitle($title)
|
||||
{
|
||||
// Check if we already have an entry for this show.
|
||||
$res = $this->getByTitleQuery($title);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
|
||||
$title2 = str_replace(' and ', ' & ', $title);
|
||||
if ($title != $title2) {
|
||||
$res = $this->getByTitleQuery($title2);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
$pieces = explode(' ', $title2);
|
||||
$title4 = '%';
|
||||
foreach ($pieces as $piece) {
|
||||
$title4 .= str_replace(["'", "!"], "", $piece) . '%';
|
||||
}
|
||||
$res = $this->getByTitleLikeQuery($title4 . '%');
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Some words are spelled correctly 2 ways
|
||||
// example theatre and theater
|
||||
$title3 = str_replace('er', 're', $title);
|
||||
if ($title != $title3) {
|
||||
$res = $this->getByTitleQuery($title3);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
$pieces = explode(' ', $title3);
|
||||
$title4 = '%';
|
||||
foreach ($pieces as $piece) {
|
||||
$title4 .= str_replace(["'", "!"], "", $piece) . '%';
|
||||
}
|
||||
$res = $this->getByTitleLikeQuery($title4);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// If there was not an exact title match, look for title with missing chars
|
||||
// example release name :Zorro 1990, tvrage name Zorro (1990)
|
||||
// Only search if the title contains more than one word to prevent incorrect matches
|
||||
$pieces = explode(' ', $title);
|
||||
if (count($pieces) > 1) {
|
||||
$title4 = '%';
|
||||
foreach ($pieces as $piece) {
|
||||
$title4 .= str_replace(["'", "!"], "", $piece) . '%';
|
||||
}
|
||||
$res = $this->getByTitleLikeQuery($title4);
|
||||
if (isset($res['id'])) {
|
||||
return $res['id'];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplementary function for getByTitle that queries for exact match
|
||||
*
|
||||
*
|
||||
* @param $title
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getByTitleQuery($title)
|
||||
{
|
||||
$return = false;
|
||||
if ($title) {
|
||||
$return = $this->pdo->queryOneRow(
|
||||
sprintf("
|
||||
SELECT id
|
||||
FROM videos
|
||||
WHERE title = %s
|
||||
AND type = 0",
|
||||
$this->pdo->escapeString($title)
|
||||
)
|
||||
);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplementary function for getByTitle that queries for a like match
|
||||
*
|
||||
* @param $title
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getByTitleLikeQuery($title)
|
||||
{
|
||||
$return = false;
|
||||
$string = '"\'"';
|
||||
if ($title) {
|
||||
$return = $this->pdo->queryOneRow(
|
||||
sprintf("
|
||||
SELECT id
|
||||
FROM videos
|
||||
WHERE REPLACE(REPLACE(title, %s, ''), '!', '') %s
|
||||
AND type = 0",
|
||||
$string,
|
||||
$this->pdo->likeString(rtrim($title, '%'), false, false)
|
||||
)
|
||||
);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get site ID from a Video ID and the site's respective column.
|
||||
* Returns the ID value or false if none found
|
||||
@@ -547,31 +434,6 @@ abstract class TV extends Videos
|
||||
return (isset($episodeArr['id']) ? $episodeArr['id'] : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a country code for a country name.
|
||||
*
|
||||
* @param string $country
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function countryCode($country)
|
||||
{
|
||||
if (!is_array($country) && strlen($country) > 2) {
|
||||
$code = $this->pdo->queryOneRow(
|
||||
sprintf('
|
||||
SELECT id
|
||||
FROM countries
|
||||
WHERE country = %1\$s',
|
||||
$this->pdo->escapeString($country)
|
||||
)
|
||||
);
|
||||
if (isset($code['id'])) {
|
||||
return $code['id'];
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns (true) if episodes for a given Video ID exist or don't (false)
|
||||
*
|
||||
@@ -783,61 +645,6 @@ abstract class TV extends Videos
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function turns a roman numeral into an integer
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return int $e
|
||||
*/
|
||||
private function convertRomanToInt($string) {
|
||||
switch ($string) {
|
||||
case 'i': $e = 1;
|
||||
break;
|
||||
case 'ii': $e = 2;
|
||||
break;
|
||||
case 'iii': $e = 3;
|
||||
break;
|
||||
case 'iv': $e = 4;
|
||||
break;
|
||||
case 'v': $e = 5;
|
||||
break;
|
||||
case 'vi': $e = 6;
|
||||
break;
|
||||
case 'vii': $e = 7;
|
||||
break;
|
||||
case 'viii': $e = 8;
|
||||
break;
|
||||
case 'ix': $e = 9;
|
||||
break;
|
||||
case 'x': $e = 10;
|
||||
break;
|
||||
case 'xi': $e = 11;
|
||||
break;
|
||||
case 'xii': $e = 12;
|
||||
break;
|
||||
case 'xiii': $e = 13;
|
||||
break;
|
||||
case 'xiv': $e = 14;
|
||||
break;
|
||||
case 'xv': $e = 15;
|
||||
break;
|
||||
case 'xvi': $e = 16;
|
||||
break;
|
||||
case 'xvii': $e = 17;
|
||||
break;
|
||||
case 'xviii': $e = 18;
|
||||
break;
|
||||
case 'xix': $e = 19;
|
||||
break;
|
||||
case 'xx': $e = 20;
|
||||
break;
|
||||
default:
|
||||
$e = 0;
|
||||
}
|
||||
return $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple function that compares two strings of text
|
||||
* Returns percentage of similarity
|
||||
|
||||
@@ -87,7 +87,7 @@ class TVDB extends TV
|
||||
if (is_array($release) && $release['name'] != '') {
|
||||
|
||||
// Find the Video ID if it already exists by checking the title.
|
||||
$videoId = $this->getByTitle($release['cleanname']);
|
||||
$videoId = $this->getByTitle($release['cleanname'], parent::TYPE_TV);
|
||||
|
||||
if ($videoId !== false) {
|
||||
$tvdbid = $this->getSiteByID('tvdb', $videoId);
|
||||
@@ -348,6 +348,7 @@ class TVDB extends TV
|
||||
preg_match('/tt(?P<imdbid>\d{6,7})$/i', $show->imdbId, $imdb);
|
||||
|
||||
return [
|
||||
'type' => (int)parent::TYPE_TV,
|
||||
'title' => (string)$show->name,
|
||||
'summary' => (string)$show->overview,
|
||||
'started' => (string)$show->firstAired->format($this->timeFormat),
|
||||
@@ -358,7 +359,8 @@ class TVDB extends TV
|
||||
'trakt' => 0,
|
||||
'tvrage' => 0,
|
||||
'tvmaze' => 0,
|
||||
'tmdb' => 0
|
||||
'tmdb' => 0,
|
||||
'aliases' => (is_array($show->aliasNames) ? $show->aliasNames : '')
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class TVMaze extends TV
|
||||
if (is_array($release) && $release['name'] != '') {
|
||||
|
||||
// Find the Video ID if it already exists by checking the title.
|
||||
$videoId = $this->getByTitle($release['cleanname']);
|
||||
$videoId = $this->getByTitle($release['cleanname'], parent::TYPE_TV);
|
||||
|
||||
if ($videoId !== false) {
|
||||
$tvmazeid = $this->getSiteByID('tvmaze', $videoId);
|
||||
@@ -347,6 +347,7 @@ class TVMaze extends TV
|
||||
$this->posterUrl = (string)(isset($show->mediumImage) ? $show->mediumImage : '');
|
||||
|
||||
return [
|
||||
'type' => (int)parent::TYPE_TV,
|
||||
'title' => (string)$show->name,
|
||||
'summary' => (string)$show->summary,
|
||||
'started' => (string)$show->premiered,
|
||||
@@ -358,7 +359,8 @@ class TVMaze extends TV
|
||||
'tvmaze' => (int)$show->id,
|
||||
'trakt' => 0,
|
||||
'tvrage' => (int)(isset($show->externalIDs['tvrage']) ? $show->externalIDs['tvrage'] : 0),
|
||||
'tmdb' => 0
|
||||
'tmdb' => 0,
|
||||
'aliases' => (is_array($show->akas) ? $show->akas : '')
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class TvRage extends TV
|
||||
$show = $this->parseNameEpSeason($arr['searchname']);
|
||||
if (is_array($show) && $show['name'] != '') {
|
||||
// Find the Video ID if it already exists by checking the title.
|
||||
$this->videoId = $this->getByTitle($show['cleanname']);
|
||||
$this->videoId = $this->getByTitle($show['cleanname'], parent::TYPE_TV);
|
||||
|
||||
// Force local lookup only
|
||||
if ($local == true) {
|
||||
@@ -215,6 +215,7 @@ class TvRage extends TV
|
||||
}
|
||||
$this->videoId = $this->add(
|
||||
[
|
||||
'type' => parent::TYPE_TV,
|
||||
'title' => $tvrShow['title'],
|
||||
'column' => 'tvrage',
|
||||
'siteid' => $rageid,
|
||||
@@ -228,7 +229,8 @@ class TvRage extends TV
|
||||
'tvrageid' => $rageid,
|
||||
'tvmazeid' => 0,
|
||||
'imdbid' => 0,
|
||||
'tmdbid' => 0
|
||||
'tmdbid' => 0,
|
||||
'aliases' => $tvrShow['aliases']
|
||||
]
|
||||
);
|
||||
if (isset($rInfo['imgurl']) && !empty($rInfo['imgurl'])) {
|
||||
@@ -393,6 +395,7 @@ class TvRage extends TV
|
||||
// One aka.
|
||||
$matchPercent = $this->checkMatch($title, $show['akas']['aka'], self::MATCH_PROBABILITY);
|
||||
if ($matchPercent > $highestPercent) {
|
||||
$show['akas']['aka'][] = $show['akas']['aka'];
|
||||
$matchedTitle = $show;
|
||||
$highestPercent = $matchPercent;
|
||||
}
|
||||
@@ -419,6 +422,7 @@ class TvRage extends TV
|
||||
private function formatShowArr($show)
|
||||
{
|
||||
return [
|
||||
'type' => (int)parent::TYPE_TV,
|
||||
'title' => (string)$show['name'],
|
||||
'summary' => (string)'',
|
||||
'started' => (string)date('Y-m-d', strtotime($show['started'])),
|
||||
@@ -431,6 +435,7 @@ class TvRage extends TV
|
||||
'tvrage' => (int)$show['showid'],
|
||||
'tvmaze' => 0,
|
||||
'tmdb' => 0,
|
||||
'aliases' => (is_array($show['akas']['aka']) ? $show['akas']['aka'] : ''),
|
||||
'tvr' => $show
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# This patch creates the videos_akas table to store AKAs retrieved
|
||||
# from scrape sources. This will keep a record of them for local
|
||||
# lookup searches to speed up processing and prevent API hammering
|
||||
|
||||
DROP TABLE IF EXISTS videos_akas;
|
||||
CREATE TABLE videos_akas (
|
||||
videos_id MEDIUMINT(11) UNSIGNED NOT NULL COMMENT 'FK to videos.id of the parent title.',
|
||||
title VARCHAR(180) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'AKA of the video.',
|
||||
PRIMARY KEY (videos_id, title)
|
||||
)
|
||||
ENGINE = MyISAM
|
||||
DEFAULT CHARSET = utf8
|
||||
COLLATE = utf8_unicode_ci
|
||||
AUTO_INCREMENT = 100000;
|
||||
@@ -52,21 +52,29 @@
|
||||
<a class="label label-default" href="{$serverroot}series/{$release.videos_id}"
|
||||
title="View all releases for this series">View all episodes</a>
|
||||
{if $show.source == 1}
|
||||
{if $show.tvdb > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$show.tvdb}"
|
||||
title="View at TheTVDB">TheTVDB</a>
|
||||
{/if}
|
||||
{elseif $show.source == 2}
|
||||
{if $show.tvmaze > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://tvmaze.com/shows/{$show.tvmaze}"
|
||||
title="View at TVMaze">TVMaze</a>
|
||||
{/if}
|
||||
{elseif $show.source == 3}
|
||||
{if $show.trakt > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$show.trakt}"
|
||||
title="View at TraktTv">Trakt</a>
|
||||
{/if}
|
||||
{elseif $show.source == 6}
|
||||
{if $show.tvrage > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$show.tvrage}"
|
||||
title="View at TV Rage">TV Rage</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{if $con && $con.url != ""}<a href="{$site->dereferrer_link}{$con.url}/"
|
||||
|
||||
@@ -41,21 +41,29 @@
|
||||
<a class="btn btn-sm btn-default"
|
||||
href="{$smarty.const.WWW_TOP}/rss?show={$show.id}{if $category != ''}&t={$category}{/if}&dl=1&i={$userdata.id}&r={$userdata.rsstoken}">RSS for TV Show <i class="fa fa-rss"></i></a>
|
||||
{if $show.source == 1}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$show.tvdb}"
|
||||
title="View at TheTVDB">TheTVDB</a>
|
||||
{if $show.tvdb > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$show.tvdb}"
|
||||
title="View at TheTVDB">TheTVDB</a>
|
||||
{/if}
|
||||
{elseif $show.source == 2}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://tvmaze.com/shows/{$show.tvmaze}"
|
||||
title="View at TVMaze">TVMaze</a>
|
||||
{if $show.tvmaze > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://tvmaze.com/shows/{$show.tvmaze}"
|
||||
title="View at TVMaze">TVMaze</a>
|
||||
{/if}
|
||||
{elseif $show.source == 3}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$show.trakt}"
|
||||
title="View at TraktTv">Trakt</a>
|
||||
{if $show.trakt > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$show.trakt}"
|
||||
title="View at TraktTv">Trakt</a>
|
||||
{/if}
|
||||
{elseif $show.source == 6}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$show.tvrage}"
|
||||
title="View at TV Rage">TV Rage</a>
|
||||
{if $show.tvrage > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$show.tvrage}"
|
||||
title="View at TV Rage">TV Rage</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
@@ -59,13 +59,21 @@
|
||||
<a title="View series" href="{$smarty.const.WWW_TOP}/series/{$s.id}">Series</a><br />
|
||||
{if $s.id > 0}
|
||||
{if $s.source == 1}
|
||||
{if $show.tvdb > 0}
|
||||
<a title="View at TVDB" target="_blank" href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$s.tvdb}">TVDB</a>
|
||||
{/if}
|
||||
{elseif $s.source == 2}
|
||||
{if $show.tvmaze > 0}
|
||||
<a title="View at TVMaze" target="_blank" href="{$site->dereferrer_link}http://tvmaze.com/shows/{$s.tvmaze}">TVMaze</a>
|
||||
{/if}
|
||||
{elseif $s.source == 3}
|
||||
{if $show.trakt > 0}
|
||||
<a title="View at Trakt" target="_blank" href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$s.trakt}">Trakt</a>
|
||||
{/if}
|
||||
{elseif $s.source == 6}
|
||||
{if $show.tvrage > 0}
|
||||
<a title="View at TVRage" target="_blank" href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$s.tvrage}">TVRage</a>
|
||||
{/if}
|
||||
{/if}
|
||||
<a title="RSS Feed for {$s.title|escape:"htmlall"}" href="{$smarty.const.WWW_TOP}/rss?show={$s.id}&dl=1&i={$userdata.id}&r={$userdata.rsstoken}"><i class="fa fa-rss"></i></a>
|
||||
{/if}
|
||||
|
||||
@@ -52,21 +52,29 @@
|
||||
<a class="label label-default" href="{$serverroot}series/{$release.videos_id}"
|
||||
title="View all releases for this series">View all episodes</a>
|
||||
{if $show.source == 1}
|
||||
{if $show.tvdb > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$show.tvdb}"
|
||||
title="View at TheTVDB">TheTVDB</a>
|
||||
{/if}
|
||||
{elseif $show.source == 2}
|
||||
{if $show.tvmaze > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://tvmaze.com/shows/{$show.tvmaze}"
|
||||
title="View at TVMaze">TVMaze</a>
|
||||
{/if}
|
||||
{elseif $show.source == 3}
|
||||
{if $show.trakt > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$show.trakt}"
|
||||
title="View at TraktTv">Trakt</a>
|
||||
{/if}
|
||||
{elseif $show.source == 6}
|
||||
{if $show.tvrage > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$show.tvrage}"
|
||||
title="View at TV Rage">TV Rage</a>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{if $con && $con.url != ""}<a href="{$site->dereferrer_link}{$con.url}/"
|
||||
|
||||
@@ -41,21 +41,29 @@
|
||||
<a class="btn btn-sm btn-default"
|
||||
href="{$smarty.const.WWW_TOP}/rss?show={$show.id}{if $category != ''}&t={$category}{/if}&dl=1&i={$userdata.id}&r={$userdata.rsstoken}">RSS for TV Show <i class="fa fa-rss"></i></a>
|
||||
{if $show.source == 1}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$show.tvdb}"
|
||||
title="View at TheTVDB">TheTVDB</a>
|
||||
{if $show.tvdb > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$show.tvdb}"
|
||||
title="View at TheTVDB">TheTVDB</a>
|
||||
{/if}
|
||||
{elseif $show.source == 2}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://tvmaze.com/shows/{$show.tvmaze}"
|
||||
title="View at TVMaze">TVMaze</a>
|
||||
{if $show.tvmaze > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://tvmaze.com/shows/{$show.tvmaze}"
|
||||
title="View at TVMaze">TVMaze</a>
|
||||
{/if}
|
||||
{elseif $show.source == 3}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$show.trakt}"
|
||||
title="View at TraktTv">Trakt</a>
|
||||
{if $show.trakt > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$show.trakt}"
|
||||
title="View at TraktTv">Trakt</a>
|
||||
{/if}
|
||||
{elseif $show.source == 6}
|
||||
<a class="btn btn-sm btn-info" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$show.tvrage}"
|
||||
title="View at TV Rage">TV Rage</a>
|
||||
{if $show.tvrage > 0}
|
||||
<a class="label label-default" target="_blank"
|
||||
href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$show.tvrage}"
|
||||
title="View at TV Rage">TV Rage</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
@@ -59,13 +59,21 @@
|
||||
<a title="View series" href="{$smarty.const.WWW_TOP}/series/{$s.id}">Series</a><br />
|
||||
{if $s.id > 0}
|
||||
{if $s.source == 1}
|
||||
{if $show.tvdb > 0}
|
||||
<a title="View at TVDB" target="_blank" href="{$site->dereferrer_link}http://thetvdb.com/?tab=series&id={$s.tvdb}">TVDB</a>
|
||||
{/if}
|
||||
{elseif $s.source == 2}
|
||||
{if $show.tvmaze > 0}
|
||||
<a title="View at TVMaze" target="_blank" href="{$site->dereferrer_link}http://tvmaze.com/shows/{$s.tvmaze}">TVMaze</a>
|
||||
{/if}
|
||||
{elseif $s.source == 3}
|
||||
{if $show.trakt > 0}
|
||||
<a title="View at Trakt" target="_blank" href="{$site->dereferrer_link}http://www.trakt.tv/shows/{$s.trakt}">Trakt</a>
|
||||
{/if}
|
||||
{elseif $s.source == 6}
|
||||
{if $show.tvrage > 0}
|
||||
<a title="View at TVRage" target="_blank" href="{$site->dereferrer_link}http://www.tvrage.com/shows/id-{$s.tvrage}">TVRage</a>
|
||||
{/if}
|
||||
{/if}
|
||||
<a title="RSS Feed for {$s.title|escape:"htmlall"}" href="{$smarty.const.WWW_TOP}/rss?show={$s.id}&dl=1&i={$userdata.id}&r={$userdata.rsstoken}"><i class="fa fa-rss"></i></a>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user