diff --git a/Blacklight/processing/tv/TV.php b/Blacklight/processing/tv/TV.php index 4e775da4c2..8407c47ea0 100755 --- a/Blacklight/processing/tv/TV.php +++ b/Blacklight/processing/tv/TV.php @@ -450,49 +450,49 @@ private function parseSeasonEp(string $relname): array $episodeArr = []; // S01E01-E02 and S01E01-02 - if (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]?e(\d{1,3})(?:[e-])(\d{1,3})[^a-z0-9]/i', $relname, $hits)) { + if (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]?e(\d{1,3})(?:[e-])(\d{1,3})[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = (int) $hits[2]; $episodeArr['episode'] = [(int) $hits[3], (int) $hits[4]]; } //S01E0102 and S01E01E02 - lame no delimit numbering, regex would collide if there was ever 1000 ep season. - elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{2})[^a-z0-9]?e(\d{2})e?(\d{2})[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{2})[^a-z0-9]?e(\d{2})e?(\d{2})[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = (int) $hits[2]; $episodeArr['episode'] = (int) $hits[3]; } // S01E01 and S01.E01 - elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]?e(\d{1,3})[abr]?[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]?e(\d{1,3})[abr]?[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = (int) $hits[2]; $episodeArr['episode'] = (int) $hits[3]; } // S01 - elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = (int) $hits[2]; $episodeArr['episode'] = 'all'; } // S01D1 and S1D1 - elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]?d\d{1}[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9]s(\d{1,2})[^a-z0-9]?d\d{1}[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = (int) $hits[2]; $episodeArr['episode'] = 'all'; } // 1x01 and 101 - elseif (preg_match('/^(.*?)[^a-z0-9](\d{1,2})x(\d{1,3})[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9](\d{1,2})x(\d{1,3})[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = (int) $hits[2]; $episodeArr['episode'] = (int) $hits[3]; } // 2009.01.01 and 2009-01-01 - elseif (preg_match('/^(.*?)[^a-z0-9](?P(19|20)(\d{2})[.\/-](\d{2})[.\/-](\d{2}))[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9](?P(19|20)(\d{2})[.\/-](\d{2})[.\/-](\d{2}))[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = $hits[4].$hits[5]; $episodeArr['episode'] = $hits[5].'/'.$hits[6]; $episodeArr['airdate'] = date('Y-m-d', strtotime(preg_replace('/[^0-9]/i', '/', $hits['airdate']))); //yyyy-mm-dd } // 01.01.2009 - elseif (preg_match('/^(.*?)[^a-z0-9](?P(\d{2})[^a-z0-9](\d{2})[^a-z0-9](19|20)(\d{2}))[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9](?P(\d{2})[^a-z0-9](\d{2})[^a-z0-9](19|20)(\d{2}))[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = $hits[5].$hits[6]; $episodeArr['episode'] = $hits[3].'/'.$hits[4]; $episodeArr['airdate'] = date('Y-m-d', strtotime(preg_replace('/[^0-9]/i', '/', $hits['airdate']))); //yyyy-mm-dd } // 01.01.09 - elseif (preg_match('/^(.*?)[^a-z0-9](\d{2})[^a-z0-9](\d{2})[^a-z0-9](\d{2})[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9](\d{2})[^a-z0-9](\d{2})[^a-z0-9](\d{2})[^a-z0-9]?/i', $relname, $hits)) { // Add extra logic to capture the proper YYYY year $episodeArr['season'] = $hits[4] = ($hits[4] <= 99 && $hits[4] > 15) ? '19'.$hits[4] : '20'.$hits[4]; $episodeArr['episode'] = $hits[2].'/'.$hits[3]; @@ -500,17 +500,17 @@ private function parseSeasonEp(string $relname): array $episodeArr['airdate'] = date('Y-m-d', strtotime(preg_replace('/[^0-9]/i', '/', $tmpAirdate))); //yyyy-mm-dd } // 2009.E01 - elseif (preg_match('/^(.*?)[^a-z0-9]20(\d{2})[^a-z0-9](\d{1,3})[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9]20(\d{2})[^a-z0-9](\d{1,3})[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = '20'.$hits[2]; $episodeArr['episode'] = (int) $hits[3]; } // 2009.Part1 - elseif (preg_match('/^(.*?)[^a-z0-9](19|20)(\d{2})[^a-z0-9]Part(\d{1,2})[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9](19|20)(\d{2})[^a-z0-9]Part(\d{1,2})[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = $hits[2].$hits[3]; $episodeArr['episode'] = (int) $hits[4]; } // Part1/Pt1 - elseif (preg_match('/^(.*?)[^a-z0-9](?:Part|Pt)[^a-z0-9](\d{1,2})[^a-z0-9]/i', $relname, $hits)) { + elseif (preg_match('/^(.*?)[^a-z0-9](?:Part|Pt)[^a-z0-9](\d{1,2})[^a-z0-9]?/i', $relname, $hits)) { $episodeArr['season'] = 1; $episodeArr['episode'] = (int) $hits[2]; }