@@ -30,7 +30,7 @@ |
||
| 30 | 30 | abstract class Videos |
| 31 | 31 | { |
| 32 | 32 | // Video Type Identifiers |
| 33 | - const TYPE_TV = 0; // Type of video is a TV Programme/Show |
|
| 33 | + const TYPE_TV = 0; // Type of video is a TV Programme/Show |
|
| 34 | 34 | const TYPE_FILM = 1; // Type of video is a Film/Movie |
| 35 | 35 | const TYPE_ANIME = 2; // Type of video is a Anime |
| 36 | 36 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param $process |
| 61 | 61 | * @param bool $local |
| 62 | 62 | */ |
| 63 | - public function processSite ($groupID, $guidChar, $process, $local = false) |
|
| 63 | + public function processSite($groupID, $guidChar, $process, $local = false) |
|
| 64 | 64 | { |
| 65 | 65 | $res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TVMAZE); |
| 66 | 66 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $this->setVideoNotFound(parent::PROCESS_TMDB, $row['id']); |
| 192 | 192 | $this->titleCache[] = $release['cleanname']; |
| 193 | 193 | } |
| 194 | - } else{ |
|
| 194 | + } else { |
|
| 195 | 195 | //Processing failed, set the episode ID to the next processing group |
| 196 | 196 | $this->setVideoNotFound(parent::PROCESS_TMDB, $row['id']); |
| 197 | 197 | $this->titleCache[] = $release['cleanname']; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * @param $process |
| 54 | 54 | * @param bool $local |
| 55 | 55 | */ |
| 56 | - public function processSite ($groupID, $guidChar, $process, $local = false) |
|
| 56 | + public function processSite($groupID, $guidChar, $process, $local = false) |
|
| 57 | 57 | { |
| 58 | 58 | $res = $this->getTvReleases($groupID, $guidChar, $process, parent::PROCESS_TMDB); |
| 59 | 59 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $this->setVideoNotFound(parent::PROCESS_TRAKT, $row['id']); |
| 183 | 183 | $this->titleCache[] = $release['cleanname']; |
| 184 | 184 | } |
| 185 | - } else{ |
|
| 185 | + } else { |
|
| 186 | 186 | //Processing failed, set the episode ID to the next processing group |
| 187 | 187 | $this->setVideoNotFound(parent::PROCESS_TRAKT, $row['id']); |
| 188 | 188 | $this->titleCache[] = $release['cleanname']; |
@@ -13,25 +13,25 @@ discard block |
||
| 13 | 13 | abstract class TV extends Videos |
| 14 | 14 | { |
| 15 | 15 | // Television Sources |
| 16 | - const SOURCE_NONE = 0; // No Scrape source |
|
| 17 | - const SOURCE_TVDB = 1; // Scrape source was TVDB |
|
| 18 | - const SOURCE_TVMAZE = 2; // Scrape source was TVMAZE |
|
| 19 | - const SOURCE_TMDB = 3; // Scrape source was TMDB |
|
| 20 | - const SOURCE_TRAKT = 4; // Scrape source was Trakt |
|
| 21 | - const SOURCE_IMDB = 5; // Scrape source was IMDB |
|
| 22 | - const SOURCE_TVRAGE = 6; // Scrape source was TvRage |
|
| 16 | + const SOURCE_NONE = 0; // No Scrape source |
|
| 17 | + const SOURCE_TVDB = 1; // Scrape source was TVDB |
|
| 18 | + const SOURCE_TVMAZE = 2; // Scrape source was TVMAZE |
|
| 19 | + const SOURCE_TMDB = 3; // Scrape source was TMDB |
|
| 20 | + const SOURCE_TRAKT = 4; // Scrape source was Trakt |
|
| 21 | + const SOURCE_IMDB = 5; // Scrape source was IMDB |
|
| 22 | + const SOURCE_TVRAGE = 6; // Scrape source was TvRage |
|
| 23 | 23 | |
| 24 | 24 | // Anime Sources |
| 25 | - const SOURCE_ANIDB = 10; // Scrape source was AniDB |
|
| 25 | + const SOURCE_ANIDB = 10; // Scrape source was AniDB |
|
| 26 | 26 | |
| 27 | 27 | // Processing signifiers |
| 28 | - const PROCESS_TVDB = 0; // Process TVDB First |
|
| 29 | - const PROCESS_TVMAZE = -1; // Process TVMaze Second |
|
| 30 | - const PROCESS_TMDB = -2; // Process TMDB Third |
|
| 31 | - const PROCESS_TRAKT = -3; // Process Trakt Fourth |
|
| 32 | - const PROCESS_IMDB = -4; // Process IMDB Fifth |
|
| 33 | - const PROCESS_TVRAGE = -5; // Process TvRage Sixth |
|
| 34 | - const NO_MATCH_FOUND = -6; // Failed All Methods |
|
| 28 | + const PROCESS_TVDB = 0; // Process TVDB First |
|
| 29 | + const PROCESS_TVMAZE = -1; // Process TVMaze Second |
|
| 30 | + const PROCESS_TMDB = -2; // Process TMDB Third |
|
| 31 | + const PROCESS_TRAKT = -3; // Process Trakt Fourth |
|
| 32 | + const PROCESS_IMDB = -4; // Process IMDB Fifth |
|
| 33 | + const PROCESS_TVRAGE = -5; // Process TvRage Sixth |
|
| 34 | + const NO_MATCH_FOUND = -6; // Failed All Methods |
|
| 35 | 35 | const FAILED_PARSE = -100; // Failed Parsing |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | { |
| 536 | 536 | $showName = ''; |
| 537 | 537 | |
| 538 | - $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' . |
|
| 538 | + $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' . |
|
| 539 | 539 | '|DD5|DiVX|DLMux|DTS|DVD(-?Rip)?|E\d{2,3}|[HX][-_. ]?26[45]|ITA(-ENG)?|HEVC|[HPS]DTV|PROPER|REPACK|Season|Episode|' . |
| 540 | 540 | 'S\d+[^a-z0-9]?((E\d+)[abr]?)*|WEB[-_. ]?(DL|Rip)|XViD)[^a-z0-9]?'; |
| 541 | 541 | |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | |
| 805 | 805 | if (is_array($required)) { |
| 806 | 806 | foreach ($required as $req) { |
| 807 | - if (!in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'])){ |
|
| 807 | + if (!in_array($type, ['tmdbS', 'tmdbE', 'traktS', 'traktE'])) { |
|
| 808 | 808 | if (!isset($array->$req)) { |
| 809 | 809 | return false; |
| 810 | 810 | } |
@@ -17,27 +17,27 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @var string |
| 19 | 19 | */ |
| 20 | - public $showInfoUrl = 'http://www.tvrage.com/shows/id-'; |
|
| 20 | + public $showInfoUrl = 'http://www.tvrage.com/shows/id-'; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var string |
| 24 | 24 | */ |
| 25 | - public $showQuickInfoURL = 'http://services.tvrage.com/tools/quickinfo.php?show='; |
|
| 25 | + public $showQuickInfoURL = 'http://services.tvrage.com/tools/quickinfo.php?show='; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var string |
| 29 | 29 | */ |
| 30 | - public $xmlFullSearchUrl = 'http://services.tvrage.com/feeds/full_search.php?show='; |
|
| 30 | + public $xmlFullSearchUrl = 'http://services.tvrage.com/feeds/full_search.php?show='; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * @var string |
| 34 | 34 | */ |
| 35 | - public $xmlShowInfoUrl = 'http://services.tvrage.com/feeds/showinfo.php?sid='; |
|
| 35 | + public $xmlShowInfoUrl = 'http://services.tvrage.com/feeds/showinfo.php?sid='; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @var string |
| 39 | 39 | */ |
| 40 | - public $xmlFullShowInfoUrl = 'http://services.tvrage.com/feeds/full_show_info.php?sid='; |
|
| 40 | + public $xmlFullShowInfoUrl = 'http://services.tvrage.com/feeds/full_show_info.php?sid='; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @var string |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function __construct(array $options = []) |
| 71 | 71 | { |
| 72 | 72 | parent::__construct($options); |
| 73 | - $this->xmlEpisodeInfoUrl = "http://services.tvrage.com/myfeeds/episodeinfo.php?key=" . TvRage::APIKEY; |
|
| 73 | + $this->xmlEpisodeInfoUrl = "http://services.tvrage.com/myfeeds/episodeinfo.php?key=" . TvRage::APIKEY; |
|
| 74 | 74 | $this->imgSavePath = NN_COVERS . 'tvrage' . DS; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $this->pdo->log->headerOver($show['cleanname']) . |
| 129 | 129 | $this->pdo->log->primary(" found in local db, setting tvrage ID and attempting episode lookup."); |
| 130 | 130 | } |
| 131 | - $episodeId = $this->getBySeasonEp($this->videoId, $show['season'], $show['episode']); |
|
| 131 | + $episodeId = $this->getBySeasonEp($this->videoId, $show['season'], $show['episode']); |
|
| 132 | 132 | if ($episodeId === false) { |
| 133 | 133 | $epinfo = $this->getEpisodeInfo($this->rageId, $show['season'], $show['episode']); |
| 134 | 134 | if ($epinfo !== false && isset($epinfo['airdate']) && !empty($epinfo['title'])) { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * Current year of parsed search name. |
| 32 | 32 | * @var string |
| 33 | 33 | */ |
| 34 | - protected $currentYear = ''; |
|
| 34 | + protected $currentYear = ''; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Current release id of parsed search name. |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | { |
| 515 | 515 | if (is_array($value) && !empty($value)) { |
| 516 | 516 | $temp = ''; |
| 517 | - foreach($value as $val) { |
|
| 517 | + foreach ($value as $val) { |
|
| 518 | 518 | if (!is_array($val) && !is_object($val)) { |
| 519 | 519 | $temp .= (string)$val; |
| 520 | 520 | } |
@@ -561,8 +561,8 @@ discard block |
||
| 561 | 561 | public function getColumnKeys() |
| 562 | 562 | { |
| 563 | 563 | return [ |
| 564 | - 'actors','backdrop','cover','director','genre','imdbid','language', |
|
| 565 | - 'plot','rating','tagline','title','tmdbid', 'trailer','type','year' |
|
| 564 | + 'actors', 'backdrop', 'cover', 'director', 'genre', 'imdbid', 'language', |
|
| 565 | + 'plot', 'rating', 'tagline', 'title', 'tmdbid', 'trailer', 'type', 'year' |
|
| 566 | 566 | ]; |
| 567 | 567 | } |
| 568 | 568 | |
@@ -701,12 +701,12 @@ discard block |
||
| 701 | 701 | if ($this->checkVariable($fanart['banner'])) { |
| 702 | 702 | $mov['banner'] = $this->releaseImage->saveImage($imdbId . '-banner', $fanart['banner'], $this->imgSavePath); |
| 703 | 703 | } |
| 704 | - $mov['title'] = $this->setTmdbImdbTraktVar($imdb['title'] , $tmdb['title'], $trakt['title']); |
|
| 705 | - $mov['rating'] = $this->setTmdbImdbTraktVar($imdb['rating'] , $tmdb['rating'], $trakt['rating']); |
|
| 706 | - $mov['plot'] = $this->setTmdbImdbTraktVar($imdb['plot'] , $tmdb['plot'], $trakt['overview']); |
|
| 704 | + $mov['title'] = $this->setTmdbImdbTraktVar($imdb['title'], $tmdb['title'], $trakt['title']); |
|
| 705 | + $mov['rating'] = $this->setTmdbImdbTraktVar($imdb['rating'], $tmdb['rating'], $trakt['rating']); |
|
| 706 | + $mov['plot'] = $this->setTmdbImdbTraktVar($imdb['plot'], $tmdb['plot'], $trakt['overview']); |
|
| 707 | 707 | $mov['tagline'] = $this->setTmdbImdbTraktVar($imdb['tagline'], $tmdb['tagline'], $trakt['tagline']); |
| 708 | - $mov['year'] = $this->setTmdbImdbTraktVar($imdb['year'] , $tmdb['year'], $trakt['year']); |
|
| 709 | - $mov['genre'] = $this->setTmdbImdbTraktVar($imdb['genre'] , $tmdb['genre'], $trakt['genres']); |
|
| 708 | + $mov['year'] = $this->setTmdbImdbTraktVar($imdb['year'], $tmdb['year'], $trakt['year']); |
|
| 709 | + $mov['genre'] = $this->setTmdbImdbTraktVar($imdb['genre'], $tmdb['genre'], $trakt['genres']); |
|
| 710 | 710 | |
| 711 | 711 | if ($this->checkVariable($imdb['type'])) { |
| 712 | 712 | $mov['type'] = $imdb['type']; |
@@ -732,20 +732,20 @@ discard block |
||
| 732 | 732 | $mov['type'] = implode(', ', array_unique($mov['type'])); |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - $mov['title'] = html_entity_decode($mov['title'] , ENT_QUOTES, 'UTF-8'); |
|
| 735 | + $mov['title'] = html_entity_decode($mov['title'], ENT_QUOTES, 'UTF-8'); |
|
| 736 | 736 | |
| 737 | 737 | $mov['title'] = str_replace(['/', '\\'], '', $mov['title']); |
| 738 | 738 | $movieID = $this->update([ |
| 739 | - 'actors' => html_entity_decode($mov['actors'] , ENT_QUOTES, 'UTF-8'), |
|
| 739 | + 'actors' => html_entity_decode($mov['actors'], ENT_QUOTES, 'UTF-8'), |
|
| 740 | 740 | 'backdrop' => $mov['backdrop'], |
| 741 | 741 | 'cover' => $mov['cover'], |
| 742 | 742 | 'director' => html_entity_decode($mov['director'], ENT_QUOTES, 'UTF-8'), |
| 743 | - 'genre' => html_entity_decode($mov['genre'] , ENT_QUOTES, 'UTF-8'), |
|
| 743 | + 'genre' => html_entity_decode($mov['genre'], ENT_QUOTES, 'UTF-8'), |
|
| 744 | 744 | 'imdbid' => $mov['imdbid'], |
| 745 | 745 | 'language' => html_entity_decode($mov['language'], ENT_QUOTES, 'UTF-8'), |
| 746 | 746 | 'plot' => html_entity_decode(preg_replace('/\s+See full summary »/', ' ', $mov['plot']), ENT_QUOTES, 'UTF-8'), |
| 747 | 747 | 'rating' => round($mov['rating'], 1), |
| 748 | - 'tagline' => html_entity_decode($mov['tagline'] , ENT_QUOTES, 'UTF-8'), |
|
| 748 | + 'tagline' => html_entity_decode($mov['tagline'], ENT_QUOTES, 'UTF-8'), |
|
| 749 | 749 | 'title' => $mov['title'], |
| 750 | 750 | 'tmdbid' => $mov['tmdbid'], |
| 751 | 751 | 'type' => html_entity_decode(ucwords(preg_replace('/[\.\_]/', ' ', $mov['type'])), ENT_QUOTES, 'UTF-8'), |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | { |
| 779 | 779 | if ($this->fanartapikey != '') |
| 780 | 780 | { |
| 781 | - $buffer = Utility::getUrl(['url' => 'https://webservice.fanart.tv/v3/movies/' . 'tt' . $imdbId . '?api_key=' . $this->fanartapikey , 'verifycert' => false]); |
|
| 781 | + $buffer = Utility::getUrl(['url' => 'https://webservice.fanart.tv/v3/movies/' . 'tt' . $imdbId . '?api_key=' . $this->fanartapikey, 'verifycert' => false]); |
|
| 782 | 782 | if ($buffer !== false) { |
| 783 | 783 | $art = json_decode($buffer, true); |
| 784 | 784 | if (isset($art['status']) && $art['status'] === 'error') { |
@@ -1196,8 +1196,8 @@ discard block |
||
| 1196 | 1196 | |
| 1197 | 1197 | //If we found a year, try looking in a 4 year range. |
| 1198 | 1198 | if ($this->currentYear !== false) { |
| 1199 | - $start = (int) $this->currentYear - 2; |
|
| 1200 | - $end = (int) $this->currentYear + 2; |
|
| 1199 | + $start = (int)$this->currentYear - 2; |
|
| 1200 | + $end = (int)$this->currentYear + 2; |
|
| 1201 | 1201 | $andYearIn = 'AND year IN ('; |
| 1202 | 1202 | while ($start < $end) { |
| 1203 | 1203 | $andYearIn .= $start . ','; |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | */ |
| 1296 | 1296 | protected function googleSearch() |
| 1297 | 1297 | { |
| 1298 | - $buffer =Utility::getUrl([ |
|
| 1298 | + $buffer = Utility::getUrl([ |
|
| 1299 | 1299 | 'url' => |
| 1300 | 1300 | 'https://www.google.com/search?hl=en&as_q=&as_epq=' . |
| 1301 | 1301 | urlencode( |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | public $txtcount = 0; |
| 18 | 18 | public $sfvcount = 0; |
| 19 | 19 | public $filesize = 0; |
| 20 | - public $poster = ''; |
|
| 20 | + public $poster = ''; |
|
| 21 | 21 | public $postedfirst = 0; |
| 22 | 22 | public $postedlast = 0; |
| 23 | 23 | public $completion = 0; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $this->sfvfileregex = '/\.(sfv)[ "\)\]]/iS'; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function loadFromString($str, $loadAllVars=false) |
|
| 56 | + public function loadFromString($str, $loadAllVars = false) |
|
| 57 | 57 | { |
| 58 | 58 | if (empty($this->source)) |
| 59 | 59 | $this->source = 'string'; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return $this->isLoaded; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function loadFromFile($loc, $loadAllVars=false) |
|
| 71 | + public function loadFromFile($loc, $loadAllVars = false) |
|
| 72 | 72 | { |
| 73 | 73 | $this->source = $loc; |
| 74 | 74 | $this->loadAllVars = $loadAllVars; |
@@ -77,17 +77,17 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | if (preg_match('/\.(gz|zip)$/i', $loc, $ext)) |
| 79 | 79 | { |
| 80 | - switch(strtolower($ext[1])) |
|
| 80 | + switch (strtolower($ext[1])) |
|
| 81 | 81 | { |
| 82 | 82 | case 'gz': |
| 83 | - $loc = 'compress.zlib://'.$loc; |
|
| 83 | + $loc = 'compress.zlib://' . $loc; |
|
| 84 | 84 | break; |
| 85 | 85 | case 'zip': |
| 86 | 86 | $zip = new ZipArchive; |
| 87 | 87 | if ($zip->open($loc) === true && $zip->numFiles == 1) |
| 88 | 88 | return $this->loadFromString($zip->getFromIndex(0), $loadAllVars); |
| 89 | 89 | else |
| 90 | - $loc = 'zip://'.$loc; |
|
| 90 | + $loc = 'zip://' . $loc; |
|
| 91 | 91 | break; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | public function summarize() |
| 106 | 106 | { |
| 107 | 107 | $out = []; |
| 108 | - $out[] = 'Reading from '.basename($this->source).'...'; |
|
| 108 | + $out[] = 'Reading from ' . basename($this->source) . '...'; |
|
| 109 | 109 | if (!empty($this->nfofiles)) |
| 110 | 110 | $out[] = ' -nfo detected'; |
| 111 | 111 | if (!empty($this->samplefiles)) |
@@ -118,23 +118,23 @@ discard block |
||
| 118 | 118 | if (!empty($this->metadata)) |
| 119 | 119 | { |
| 120 | 120 | $out[] = ' -metadata:'; |
| 121 | - foreach($this->metadata as $mk=>$mv) |
|
| 122 | - $out[] = ' -'.$mk.': '.$mv; |
|
| 121 | + foreach ($this->metadata as $mk=>$mv) |
|
| 122 | + $out[] = ' -' . $mk . ': ' . $mv; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $out[] = ' -sngl: '.sizeof($this->segmentfiles); |
|
| 126 | - |
|
| 127 | - $out[] = ' -pstr: '.$this->poster; |
|
| 128 | - $out[] = ' -grps: '.implode(', ', $this->groups); |
|
| 129 | - $out[] = ' -size: '.round(($this->filesize / 1048576), 2).' MB in '.$this->filecount.' Files'; |
|
| 130 | - $out[] = ' -'.$this->rarcount.' rars'; |
|
| 131 | - $out[] = ' -'.$this->parcount.' pars'; |
|
| 132 | - $out[] = ' -'.$this->sfvcount.' sfvs'; |
|
| 133 | - $out[] = ' -'.$this->zipcount.' zips'; |
|
| 134 | - $out[] = ' -'.$this->videocount.' videos'; |
|
| 135 | - $out[] = ' -'.$this->audiocount.' audios'; |
|
| 136 | - $out[] = ' -cmpltn: '.$this->completion.'% ('.$this->segmentactual.'/'.$this->segmenttotal.')'; |
|
| 137 | - $out[] = ' -pstd: '.date("Y-m-d H:i:s", $this->postedlast); |
|
| 125 | + $out[] = ' -sngl: ' . sizeof($this->segmentfiles); |
|
| 126 | + |
|
| 127 | + $out[] = ' -pstr: ' . $this->poster; |
|
| 128 | + $out[] = ' -grps: ' . implode(', ', $this->groups); |
|
| 129 | + $out[] = ' -size: ' . round(($this->filesize / 1048576), 2) . ' MB in ' . $this->filecount . ' Files'; |
|
| 130 | + $out[] = ' -' . $this->rarcount . ' rars'; |
|
| 131 | + $out[] = ' -' . $this->parcount . ' pars'; |
|
| 132 | + $out[] = ' -' . $this->sfvcount . ' sfvs'; |
|
| 133 | + $out[] = ' -' . $this->zipcount . ' zips'; |
|
| 134 | + $out[] = ' -' . $this->videocount . ' videos'; |
|
| 135 | + $out[] = ' -' . $this->audiocount . ' audios'; |
|
| 136 | + $out[] = ' -cmpltn: ' . $this->completion . '% (' . $this->segmentactual . '/' . $this->segmenttotal . ')'; |
|
| 137 | + $out[] = ' -pstd: ' . date("Y-m-d H:i:s", $this->postedlast); |
|
| 138 | 138 | $out[] = ''; |
| 139 | 139 | $out[] = ''; |
| 140 | 140 | |
@@ -154,27 +154,27 @@ discard block |
||
| 154 | 154 | //Metadata |
| 155 | 155 | if (isset($xmlObj->head->meta)) |
| 156 | 156 | { |
| 157 | - foreach($xmlObj->head->meta as $meta) |
|
| 157 | + foreach ($xmlObj->head->meta as $meta) |
|
| 158 | 158 | { |
| 159 | 159 | if (isset($meta->attributes()->type)) |
| 160 | 160 | { |
| 161 | - $metaKey = (string) $meta->attributes()->type; |
|
| 162 | - $this->metadata[$metaKey] = (string) $meta; |
|
| 161 | + $metaKey = (string)$meta->attributes()->type; |
|
| 162 | + $this->metadata[$metaKey] = (string)$meta; |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | //NZB GID = first segment of first file |
| 168 | - $gid = (string) $xmlObj->file->segments->segment; |
|
| 168 | + $gid = (string)$xmlObj->file->segments->segment; |
|
| 169 | 169 | if (!empty($gid)) |
| 170 | 170 | $this->gid = md5($gid); |
| 171 | 171 | |
| 172 | - foreach($xmlObj->file as $file) |
|
| 172 | + foreach ($xmlObj->file as $file) |
|
| 173 | 173 | { |
| 174 | 174 | $fileArr = []; |
| 175 | - $fileArr['subject'] = (string) $file->attributes()->subject; |
|
| 176 | - $fileArr['poster'] = (string) $file->attributes()->poster; |
|
| 177 | - $fileArr['posted'] = (int) $file->attributes()->date; |
|
| 175 | + $fileArr['subject'] = (string)$file->attributes()->subject; |
|
| 176 | + $fileArr['poster'] = (string)$file->attributes()->poster; |
|
| 177 | + $fileArr['posted'] = (int)$file->attributes()->date; |
|
| 178 | 178 | $fileArr['groups'] = []; |
| 179 | 179 | $fileArr['filesize'] = 0; |
| 180 | 180 | $fileArr['segmenttotal'] = 0; |
@@ -200,22 +200,22 @@ discard block |
||
| 200 | 200 | //groups |
| 201 | 201 | foreach ($file->groups->group as $group) |
| 202 | 202 | { |
| 203 | - $this->groups[] = (string) $group; |
|
| 204 | - $fileArr['groups'][] = (string) $group; |
|
| 203 | + $this->groups[] = (string)$group; |
|
| 204 | + $fileArr['groups'][] = (string)$group; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | //file segments |
| 208 | - foreach($file->segments->segment as $segment) |
|
| 208 | + foreach ($file->segments->segment as $segment) |
|
| 209 | 209 | { |
| 210 | - $bytes = (int) $segment->attributes()->bytes; |
|
| 211 | - $number = (int) $segment->attributes()->number; |
|
| 210 | + $bytes = (int)$segment->attributes()->bytes; |
|
| 211 | + $number = (int)$segment->attributes()->number; |
|
| 212 | 212 | |
| 213 | 213 | $this->filesize += $bytes; |
| 214 | 214 | $this->segmentactual++; |
| 215 | 215 | |
| 216 | 216 | $fileArr['filesize'] += $bytes; |
| 217 | 217 | $fileArr['segmentactual']++; |
| 218 | - $fileArr['segments'][$number] = (string) $segment; |
|
| 218 | + $fileArr['segments'][$number] = (string)$segment; |
|
| 219 | 219 | $fileArr['segmentbytes'][$number] = $bytes; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -223,19 +223,19 @@ discard block |
||
| 223 | 223 | preg_match_all($pattern, $subject, $matches, PREG_PATTERN_ORDER); |
| 224 | 224 | $matchcnt = sizeof($matches[0]); |
| 225 | 225 | $msgPart = $msgTotalParts = 0; |
| 226 | - for ($i=0; $i<$matchcnt; $i++) |
|
| 226 | + for ($i = 0; $i < $matchcnt; $i++) |
|
| 227 | 227 | { |
| 228 | 228 | //not (int)'d here because of the preg_replace later on |
| 229 | 229 | $msgPart = $matches[1][$i]; |
| 230 | 230 | $msgTotalParts = $matches[2][$i]; |
| 231 | 231 | } |
| 232 | - if((int)$msgPart > 0 && (int)$msgTotalParts > 0) |
|
| 232 | + if ((int)$msgPart > 0 && (int)$msgTotalParts > 0) |
|
| 233 | 233 | { |
| 234 | - $this->segmenttotal += (int) $msgTotalParts; |
|
| 235 | - $fileArr['segmenttotal'] = (int) $msgTotalParts; |
|
| 236 | - $fileArr['completion'] = number_format(($fileArr['segmentactual']/$fileArr['segmenttotal'])*100, 0); |
|
| 234 | + $this->segmenttotal += (int)$msgTotalParts; |
|
| 235 | + $fileArr['segmenttotal'] = (int)$msgTotalParts; |
|
| 236 | + $fileArr['completion'] = number_format(($fileArr['segmentactual'] / $fileArr['segmenttotal']) * 100, 0); |
|
| 237 | 237 | |
| 238 | - $fileArr['subject'] = utf8_encode(trim(preg_replace('|\('.$msgPart.'[\/]'.$msgTotalParts.'\)|i', '', $subject))); |
|
| 238 | + $fileArr['subject'] = utf8_encode(trim(preg_replace('|\(' . $msgPart . '[\/]' . $msgTotalParts . '\)|i', '', $subject))); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | //file counts |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | $this->groups = array_unique($this->groups); |
| 312 | 312 | |
| 313 | 313 | if ($this->segmenttotal > 0) |
| 314 | - $this->completion = number_format(($this->segmentactual/$this->segmenttotal)*100, 0); |
|
| 314 | + $this->completion = number_format(($this->segmentactual / $this->segmenttotal) * 100, 0); |
|
| 315 | 315 | |
| 316 | 316 | if (is_array($this->nzb) && !empty($this->nzb)) |
| 317 | 317 | $this->isLoaded = true; |
@@ -331,27 +331,27 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | $nzb .= "<head>\n"; |
| 333 | 333 | $out = []; |
| 334 | - foreach($this->metadata as $mk=>$mv) |
|
| 335 | - $out[] = ' <meta type="'.$mk.'">'.$mv."</meta>\n"; |
|
| 334 | + foreach ($this->metadata as $mk=>$mv) |
|
| 335 | + $out[] = ' <meta type="' . $mk . '">' . $mv . "</meta>\n"; |
|
| 336 | 336 | $nzb .= "</head>\n"; |
| 337 | 337 | } |
| 338 | - foreach($this->nzb as $postFile) |
|
| 338 | + foreach ($this->nzb as $postFile) |
|
| 339 | 339 | { |
| 340 | - $nzb .= "<file poster=\"".htmlspecialchars($postFile["poster"], ENT_QUOTES, 'utf-8')."\" date=\"".$postFile["posted"]."\" subject=\"".htmlspecialchars($postFile["subject"], ENT_QUOTES, 'utf-8')." (1/".$postFile["segmenttotal"].")\">\n"; |
|
| 340 | + $nzb .= "<file poster=\"" . htmlspecialchars($postFile["poster"], ENT_QUOTES, 'utf-8') . "\" date=\"" . $postFile["posted"] . "\" subject=\"" . htmlspecialchars($postFile["subject"], ENT_QUOTES, 'utf-8') . " (1/" . $postFile["segmenttotal"] . ")\">\n"; |
|
| 341 | 341 | $nzb .= " <groups>\n"; |
| 342 | - foreach($postFile['groups'] as $fileGroup) |
|
| 342 | + foreach ($postFile['groups'] as $fileGroup) |
|
| 343 | 343 | { |
| 344 | - $nzb .= " <group>".$fileGroup."</group>\n"; |
|
| 344 | + $nzb .= " <group>" . $fileGroup . "</group>\n"; |
|
| 345 | 345 | } |
| 346 | 346 | $nzb .= " </groups>\n"; |
| 347 | 347 | $nzb .= " <segments>\n"; |
| 348 | - foreach($postFile['segments'] as $fileSegmentNum=>$fileSegment) |
|
| 348 | + foreach ($postFile['segments'] as $fileSegmentNum=>$fileSegment) |
|
| 349 | 349 | { |
| 350 | - $nzb .= " <segment bytes=\"".$postFile['segmentbytes'][$fileSegmentNum]."\" number=\"".$fileSegmentNum."\">".htmlspecialchars($fileSegment, ENT_QUOTES, 'utf-8')."</segment>\n"; |
|
| 350 | + $nzb .= " <segment bytes=\"" . $postFile['segmentbytes'][$fileSegmentNum] . "\" number=\"" . $fileSegmentNum . "\">" . htmlspecialchars($fileSegment, ENT_QUOTES, 'utf-8') . "</segment>\n"; |
|
| 351 | 351 | } |
| 352 | 352 | $nzb .= " </segments>\n</file>\n"; |
| 353 | 353 | } |
| 354 | - $nzb .= "<!-- nntmux ".date("Y-m-d H:i:s")." -->\n</nzb>"; |
|
| 354 | + $nzb .= "<!-- nntmux " . date("Y-m-d H:i:s") . " -->\n</nzb>"; |
|
| 355 | 355 | |
| 356 | 356 | return $nzb; |
| 357 | 357 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | if ($this->_ret = $this->_html->find("img[alt=Boxshot]", 0)) { |
| 122 | 122 | $this->_ret->src = preg_replace('#cache/#', '', $this->_ret->src); |
| 123 | - $this->_ret->src = preg_replace('#thumb_150x150/#','',$this->_ret->src); |
|
| 123 | + $this->_ret->src = preg_replace('#thumb_150x150/#', '', $this->_ret->src); |
|
| 124 | 124 | $this->_res['cover'] = $this->_ret->src; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | $this->searchTerm = preg_replace('#\s#', '-', strtolower($this->searchTerm)); |
| 197 | 197 | if ($this->getUrl(self::DESURAURL . '/games/' . $this->searchTerm) !== false) { |
| 198 | 198 | if (!preg_match('#(Games system error)#i', $this->_response)) { |
| 199 | - if($this->_ret = $this->_html->find("a#watchtoggle", 0)){ |
|
| 200 | - if(preg_match('#siteareaid=(?<gameid>\d+)#', $this->_ret->href, $matches)){ |
|
| 199 | + if ($this->_ret = $this->_html->find("a#watchtoggle", 0)) { |
|
| 200 | + if (preg_match('#siteareaid=(?<gameid>\d+)#', $this->_ret->href, $matches)) { |
|
| 201 | 201 | $this->_desuraGameID = $matches['gameid']; |
| 202 | 202 | $this->_directURL = self::DESURAURL . '/games/' . $this->searchTerm; |
| 203 | 203 | $result = true; |
@@ -694,7 +694,7 @@ |
||
| 694 | 694 | if ($res instanceof \Traversable && $res->rowCount() > 0) { |
| 695 | 695 | if ($this->echooutput) { |
| 696 | 696 | $this->pdo->log->doEcho( |
| 697 | - $this->pdo->log->header("Processing " . $res->rowCount() .' music release(s).' |
|
| 697 | + $this->pdo->log->header("Processing " . $res->rowCount() . ' music release(s).' |
|
| 698 | 698 | ) |
| 699 | 699 | ); |
| 700 | 700 | } |