require_once FS_ROOT . "/../../www/lib/tvmaze.php"; require_once FS_ROOT . "/../../www/lib/tvinfo.php"; require_once FS_ROOT . "/../../www/lib/category.php"; /* * Get a sample of releases from tv category and test results against TVMaze SingleSearch * http://www.tvmaze.com/api */ $db = new DB(); $tvinfo = new TvInfo(); $tvmaze = new TVMaze(); $matches = $totalchecked = 0; $sql = sprintf("select distinct searchname from releases where categoryID in (%d, %d) limit 100", Category::CAT_TV_HD, Category::CAT_TV_SD); $rows = $db->query($sql); $cleannames = array(); foreach ($rows as $row) { $show = $tvinfo->parseNameEpSeason($row['searchname']); $cleannames[] = $show["cleanname"]; } foreach (array_unique($cleannames) as $row) { if ($row && starts_with_upper($row)) { $totalchecked++; $mazerow = $tvmaze->singleSearch($row); if ($mazerow) { echo sprintf("Y Show: %s | Maze: %s : %s%%\n", $row, $mazerow->name, $tvinfo->compare($row, $mazerow->name), $matches++); print_r($mazerow->externalIDs); } else { echo sprintf("N Show: %s | Maze: No Match\n", $row); } } } echo sprintf("Checked %d | Matched %d (%d)\n", $totalchecked, $matches, $matches / $totalchecked * 100);
<?php define('FS_ROOT', realpath(dirname(__FILE__))); require_once FS_ROOT . "/../../www/config.php"; require_once FS_ROOT . "/../../www/lib/framework/db.php"; require_once FS_ROOT . "/../../www/lib/tvinfo.php"; $t = new TvInfo(); $db = new Db(); $shows = $db->query("select name from releases where categoryID IN (select ID from category where parentID = 5000) limit 0, 50"); foreach ($shows as $show) { $res = $t->parseNameEpSeason($show['name']); $res['release'] = $show['name']; print_r($res); }