Add function to match poster for categorization

This commit is contained in:
DariusIII
2016-07-20 22:52:21 +02:00
parent 08ac409470
commit 8e9715cde5
3 changed files with 19 additions and 3 deletions
+1
View File
@@ -1,4 +1,5 @@
2016-07-20 DariusIII
* Chg: Add function to match poster for categorization
* Chg: Update upcoming pages to prevent notices when alternate_ids is not set in rottentomatoes response
* Chg: Update XXX UHD and XXX HD regexes for categorization
2016-07-19 DariusIII
+1 -1
View File
@@ -2,7 +2,7 @@
<nntmux>
<versions>
<git>
<tag>v0.4.2</tag>
<tag>0.0.0</tag>
<!-- commit count removed -->
<hooks>
<precommit>9</precommit>
+17 -2
View File
@@ -1022,8 +1022,7 @@ class Categorize extends Category
public function isXxxClipSD()
{
if (preg_match('/oz@lot[.]com/i', $this->poster)) {
$this->tmpCat = Category::XXX_CLIPSD;
if ($this->checkPoster( '/oz@lot[.]com/i', $this->poster, Category::XXX_CLIPSD) === true) {
return true;
}
return false;
@@ -1489,4 +1488,20 @@ class Categorize extends Category
}
return true;
}
/**
* @param string $regex Regex to use for match
* @param string $fromName Poster that needs to be matched by regex
* @param string $category Category to set if there is a match
*
* @return bool
*/
public function checkPoster($regex, $fromName, $category)
{
if (preg_match($regex, $fromName)) {
$this->tmpCat = $category;
return true;
}
return false;
}
}