mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Merge branch 'dev'
This commit is contained in:
@@ -26,6 +26,12 @@ NN_SSL_VERIFY_PEER=
|
||||
NN_SSL_VERIFY_HOST=
|
||||
NN_SSL_ALLOW_SELF_SIGNED=1
|
||||
|
||||
NN_MULTIPROCESSING_MAX_CHILD_TIME=1800
|
||||
NN_MULTIPROCESSING_MAX_CHILD_WORK=1
|
||||
NN_MULTIPROCESSING_MAX_CHILDREN_OVERRIDE=0
|
||||
NN_MULTIPROCESSING_LOG_TYPE=6
|
||||
NN_MULTIPROCESSING_CHILD_OUTPUT_TYPE=1
|
||||
|
||||
ADMIN_USER=
|
||||
ADMIN_PASS=
|
||||
ADMIN_EMAIL=
|
||||
@@ -144,3 +150,5 @@ TELESCOPE_SCHEDULE_WATCHER=true
|
||||
HORIZON_PREFIX=horizon:
|
||||
|
||||
POSTMARK_TOKEN=
|
||||
|
||||
PURGE_INACTIVE_USERS=false
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Config for PHP-CS-Fixer ver2
|
||||
*/
|
||||
$rules = [
|
||||
'psr0' => false,
|
||||
'@PSR2' => true,
|
||||
'blank_line_after_namespace' => true,
|
||||
'braces' => true,
|
||||
'class_definition' => true,
|
||||
'elseif' => true,
|
||||
'function_declaration' => true,
|
||||
'indentation_type' => true,
|
||||
'line_ending' => true,
|
||||
'lowercase_constants' => true,
|
||||
'lowercase_keywords' => true,
|
||||
'method_argument_space' => [
|
||||
'ensure_fully_multiline' => true, ],
|
||||
'no_break_comment' => true,
|
||||
'no_closing_tag' => true,
|
||||
'no_spaces_after_function_name' => true,
|
||||
'no_spaces_inside_parenthesis' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_class_element_per_statement' => [
|
||||
'elements' => ['property'],
|
||||
],
|
||||
'single_import_per_statement' => true,
|
||||
'single_line_after_imports' => true,
|
||||
'switch_case_semicolon_to_colon' => true,
|
||||
'switch_case_space' => true,
|
||||
'visibility_required' => true,
|
||||
'encoding' => true,
|
||||
'full_opening_tag' => true,
|
||||
];
|
||||
$excludes = [
|
||||
// add exclude project directory
|
||||
'vendor',
|
||||
'resources',
|
||||
'tests',
|
||||
'storage',
|
||||
'docs',
|
||||
'public',
|
||||
'bootstrap',
|
||||
];
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRules($rules)
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude($excludes)
|
||||
->in(__DIR__)
|
||||
->name('*.php')
|
||||
->notName('*.blade.php')
|
||||
);
|
||||
+18
-52
@@ -1,55 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Config for PHP-CS-Fixer ver2
|
||||
*/
|
||||
$rules = [
|
||||
'psr0' => false,
|
||||
'@PSR2' => true,
|
||||
'blank_line_after_namespace' => true,
|
||||
'braces' => true,
|
||||
'class_definition' => true,
|
||||
'elseif' => true,
|
||||
'function_declaration' => true,
|
||||
'indentation_type' => true,
|
||||
'line_ending' => true,
|
||||
'lowercase_constants' => true,
|
||||
'lowercase_keywords' => true,
|
||||
'method_argument_space' => [
|
||||
'ensure_fully_multiline' => true, ],
|
||||
'no_break_comment' => true,
|
||||
'no_closing_tag' => true,
|
||||
'no_spaces_after_function_name' => true,
|
||||
'no_spaces_inside_parenthesis' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_class_element_per_statement' => [
|
||||
'elements' => ['property'],
|
||||
],
|
||||
'single_import_per_statement' => true,
|
||||
'single_line_after_imports' => true,
|
||||
'switch_case_semicolon_to_colon' => true,
|
||||
'switch_case_space' => true,
|
||||
'visibility_required' => true,
|
||||
'encoding' => true,
|
||||
'full_opening_tag' => true,
|
||||
];
|
||||
$excludes = [
|
||||
// add exclude project directory
|
||||
'vendor',
|
||||
'resources',
|
||||
'tests',
|
||||
'storage',
|
||||
'docs',
|
||||
'public',
|
||||
'bootstrap',
|
||||
];
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRules($rules)
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
require __DIR__.'/bootstrap/app.php';
|
||||
|
||||
return (new MattAllan\LaravelCodeStyle\Config())
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->exclude($excludes)
|
||||
->in(__DIR__)
|
||||
->name('*.php')
|
||||
->notName('*.blade.php')
|
||||
);
|
||||
->in(app_path())
|
||||
->in(config_path())
|
||||
->in(database_path())
|
||||
->notPath(database_path('migrations'))
|
||||
->in(resource_path('lang'))
|
||||
->in(base_path('routes'))
|
||||
->in(base_path('tests'))
|
||||
->in(base_path('Blacklight'))
|
||||
->in(base_path('misc'))
|
||||
)
|
||||
->setRules([
|
||||
'@Laravel' => true,
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
require __DIR__.'/bootstrap/app.php';
|
||||
|
||||
return (new MattAllan\LaravelCodeStyle\Config())
|
||||
->setFinder(
|
||||
PhpCsFixer\Finder::create()
|
||||
->in(app_path())
|
||||
->in(config_path())
|
||||
->in(database_path())
|
||||
->notPath(database_path('migrations'))
|
||||
->in(resource_path('lang'))
|
||||
->in(base_path('routes'))
|
||||
->in(base_path('tests'))
|
||||
->in(base_path('Blacklight'))
|
||||
->in(base_path('misc'))
|
||||
)
|
||||
->setRules([
|
||||
'@Laravel' => true,
|
||||
]);
|
||||
+77
-72
@@ -550,7 +550,7 @@ class Categorize
|
||||
switch (true) {
|
||||
case $this->categorizeForeign && $this->isMusicForeign():
|
||||
break;
|
||||
case preg_match('/720p|[\-._ ]mkv/i', $this->releaseName):
|
||||
case preg_match('/720p|[._ -]mkv/i', $this->releaseName):
|
||||
$this->tmpCat = Category::MUSIC_VIDEO;
|
||||
$this->tmpTag[] = Category::TAG_MUSIC_VIDEO;
|
||||
break;
|
||||
@@ -597,7 +597,7 @@ class Categorize
|
||||
switch (true) {
|
||||
case $this->categorizeForeign && $this->isMusicForeign():
|
||||
break;
|
||||
case ! preg_match('/[\-._ ]scans[\-._ ]/i', $this->releaseName):
|
||||
case ! preg_match('/[._ -]scans[._ -]/i', $this->releaseName):
|
||||
$this->tmpCat = Category::MUSIC_MP3;
|
||||
$this->tmpTag[] = Category::TAG_MUSIC_MP3;
|
||||
break;
|
||||
@@ -685,8 +685,8 @@ class Categorize
|
||||
*/
|
||||
public function isTV(): bool
|
||||
{
|
||||
if (preg_match('/Daily[\-_\.]Show|Nightly News|^\[[a-zA-Z\.\-]+\].*[\-_].*\d{1,3}[\-_. ](([\[\(])(h264-)?\d{3,4}([pi])([\]\)])\s?(\[AAC\])?|\[[a-fA-F0-9]{8}\]|(8|10)BIT|hi10p)(\[[a-fA-F0-9]{8}\])?|(\d\d-){2}[12]\d{3}|[12]\d{3}(\.\d\d){2}|\d+x\d+|\.e\d{1,3}\.|s\d{1,3}[\-._ ]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])|[\-._ ](\dx\d\d|C4TV|Complete[\-._ ]Season|DSR|([DHPS])DTV|EP[\-._ ]?\d{1,3}|S\d{1,3}.+Extras|SUBPACK|Season[\-._ ]\d{1,2})([\-._ ]|$)|TVRIP|TV[\-._ ](19|20)\d\d|Troll(HD|UHD)/i', $this->releaseName)
|
||||
&& ! preg_match('/[\-._ ](flac|imageset|mp3|xxx)[\-._ ]|[ .]exe$/i', $this->releaseName)) {
|
||||
if (preg_match('/Daily[\-_\.]Show|Nightly News|^\[[a-zA-Z\.\-]+\].*[\-_].*\d{1,3}[\-_. ](([\[\(])(h264-)?\d{3,4}([pi])([\]\)])\s?(\[AAC\])?|\[[a-fA-F0-9]{8}\]|(8|10)BIT|hi10p)(\[[a-fA-F0-9]{8}\])?|(\d\d-){2}[12]\d{3}|[12]\d{3}(\.\d\d){2}|\d+x\d+|\.e\d{1,3}\.|s\d{1,3}[._ -]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])|[._ -](\dx\d\d|C4TV|Complete[._ -]Season|DSR|([DHPS])DTV|EP[._ -]?\d{1,3}|S\d{1,3}.+Extras|SUBPACK|Season[._ -]\d{1,2})([._ -]|$)|TVRIP|TV[._ -](19|20)\d\d|Troll(HD|UHD)/i', $this->releaseName)
|
||||
&& ! preg_match('/[._ -](flac|imageset|mp3|xxx)[._ -]|[ .]exe$/i', $this->releaseName)) {
|
||||
switch (true) {
|
||||
case $this->isOtherTV():
|
||||
case $this->categorizeForeign && $this->isForeignTV():
|
||||
@@ -708,7 +708,7 @@ class Categorize
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/[\-._ ]((19|20)\d\d[\-._ ]\d{1,2}[\-._ ]\d{1,2}[\-._ ]VHSRip|Indy[\-._ ]?Car|(iMPACT|Smoky[\-._ ]Mountain|Texas)[\-._ ]Wrestling|Moto[\-._ ]?GP|NSCS[\-._ ]ROUND|NECW[\-._ ]TV|(Per|Post)\-Show|PPV|WrestleMania|WCW|WEB[\-._ ]HD|WWE[\-._ ](Monday|NXT|RAW|Smackdown|Superstars|WrestleMania))[\-._ ]/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -]((19|20)\d\d[._ -]\d{1,2}[._ -]\d{1,2}[._ -]VHSRip|Indy[._ -]?Car|(iMPACT|Smoky[._ -]Mountain|Texas)[._ -]Wrestling|Moto[._ -]?GP|NSCS[._ -]ROUND|NECW[._ -]TV|(Per|Post)\-Show|PPV|WrestleMania|WCW|WEB[._ -]HD|WWE[._ -](Monday|NXT|RAW|Smackdown|Superstars|WrestleMania))[._ -]/i', $this->releaseName)) {
|
||||
if ($this->isSportTV()) {
|
||||
return true;
|
||||
}
|
||||
@@ -726,9 +726,9 @@ class Categorize
|
||||
*/
|
||||
public function isOtherTV(): bool
|
||||
{
|
||||
if (preg_match('/[\-._ ]S\d{1,3}.+(EP\d{1,3}|Extras|SUBPACK)[\-._ ]|News/i', $this->releaseName)
|
||||
if (preg_match('/[._ -]S\d{1,3}.+(EP\d{1,3}|Extras|SUBPACK)[._ -]|News/i', $this->releaseName)
|
||||
//special case for "Have.I.Got.News.For.You" tv show
|
||||
&& ! preg_match('/[\-._ ]Got[\-._ ]News[\-._ ]For[\-._ ]You/i', $this->releaseName)
|
||||
&& ! preg_match('/[._ -]Got[._ -]News[._ -]For[._ -]You/i', $this->releaseName)
|
||||
) {
|
||||
$this->tmpCat = Category::TV_OTHER;
|
||||
$this->tmpTag[] = Category::TAG_TV_OTHER;
|
||||
@@ -745,13 +745,13 @@ class Categorize
|
||||
public function isForeignTV(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/[\-._ ](NHL|stanley.+cup)[\-._ ]/', $this->releaseName):
|
||||
case preg_match('/[._ -](NHL|stanley.+cup)[._ -]/', $this->releaseName):
|
||||
return false;
|
||||
case preg_match('/[\-._ ](chinese|dk|fin|french|ger?|heb|ita|jap|kor|nor|nordic|nl|pl|swe)[\-._ ]?(sub|dub)(ed|bed|s)?|<German>/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|ita|latin|mandarin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish).+(720p|1080p|Divx|DOKU|DUB(BED)?|DLMUX|NOVARIP|RealCo|Sub(bed|s)?|Web[\-._ ]?Rip|WS|Xvid|x264)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](720p|1080p|Divx|DOKU|DUB(BED)?|DLMUX|NOVARIP|RealCo|Sub(bed|s)?|Web[\-._ ]?Rip|WS|Xvid).+(brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|ita|latin|mandarin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/(S\d\d[EX]\d\d|DOCU(MENTAIRE)?|TV)?[\-._ ](FRENCH|German|Dutch)[\-._ ](720p|1080p|dv([bd])r(ip)?|LD|HD\-?TV|TV[\-._ ]?RIP|x264)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ]FastSUB|NL|nlvlaams|patrfa|RealCO|Seizoen|slosinh|Videomann|Vostfr|xslidian[\-._ ]|x264\-iZU/i', $this->releaseName):
|
||||
case preg_match('/[._ -](chinese|dk|fin|french|ger?|heb|ita|jap|kor|nor|nordic|nl|pl|swe)[._ -]?(sub|dub)(ed|bed|s)?|<German>/i', $this->releaseName):
|
||||
case preg_match('/[._ -](brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|ita|latin|mandarin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish).+(720p|1080p|Divx|DOKU|DUB(BED)?|DLMUX|NOVARIP|RealCo|Sub(bed|s)?|Web[._ -]?Rip|WS|Xvid|x264)[._ -]/i', $this->releaseName):
|
||||
case preg_match('/[._ -](720p|1080p|Divx|DOKU|DUB(BED)?|DLMUX|NOVARIP|RealCo|Sub(bed|s)?|Web[._ -]?Rip|WS|Xvid).+(brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|ita|latin|mandarin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)[._ -]/i', $this->releaseName):
|
||||
case preg_match('/(S\d\d[EX]\d\d|DOCU(MENTAIRE)?|TV)?[._ -](FRENCH|German|Dutch)[._ -](720p|1080p|dv([bd])r(ip)?|LD|HD\-?TV|TV[._ -]?RIP|x264)[._ -]/i', $this->releaseName):
|
||||
case preg_match('/[._ -]FastSUB|NL|nlvlaams|patrfa|RealCO|Seizoen|slosinh|Videomann|Vostfr|xslidian[._ -]|x264\-iZU/i', $this->releaseName):
|
||||
$this->tmpCat = Category::TV_FOREIGN;
|
||||
$this->tmpTag[] = Category::TAG_TV_FOREIGN;
|
||||
|
||||
@@ -767,13 +767,13 @@ class Categorize
|
||||
public function isSportTV(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/s\d{1,3}[\-._ ]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])/i', $this->releaseName):
|
||||
case preg_match('/s\d{1,3}[._ -]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])/i', $this->releaseName):
|
||||
return false;
|
||||
case preg_match('/[\-._ ]?(Bellator|bundesliga|EPL|ESPN|FIA|la[\-._ ]liga|MMA|motogp|NFL|MLB|NCAA|PGA|FIM|NJPW|red[\-._ ]bull|.+race|Sengoku|Strikeforce|supercup|uefa|UFC|wtcc|WWE)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ]?(DTM|FIFA|formula[\-._ ]1|indycar|Rugby|NASCAR|NBA|NHL|NRL|netball[\-._ ]anz|ROH|SBK|Superleague|The[\-._ ]Ultimate[\-._ ]Fighter|TNA|V8[\-._ ]Supercars|WBA|WrestleMania)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ]?(AFL|Grand Prix|Indy[\-._ ]Car|(iMPACT|Smoky[\-._ ]Mountain|Texas)[\-._ ]Wrestling|Moto[\-._ ]?GP|NSCS[\-._ ]ROUND|NECW|Poker|PWX|Rugby|WCW)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ]?(Horse)[\-._ ]Racing[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](VERUM|GRiP|Ebi|OVERTAKE)/i', $this->releaseName):
|
||||
case preg_match('/[._ -]?(Bellator|bundesliga|EPL|ESPN|FIA|la[._ -]liga|MMA|motogp|NFL|MLB|NCAA|PGA|FIM|NJPW|red[._ -]bull|.+race|Sengoku|Strikeforce|supercup|uefa|UFC|wtcc|WWE)[._ -]/i', $this->releaseName):
|
||||
case preg_match('/[._ -]?(DTM|FIFA|formula[._ -]1|indycar|Rugby|NASCAR|NBA|NHL|NRL|netball[._ -]anz|ROH|SBK|Superleague|The[._ -]Ultimate[._ -]Fighter|TNA|V8[._ -]Supercars|WBA|WrestleMania)[._ -]/i', $this->releaseName):
|
||||
case preg_match('/[._ -]?(AFL|Grand Prix|Indy[._ -]Car|(iMPACT|Smoky[._ -]Mountain|Texas)[._ -]Wrestling|Moto[._ -]?GP|NSCS[._ -]ROUND|NECW|Poker|PWX|Rugby|WCW)[._ -]/i', $this->releaseName):
|
||||
case preg_match('/[._ -]?(Horse)[._ -]Racing[._ -]/i', $this->releaseName):
|
||||
case preg_match('/[._ -](VERUM|GRiP|Ebi|OVERTAKE)/i', $this->releaseName):
|
||||
$this->tmpCat = Category::TV_SPORT;
|
||||
$this->tmpTag[] = Category::TAG_TV_SPORT;
|
||||
|
||||
@@ -788,7 +788,7 @@ class Categorize
|
||||
*/
|
||||
public function isDocumentaryTV(): bool
|
||||
{
|
||||
if (preg_match('/[\-._ ](Docu|Documentary)[\-._ ]/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -](Docu|Documentary)[._ -]/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::TV_DOCU;
|
||||
$this->tmpTag[] = Category::TAG_TV_DOCU;
|
||||
|
||||
@@ -803,7 +803,7 @@ class Categorize
|
||||
*/
|
||||
public function isWEBDL(): bool
|
||||
{
|
||||
if (preg_match('/web[\-._ ]dl|web-?rip/i', $this->releaseName)) {
|
||||
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::TV_WEBDL;
|
||||
$this->tmpTag = [Category::TAG_TV_WEBDL, Category::TAG_TV_HD];
|
||||
|
||||
@@ -818,7 +818,7 @@ class Categorize
|
||||
*/
|
||||
public function isAnimeTV(): bool
|
||||
{
|
||||
if (preg_match('/[\-._ ]Anime[\-._ ]|^\[[a-zA-Z\.\-]+\].*[\-_].*\d{1,3}[\-_. ](([\[\(])((\d{1,4}x\d{1,4})|(h264-)?\d{3,4}([pi]))([\]\)])\s?(\[AAC\])?|\[[a-fA-F0-9]{8}\]|(8|10)BIT|hi10p)(\[[a-fA-F0-9]{8}\])?/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -]Anime[._ -]|^\[[a-zA-Z\.\-]+\].*[\-_].*\d{1,3}[\-_. ](([\[\(])((\d{1,4}x\d{1,4})|(h264-)?\d{3,4}([pi]))([\]\)])\s?(\[AAC\])?|\[[a-fA-F0-9]{8}\]|(8|10)BIT|hi10p)(\[[a-fA-F0-9]{8}\])?/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::TV_ANIME;
|
||||
$this->tmpTag[] = Category::TAG_TV_ANIME;
|
||||
|
||||
@@ -845,7 +845,7 @@ class Categorize
|
||||
|
||||
return true;
|
||||
}
|
||||
if ($this->catWebDL === false && preg_match('/web[\-._ ]dl|web-?rip/i', $this->releaseName)) {
|
||||
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::TV_HD;
|
||||
$this->tmpTag[] = Category::TAG_TV_HD;
|
||||
|
||||
@@ -876,9 +876,9 @@ class Categorize
|
||||
public function isSDTV(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/(360|480|576)p|Complete[\-._ ]Season|dvdr(ip)?|dvd5|dvd9|\.pdtv|SD[\-._ ]TV|TVRip|NTSC|BDRip|hdtv|xvid/i', $this->releaseName):
|
||||
case preg_match('/(([HP])D[\-._ ]?TV|DSR|WebRip)[\-._ ]x264/i', $this->releaseName):
|
||||
case preg_match('/s\d{1,3}[\-._ ]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])|\s\d{3,4}\s/i', $this->releaseName) && preg_match('/([HP])D[\-._ ]?TV|BDRip|WEB[\-._ ]x264/i', $this->releaseName):
|
||||
case preg_match('/(360|480|576)p|Complete[._ -]Season|dvdr(ip)?|dvd5|dvd9|\.pdtv|SD[._ -]TV|TVRip|NTSC|BDRip|hdtv|xvid/i', $this->releaseName):
|
||||
case preg_match('/(([HP])D[._ -]?TV|DSR|WebRip)[._ -]x264/i', $this->releaseName):
|
||||
case preg_match('/s\d{1,3}[._ -]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])|\s\d{3,4}\s/i', $this->releaseName) && preg_match('/([HP])D[._ -]?TV|BDRip|WEB[._ -]x264/i', $this->releaseName):
|
||||
$this->tmpCat = Category::TV_SD;
|
||||
$this->tmpTag[] = Category::TAG_TV_SD;
|
||||
|
||||
@@ -893,7 +893,7 @@ class Categorize
|
||||
*/
|
||||
public function isOtherTV2(): bool
|
||||
{
|
||||
if (preg_match('/[\-._ ]s\d{1,3}[\-._ ]?(e|d(isc)?)\d{1,3}([\-._ ]|$)/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -]s\d{1,3}[._ -]?(e|d(isc)?)\d{1,3}([._ -]|$)/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::TV_OTHER;
|
||||
$this->tmpTag[] = Category::TAG_TV_OTHER;
|
||||
|
||||
@@ -925,7 +925,7 @@ class Categorize
|
||||
*/
|
||||
public function isMovie(): bool
|
||||
{
|
||||
if (preg_match('/[\-._ ]AVC|[\-._ ]|[BH][DR]RIP|Bluray|BD[\-._ ]?(25|50)?|\bBR\b|Camrip|[\-._ ]\d{4}[\-._ ].+(720p|1080p|Cam|HDTS)|DIVX|[\-._ ]DVD[\-._ ]|DVD-?(5|9|R|Rip)|Untouched|VHSRip|XVID|[\-._ ](DTS|TVrip)[\-._ ]/i', $this->releaseName) && ! preg_match('/auto(cad|desk)|divx[\-._ ]plus|[\-._ ]exe$|[\-._ ](jav|XXX)[\-._ ]|SWE6RUS|\wXXX(1080p|720p|DVD)|Xilisoft/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -]AVC|[._ -]|[BH][DR]RIP|Bluray|BD[._ -]?(25|50)?|\bBR\b|Camrip|[._ -]\d{4}[._ -].+(720p|1080p|Cam|HDTS)|DIVX|[._ -]DVD[._ -]|DVD-?(5|9|R|Rip)|Untouched|VHSRip|XVID|[._ -](DTS|TVrip)[._ -]/i', $this->releaseName) && ! preg_match('/auto(cad|desk)|divx[._ -]plus|[._ -]exe$|[._ -](jav|XXX)[._ -]|SWE6RUS|\wXXX(1080p|720p|DVD)|Xilisoft/i', $this->releaseName)) {
|
||||
switch (true) {
|
||||
case $this->categorizeForeign && $this->isMovieForeign():
|
||||
case $this->isMovieDVD():
|
||||
@@ -954,9 +954,9 @@ class Categorize
|
||||
switch (true) {
|
||||
case $this->isConsole():
|
||||
return true;
|
||||
case preg_match('/(danish|flemish|Deutsch|dutch|french|german|heb|hebrew|nl[\-._ ]?sub|dub(bed|s)?|\.NL|norwegian|swedish|swesub|spanish|Staffel)[\-._ ]|\(german\)|Multisub/i', $this->releaseName):
|
||||
case preg_match('/(danish|flemish|Deutsch|dutch|french|german|heb|hebrew|nl[._ -]?sub|dub(bed|s)?|\.NL|norwegian|swedish|swesub|spanish|Staffel)[._ -]|\(german\)|Multisub/i', $this->releaseName):
|
||||
case stripos($this->releaseName, 'Castellano') !== false:
|
||||
case preg_match('/(720p|1080p|AC3|AVC|DIVX|DVD(5|9|RIP|R)|XVID)[\-._ ](Dutch|French|German|ITA)|\(?(Dutch|French|German|ITA)\)?[\-._ ](720P|1080p|AC3|AVC|DIVX|DVD(5|9|RIP|R)|HD[\-._ ]|XVID)/i', $this->releaseName):
|
||||
case preg_match('/(720p|1080p|AC3|AVC|DIVX|DVD(5|9|RIP|R)|XVID)[._ -](Dutch|French|German|ITA)|\(?(Dutch|French|German|ITA)\)?[._ -](720P|1080p|AC3|AVC|DIVX|DVD(5|9|RIP|R)|HD[._ -]|XVID)/i', $this->releaseName):
|
||||
$this->tmpCat = Category::MOVIE_FOREIGN;
|
||||
$this->tmpTag[] = Category::TAG_MOVIE_FOREIGN;
|
||||
|
||||
@@ -971,7 +971,7 @@ class Categorize
|
||||
*/
|
||||
public function isMovieDVD(): bool
|
||||
{
|
||||
if (preg_match('/(dvd\-?r|[\-._ ]dvd|dvd9|dvd5|[\-._ ]r5)[\-._ ]/i', $this->releaseName)) {
|
||||
if (preg_match('/(dvd\-?r|[._ -]dvd|dvd9|dvd5|[._ -]r5)[._ -]/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MOVIE_DVD;
|
||||
$this->tmpTag[] = Category::TAG_MOVIE_DVD;
|
||||
|
||||
@@ -986,7 +986,7 @@ class Categorize
|
||||
*/
|
||||
public function isMovieSD(): bool
|
||||
{
|
||||
if (preg_match('/(divx|dvdscr|extrascene|dvdrip|\.CAM|HDTS(-LINE)?|vhsrip|xvid(vd)?)[\-._ ]/i', $this->releaseName)) {
|
||||
if (preg_match('/(divx|dvdscr|extrascene|dvdrip|\.CAM|HDTS(-LINE)?|vhsrip|xvid(vd)?)[._ -]/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MOVIE_SD;
|
||||
$this->tmpTag[] = Category::TAG_MOVIE_SD;
|
||||
|
||||
@@ -1001,7 +1001,7 @@ class Categorize
|
||||
*/
|
||||
public function isMovie3D(): bool
|
||||
{
|
||||
if (preg_match('/[\-._ ]3D\s?[\.\-_\[ ](1080p|(19|20)\d\d|AVC|BD(25|50)|Blu[\-._ ]?ray|CEE|Complete|GER|MVC|MULTi|SBS|H(-)?SBS)[\-._ ]/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -]3D\s?[\.\-_\[ ](1080p|(19|20)\d\d|AVC|BD(25|50)|Blu[._ -]?ray|CEE|Complete|GER|MVC|MULTi|SBS|H(-)?SBS)[._ -]/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MOVIE_3D;
|
||||
$this->tmpTag[] = Category::TAG_MOVIE_3D;
|
||||
|
||||
@@ -1016,7 +1016,7 @@ class Categorize
|
||||
*/
|
||||
public function isMovieBluRay(): bool
|
||||
{
|
||||
if (preg_match('/bluray\-|[\-._ ]bd?[\-._ ]?(25|50)|blu-ray|Bluray\s\-\sUntouched|[\-._ ]untouched[\-._ ]/i', $this->releaseName)
|
||||
if (preg_match('/bluray\-|[._ -]bd?[._ -]?(25|50)|blu-ray|Bluray\s\-\sUntouched|[._ -]untouched[._ -]/i', $this->releaseName)
|
||||
&& ! preg_match('/SecretUsenet\.com/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MOVIE_BLURAY;
|
||||
$this->tmpTag[] = Category::TAG_MOVIE_BLURAY;
|
||||
@@ -1038,7 +1038,7 @@ class Categorize
|
||||
|
||||
return true;
|
||||
}
|
||||
if ($this->catWebDL === false && preg_match('/web[\-._ ]dl|web-?rip/i', $this->releaseName)) {
|
||||
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MOVIE_HD;
|
||||
$this->tmpTag[] = Category::TAG_MOVIE_HD;
|
||||
|
||||
@@ -1068,7 +1068,7 @@ class Categorize
|
||||
*/
|
||||
public function isMovieOther(): bool
|
||||
{
|
||||
if (preg_match('/[\-._ ]cam[\-._ ]/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -]cam[._ -]/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MOVIE_OTHER;
|
||||
$this->tmpTag[] = Category::TAG_MOVIE_OTHER;
|
||||
|
||||
@@ -1083,7 +1083,7 @@ class Categorize
|
||||
*/
|
||||
public function isMovieWEBDL(): bool
|
||||
{
|
||||
if (preg_match('/web[\-._ ]dl|web-?rip/i', $this->releaseName)) {
|
||||
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::MOVIE_WEBDL;
|
||||
$this->tmpTag = [Category::TAG_MOVIE_WEBDL, Category::TAG_MOVIE_HD];
|
||||
|
||||
@@ -1116,7 +1116,7 @@ class Categorize
|
||||
public function isPC(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/s\d{1,3}[\-._ ]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])|[^a-z0-9](FLAC|Imageset|PICTURESET|MP3|Nintendo|PDTV|PS[23P]|SWE6RUS|UMD(RIP)?|WII|x264|XBOX(360|DVD|ONE)?|XXX)[^a-z0-9]/i', $this->releaseName):
|
||||
case preg_match('/s\d{1,3}[._ -]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])|[^a-z0-9](FLAC|Imageset|PICTURESET|MP3|Nintendo|PDTV|PS[23P]|SWE6RUS|UMD(RIP)?|WII|x264|XBOX(360|DVD|ONE)?|XXX)[^a-z0-9]/i', $this->releaseName):
|
||||
return false;
|
||||
case $this->isPhone():
|
||||
case $this->isMac():
|
||||
@@ -1135,15 +1135,15 @@ class Categorize
|
||||
public function isPhone(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/[^a-z0-9](IPHONE|ITOUCH|IPAD)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[^a-z0-9](IPHONE|ITOUCH|IPAD)[._ -]/i', $this->releaseName):
|
||||
$this->tmpCat = Category::PC_PHONE_IOS;
|
||||
$this->tmpTag[] = Category::TAG_PC_PHONE_IOS;
|
||||
break;
|
||||
case preg_match('/[\-._ ]?(ANDROID)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[._ -]?(ANDROID)[._ -]/i', $this->releaseName):
|
||||
$this->tmpCat = Category::PC_PHONE_ANDROID;
|
||||
$this->tmpTag[] = Category::TAG_PC_PHONE_ANDROID;
|
||||
break;
|
||||
case preg_match('/[^a-z0-9](symbian|xscale|wm5|wm6)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[^a-z0-9](symbian|xscale|wm5|wm6)[._ -]/i', $this->releaseName):
|
||||
$this->tmpCat = Category::PC_PHONE_OTHER;
|
||||
$this->tmpTag[] = Category::TAG_PC_PHONE_OTHER;
|
||||
break;
|
||||
@@ -1160,8 +1160,8 @@ class Categorize
|
||||
public function isISO(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/[\-._ ]([a-zA-Z]{2,10})?iso[ _.-]|[\-. ]([a-z]{2,10})?iso$/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](DYNAMiCS|INFINITESKILLS|UDEMY|kEISO|PLURALSIGHT|DIGITALTUTORS|TUTSPLUS|OSTraining|PRODEV|CBT\.Nuggets|COMPRISED)/i', $this->releaseName):
|
||||
case preg_match('/[._ -]([a-zA-Z]{2,10})?iso[ _.-]|[\-. ]([a-z]{2,10})?iso$/i', $this->releaseName):
|
||||
case preg_match('/[._ -](DYNAMiCS|INFINITESKILLS|UDEMY|kEISO|PLURALSIGHT|DIGITALTUTORS|TUTSPLUS|OSTraining|PRODEV|CBT\.Nuggets|COMPRISED)/i', $this->releaseName):
|
||||
$this->tmpCat = Category::PC_ISO;
|
||||
$this->tmpTag[] = Category::TAG_PC_ISO;
|
||||
|
||||
@@ -1177,9 +1177,9 @@ class Categorize
|
||||
public function is0day(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/[\-._ ]exe$|[\-._ ](utorrent|Virtualbox)[\-._ ]|\b0DAY\b|incl.+crack| DRM$|>DRM</i', $this->releaseName):
|
||||
case preg_match('/[\-._ ]((32|64)bit|converter|i\d86|key(gen|maker)|freebsd|GAMEGUiDE|hpux|irix|linux|multilingual|Patch|Pro v\d{1,3}|portable|regged|software|solaris|template|unix|win2kxp2k3|win64|win(2k|32|64|all|dows|nt(2k)?(xp)?|xp)|win9x(me|nt)?|x(32|64|86))[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/\b(Adobe|auto(cad|desk)|-BEAN|Cracked|Cucusoft|CYGNUS|Divx[\-._ ]Plus|\.(deb|exe)|DIGERATI|FOSI|-FONT|Key(filemaker|gen|maker)|Lynda\.com|lz0|MULTiLANGUAGE|Microsoft\s*(Office|Windows|Server)|MultiOS|-(iNViSiBLE|SPYRAL|SUNiSO|UNION|TE)|v\d{1,3}.*?Pro|[\-._ ]v\d{1,3}[\-._ ]|\(x(64|86)\)|Xilisoft)\b/i', $this->releaseName):
|
||||
case preg_match('/[._ -]exe$|[._ -](utorrent|Virtualbox)[._ -]|\b0DAY\b|incl.+crack| DRM$|>DRM</i', $this->releaseName):
|
||||
case preg_match('/[._ -]((32|64)bit|converter|i\d86|key(gen|maker)|freebsd|GAMEGUiDE|hpux|irix|linux|multilingual|Patch|Pro v\d{1,3}|portable|regged|software|solaris|template|unix|win2kxp2k3|win64|win(2k|32|64|all|dows|nt(2k)?(xp)?|xp)|win9x(me|nt)?|x(32|64|86))[._ -]/i', $this->releaseName):
|
||||
case preg_match('/\b(Adobe|auto(cad|desk)|-BEAN|Cracked|Cucusoft|CYGNUS|Divx[._ -]Plus|\.(deb|exe)|DIGERATI|FOSI|-FONT|Key(filemaker|gen|maker)|Lynda\.com|lz0|MULTiLANGUAGE|Microsoft\s*(Office|Windows|Server)|MultiOS|-(iNViSiBLE|SPYRAL|SUNiSO|UNION|TE)|v\d{1,3}.*?Pro|[._ -]v\d{1,3}[._ -]|\(x(64|86)\)|Xilisoft)\b/i', $this->releaseName):
|
||||
$this->tmpCat = Category::PC_0DAY;
|
||||
$this->tmpTag[] = Category::TAG_PC_0DAY;
|
||||
|
||||
@@ -1194,7 +1194,7 @@ class Categorize
|
||||
*/
|
||||
public function isMac(): bool
|
||||
{
|
||||
if (preg_match('/(\b|[\-._ ])mac([\.\s])?osx(\b|[\-_. ])/i', $this->releaseName)) {
|
||||
if (preg_match('/(\b|[._ -])mac([\.\s])?osx(\b|[\-_. ])/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::PC_MAC;
|
||||
$this->tmpTag[] = Category::TAG_PC_MAC;
|
||||
|
||||
@@ -1209,7 +1209,7 @@ class Categorize
|
||||
*/
|
||||
public function isPCGame(): bool
|
||||
{
|
||||
if (preg_match('/[^a-z0-9](0x0007|ALiAS|BACKLASH|BAT|CLONECD|CPY|FAS(DOX|iSO)|FLT([\-._ ]|COGENT)|FLT(DOX)?|PC GAMES?|\(?(Game([sz])|GAME([SZ]))\)? ?(\(([Cc])\))|GENESIS|-GOG|-HATRED|HI2U|INLAWS|JAGUAR|MAZE|MONEY|OUTLAWS|PPTCLASSiCS|PC Game|PROPHET|RAiN|Razor1911|RELOADED|DEViANCE|PLAZA|RiTUELYPOGEiOS|[rR][iI][pP]-[uU][nN][lL][eE][aA][sS][hH][eE][dD]|Steam(\b)?Rip|SKIDROW|TiNYiSO|CODEX|SiMPLEX)[^a-z0-9]?/', $this->releaseName)) {
|
||||
if (preg_match('/[^a-z0-9](0x0007|ALiAS|BACKLASH|BAT|CLONECD|CPY|FAS(DOX|iSO)|FLT([._ -]|COGENT)|FLT(DOX)?|PC GAMES?|\(?(Game([sz])|GAME([SZ]))\)? ?(\(([Cc])\))|GENESIS|-GOG|-HATRED|HI2U|INLAWS|JAGUAR|MAZE|MONEY|OUTLAWS|PPTCLASSiCS|PC Game|PROPHET|RAiN|Razor1911|RELOADED|DEViANCE|PLAZA|RiTUELYPOGEiOS|[rR][iI][pP]-[uU][nN][lL][eE][aA][sS][hH][eE][dD]|Steam(\b)?Rip|SKIDROW|TiNYiSO|CODEX|SiMPLEX)[^a-z0-9]?/', $this->releaseName)) {
|
||||
$this->tmpCat = Category::PC_GAMES;
|
||||
$this->tmpTag[] = Category::TAG_PC_GAMES;
|
||||
|
||||
@@ -1266,7 +1266,7 @@ class Categorize
|
||||
|
||||
return true;
|
||||
}
|
||||
if ($this->catWebDL === false && preg_match('/web[\-._ ]dl|web-?rip/i', $this->releaseName)) {
|
||||
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::XXX_X264;
|
||||
$this->tmpTag[] = Category::TAG_XXX_X264;
|
||||
|
||||
@@ -1281,7 +1281,7 @@ class Categorize
|
||||
*/
|
||||
public function isXxxUHD(): bool
|
||||
{
|
||||
if (preg_match('/^[\w\-.]+(\d{2}\.\d{2}\.\d{2}).+(2160p)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG))/i', $this->releaseName)) {
|
||||
if (preg_match('/XXX.+(2160p)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG))/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::XXX_UHD;
|
||||
$this->tmpTag[] = Category::TAG_XXX_UHD;
|
||||
|
||||
@@ -1387,7 +1387,7 @@ class Categorize
|
||||
public function isXxxOther(): bool
|
||||
{
|
||||
// If nothing else matches, then try these words.
|
||||
if (preg_match('/[\-._ ]Brazzers|Creampie|[\-._ ]JAV[\-._ ]|North\.Pole|^Nubiles|She[\-._ ]?Male|Transsexual|OLDER ANGELS/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -]Brazzers|Creampie|[._ -]JAV[._ -]|North\.Pole|^Nubiles|She[._ -]?Male|Transsexual|OLDER ANGELS/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::XXX_OTHER;
|
||||
$this->tmpTag[] = Category::TAG_XXX_OTHER;
|
||||
|
||||
@@ -1413,6 +1413,11 @@ class Categorize
|
||||
$this->tmpCat = Category::XXX_CLIPSD;
|
||||
$this->tmpTag[] = Category::TAG_XXX_CLIPSD;
|
||||
|
||||
return true;
|
||||
case preg_match('/(iPT\sTeam|KLEENEX)/i', $this->releaseName):
|
||||
$this->tmpCat = Category::XXX_CLIPSD;
|
||||
$this->tmpTag[] = Category::TAG_XXX_CLIPSD;
|
||||
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -1439,7 +1444,7 @@ class Categorize
|
||||
*/
|
||||
public function isXxxWEBDL(): bool
|
||||
{
|
||||
if (preg_match('/web[\-._ ]dl|web-?rip/i', $this->releaseName)) {
|
||||
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::XXX_WEBDL;
|
||||
$this->tmpTag[] = Category::TAG_XXX_WEBDL;
|
||||
|
||||
@@ -1591,13 +1596,13 @@ class Categorize
|
||||
public function isGamePSP(): bool
|
||||
{
|
||||
if (stripos($this->releaseName, 'PSP') !== false) {
|
||||
if (preg_match('/[\-._ ](BAHAMUT|Caravan|EBOOT|EMiNENT|EUR?|EvoX|GAME|GHS|Googlecus|HandHeld|\-HR|JAP|JPN|KLOTEKLAPPERS|KOR|NTSC|PAL)/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -](BAHAMUT|Caravan|EBOOT|EMiNENT|EUR?|EvoX|GAME|GHS|Googlecus|HandHeld|\-HR|JAP|JPN|KLOTEKLAPPERS|KOR|NTSC|PAL)/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::GAME_PSP;
|
||||
$this->tmpTag[] = Category::TAG_GAME_PSP;
|
||||
|
||||
return true;
|
||||
}
|
||||
if (preg_match('/[\-._ ](Dynarox|HAZARD|ITALIAN|KLB|KuDoS|LIGHTFORCE|MiRiBS|POPSTATiON|(PLAY)?ASiA|PSN|PSX2?PSP|SPANiSH|SUXXORS|UMD(RIP)?|USA?|YARR)/i', $this->releaseName)) {
|
||||
if (preg_match('/[._ -](Dynarox|HAZARD|ITALIAN|KLB|KuDoS|LIGHTFORCE|MiRiBS|POPSTATiON|(PLAY)?ASiA|PSN|PSX2?PSP|SPANiSH|SUXXORS|UMD(RIP)?|USA?|YARR)/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::GAME_PSP;
|
||||
$this->tmpTag[] = Category::TAG_GAME_PSP;
|
||||
|
||||
@@ -1628,7 +1633,7 @@ class Categorize
|
||||
*/
|
||||
public function isGameWiiWare(): bool
|
||||
{
|
||||
if (preg_match('/(Console|DLC|VC).+[\-._ ]WII|(Console|DLC|VC)[\-._ ]WII|WII[\-._ ].+(Console|DLC|VC)|WII[\-._ ](Console|DLC|VC)|WIIWARE/i', $this->releaseName)) {
|
||||
if (preg_match('/(Console|DLC|VC).+[._ -]WII|(Console|DLC|VC)[._ -]WII|WII[._ -].+(Console|DLC|VC)|WII[._ -](Console|DLC|VC)|WIIWARE/i', $this->releaseName)) {
|
||||
$this->tmpCat = Category::GAME_WIIWARE;
|
||||
$this->tmpTag[] = Category::TAG_GAME_WIIWARE;
|
||||
|
||||
@@ -1646,9 +1651,9 @@ class Categorize
|
||||
switch (true) {
|
||||
case ! preg_match('/WII-?U/i', $this->releaseName):
|
||||
return false;
|
||||
case preg_match('/[\-._ ](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)/i', $this->releaseName):
|
||||
case preg_match('/[._ -](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)/i', $this->releaseName):
|
||||
case preg_match('/[._ -](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)/i', $this->releaseName):
|
||||
case preg_match('/[._ -](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)/i', $this->releaseName):
|
||||
$this->tmpCat = Category::GAME_WIIU;
|
||||
$this->tmpTag[] = Category::TAG_GAME_WIIU;
|
||||
|
||||
@@ -1666,9 +1671,9 @@ class Categorize
|
||||
switch (true) {
|
||||
case stripos($this->releaseName, 'WII') === false:
|
||||
return false;
|
||||
case preg_match('/[\-._ ](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)/i', $this->releaseName):
|
||||
case preg_match('/[\-._ ](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)/i', $this->releaseName):
|
||||
case preg_match('/[._ -](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)/i', $this->releaseName):
|
||||
case preg_match('/[._ -](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)/i', $this->releaseName):
|
||||
case preg_match('/[._ -](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)/i', $this->releaseName):
|
||||
$this->tmpCat = Category::GAME_WII;
|
||||
$this->tmpTag[] = Category::TAG_GAME_WII;
|
||||
|
||||
@@ -1851,7 +1856,7 @@ class Categorize
|
||||
*/
|
||||
public function isMusicLossless(): bool
|
||||
{
|
||||
if (preg_match('/\[(19|20)\d\d\][\-._ ]\[FLAC\]|([\(\[])flac([\)\]])|FLAC\-(19|20)\d\d\-[a-z0-9]{1,12}|\.flac"|(19|20)\d\d\sFLAC|[\-._ ]FLAC.+(19|20)\d\d[\-._ ]| FLAC$/i', $this->releaseName)) {
|
||||
if (preg_match('/\[(19|20)\d\d\][._ -]\[FLAC\]|([\(\[])flac([\)\]])|FLAC\-(19|20)\d\d\-[a-z0-9]{1,12}|\.flac"|(19|20)\d\d\sFLAC|[._ -]FLAC.+(19|20)\d\d[._ -]| FLAC$/i', $this->releaseName)) {
|
||||
if ($this->isMusicForeign()) {
|
||||
return true;
|
||||
}
|
||||
@@ -1869,7 +1874,7 @@ class Categorize
|
||||
*/
|
||||
public function isMusicMP3(): bool
|
||||
{
|
||||
if (preg_match('/[a-z0-9]{1,12}\-(19|20)\d\d\-[a-z0-9]{1,12}|[\.\-\(\[_ ]\d{2,3}k[\.\-\)\]_ ]|\((192|256|320)\)|(320|cd|eac|vbr).+mp3|(cd|eac|mp3|vbr).+320|FIH\_INT|\s\dCDs|[\-._ ]MP3[\-._ ]|MP3\-\d{3}kbps|\.(m3u|mp3)"|NMR\s\d{2,3}\skbps|\(320\)\.|\-\((Bootleg|Promo)\)|\.mp3$|\-\sMP3\s(19|20)\d\d|\(vbr\)|rip(192|256|320)|[\-._ ](CDR|SBD|WEB).+(19|20)\d\d/i', $this->releaseName)) {
|
||||
if (preg_match('/[a-z0-9]{1,12}\-(19|20)\d\d\-[a-z0-9]{1,12}|[\.\-\(\[_ ]\d{2,3}k[\.\-\)\]_ ]|\((192|256|320)\)|(320|cd|eac|vbr).+mp3|(cd|eac|mp3|vbr).+320|FIH\_INT|\s\dCDs|[._ -]MP3[._ -]|MP3\-\d{3}kbps|\.(m3u|mp3)"|NMR\s\d{2,3}\skbps|\(320\)\.|\-\((Bootleg|Promo)\)|\.mp3$|\-\sMP3\s(19|20)\d\d|\(vbr\)|rip(192|256|320)|[._ -](CDR|SBD|WEB).+(19|20)\d\d/i', $this->releaseName)) {
|
||||
if ($this->isMusicForeign()) {
|
||||
return true;
|
||||
}
|
||||
@@ -1878,7 +1883,7 @@ class Categorize
|
||||
|
||||
return true;
|
||||
}
|
||||
if (preg_match('/\s(19|20)\d\d\s([a-z0-9]{3}|[a-z]{2,})$|\-(19|20)\d\d\-(C4|MTD)([\s\.])|[\-._ ]FM.+MP3[\-._ ]|-web-(19|20)\d\d([\.\s$])|[\-._ ](SAT|SBD|WEB).+(19|20)\d\d([\-._ ]|$)|[\-._ ](19|20)\d\d.+(SAT|WEB)([\-._ ]|$)| MP3$/i', $this->releaseName)) {
|
||||
if (preg_match('/\s(19|20)\d\d\s([a-z0-9]{3}|[a-z]{2,})$|\-(19|20)\d\d\-(C4|MTD)([\s\.])|[._ -]FM.+MP3[._ -]|-web-(19|20)\d\d([\.\s$])|[._ -](SAT|SBD|WEB).+(19|20)\d\d([._ -]|$)|[._ -](19|20)\d\d.+(SAT|WEB)([._ -]|$)| MP3$/i', $this->releaseName)) {
|
||||
if ($this->isMusicForeign()) {
|
||||
return true;
|
||||
}
|
||||
@@ -1896,7 +1901,7 @@ class Categorize
|
||||
*/
|
||||
public function isMusicOther(): bool
|
||||
{
|
||||
if (preg_match('/(19|20)\d\d\-(C4)$|[\-._ ]\d?CD[\-._ ](19|20)\d\d|\(\d\-?CD\)|\-\dcd\-|\d[\-._ ]Albums|Albums.+(EP)|Bonus.+Tracks|Box.+?CD.+SET|Discography|D\.O\.M|Greatest\sSongs|Live.+(Bootleg|Remastered)|Music.+Vol|([\(\[\s])NMR([\)\]\s])|Promo.+CD|Reggaeton|Tiesto.+Club|Vinyl\s2496|\WV\.A\.|^\(VA\s|^VA[\-._ ]/i', $this->releaseName)) {
|
||||
if (preg_match('/(19|20)\d\d\-(C4)$|[._ -]\d?CD[._ -](19|20)\d\d|\(\d\-?CD\)|\-\dcd\-|\d[._ -]Albums|Albums.+(EP)|Bonus.+Tracks|Box.+?CD.+SET|Discography|D\.O\.M|Greatest\sSongs|Live.+(Bootleg|Remastered)|Music.+Vol|([\(\[\s])NMR([\)\]\s])|Promo.+CD|Reggaeton|Tiesto.+Club|Vinyl\s2496|\WV\.A\.|^\(VA\s|^VA[._ -]/i', $this->releaseName)) {
|
||||
if (true !== $this->isMusicForeign()) {
|
||||
$this->tmpCat = Category::MUSIC_OTHER;
|
||||
$this->tmpTag[] = Category::TAG_MUSIC_OTHER;
|
||||
@@ -1922,7 +1927,7 @@ class Categorize
|
||||
public function isBook(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/AVI[\-._ ]PDF|\.exe|Full[\-._ ]Video/i', $this->releaseName):
|
||||
case preg_match('/AVI[._ -]PDF|\.exe|Full[._ -]Video/i', $this->releaseName):
|
||||
return false;
|
||||
case $this->isComic():
|
||||
case $this->isTechnicalBook():
|
||||
@@ -1943,7 +1948,7 @@ class Categorize
|
||||
switch (true) {
|
||||
case $this->categorizeForeign === false:
|
||||
return false;
|
||||
case preg_match('/[ \-\._](brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|ita|latin|mandarin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)[\-._ ]/i', $this->releaseName):
|
||||
case preg_match('/[ \-\._](brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|ita|latin|mandarin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)[._ -]/i', $this->releaseName):
|
||||
$this->tmpCat = Category::BOOKS_FOREIGN;
|
||||
$this->tmpTag[] = Category::TAG_BOOKS_FOREIGN;
|
||||
|
||||
@@ -1959,7 +1964,7 @@ class Categorize
|
||||
public function isComic(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case ! preg_match('/[\. ](cbr|cbz)|[\( ]c2c|cbr|cbz[\) ]|comix|^\(comic|[\.\-_\(\[ ]comics?[\-._ ]|comic.+book|covers.+digital|DC.+(Adventures|Universe)|digital.+(son|zone)|Graphic.+Novel|[\.\-_h ]manga|Total[\-._ ]Marvel/i', $this->releaseName):
|
||||
case ! preg_match('/[\. ](cbr|cbz)|[\( ]c2c|cbr|cbz[\) ]|comix|^\(comic|[\.\-_\(\[ ]comics?[._ -]|comic.+book|covers.+digital|DC.+(Adventures|Universe)|digital.+(son|zone)|Graphic.+Novel|[\.\-_h ]manga|Total[._ -]Marvel/i', $this->releaseName):
|
||||
return false;
|
||||
case $this->isBookForeign():
|
||||
break;
|
||||
@@ -1978,7 +1983,7 @@ class Categorize
|
||||
public function isTechnicalBook(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case ! preg_match('/^\(?(atz|bb|css|c ?t|Drawing|Gabler|IOS|Iphone|Lynda|Manning|Medic(al|ine)|MIT|No[\-._ ]Starch|Packt|Peachpit|Pragmatic|Revista|Servo|SmartBooks|Spektrum|Strata|Sybex|Syngress|Vieweg|Wiley|Woods|Wrox)[\-._ ]|[\-._ ](Ajax|CSS|DIY|Javascript|(My|Postgre)?SQL|XNA)[\-._ ]|3DS\.\-_ ]Max|Academic|Adobe|Algebra|Analysis|Appleworks|Archaeology|Bitdefender|Birkhauser|Britannica|[\-._ ]C\+\+|C[\-._ ](\+\+|Sharp|Plus)|Chemistry|Circuits|Cook(book|ing)|(Beginners?|Complete|Communications|Definitive|Essential|Hackers?|Practical|Professionals?)[\-._ ]Guide|Developer|Diagnostic|Disassembl(er|ing|y)|Debugg(er|ing)|Dreamweaver|Economics|Education|Electronics|Enc([iy])clopedia|Engineer(ing|s)|Essays|Exercizes|For.+Beginners|Focal[\-._ ]Press|For[\-._ ]Dummies|FreeBSD|Fundamentals[\-._ ]of[\-._ ]|(Galileo|Island)[\-._ ]Press|Geography|Grammar|Guide[\-._ ](For|To)|Hacking|Google|Handboo?k|How[\-._ ](It|To)|Intoduction[\-._ ]to|Iphone|jQuery|Lessons[\-._ ]In|Learning|LibreOffice|Linux|Manual|Marketing|Masonry|Mathematic(al|s)?|Medical|Microsoft|National[\-._ ]Academies|Nero[\-._ ]\d+|OReilly|OS[\-._ ]X[\-._ ]|Official[\-._ ]Guide|Open(GL|Office)|Pediatric|Periodic.+Table|Photoshop|Physics|Power(PC|Point|Shell)|Programm(ers?|ier||ing)|Raspberry.+Pi|Remedies|Service\s?Manual|SitePoint|Sketching|Statistics|Stock.+Market|Students|Theory|Training|Tutsplus|Ubuntu|Understanding[\-._ ](and|Of|The)|Visual[\-._ ]Studio|Textbook|VMWare|wii?max|Windows[\-._ ](8|7|Vista|XP)|^Wood[\-._ ]|Woodwork|WordPress|Work(book|shop)|Youtube/i', $this->releaseName):
|
||||
case ! preg_match('/^\(?(atz|bb|css|c ?t|Drawing|Gabler|IOS|Iphone|Lynda|Manning|Medic(al|ine)|MIT|No[._ -]Starch|Packt|Peachpit|Pragmatic|Revista|Servo|SmartBooks|Spektrum|Strata|Sybex|Syngress|Vieweg|Wiley|Woods|Wrox)[._ -]|[._ -](Ajax|CSS|DIY|Javascript|(My|Postgre)?SQL|XNA)[._ -]|3DS\.\-_ ]Max|Academic|Adobe|Algebra|Analysis|Appleworks|Archaeology|Bitdefender|Birkhauser|Britannica|[._ -]C\+\+|C[._ -](\+\+|Sharp|Plus)|Chemistry|Circuits|Cook(book|ing)|(Beginners?|Complete|Communications|Definitive|Essential|Hackers?|Practical|Professionals?)[._ -]Guide|Developer|Diagnostic|Disassembl(er|ing|y)|Debugg(er|ing)|Dreamweaver|Economics|Education|Electronics|Enc([iy])clopedia|Engineer(ing|s)|Essays|Exercizes|For.+Beginners|Focal[._ -]Press|For[._ -]Dummies|FreeBSD|Fundamentals[._ -]of[._ -]|(Galileo|Island)[._ -]Press|Geography|Grammar|Guide[._ -](For|To)|Hacking|Google|Handboo?k|How[._ -](It|To)|Intoduction[._ -]to|Iphone|jQuery|Lessons[._ -]In|Learning|LibreOffice|Linux|Manual|Marketing|Masonry|Mathematic(al|s)?|Medical|Microsoft|National[._ -]Academies|Nero[._ -]\d+|OReilly|OS[._ -]X[._ -]|Official[._ -]Guide|Open(GL|Office)|Pediatric|Periodic.+Table|Photoshop|Physics|Power(PC|Point|Shell)|Programm(ers?|ier||ing)|Raspberry.+Pi|Remedies|Service\s?Manual|SitePoint|Sketching|Statistics|Stock.+Market|Students|Theory|Training|Tutsplus|Ubuntu|Understanding[._ -](and|Of|The)|Visual[._ -]Studio|Textbook|VMWare|wii?max|Windows[._ -](8|7|Vista|XP)|^Wood[._ -]|Woodwork|WordPress|Work(book|shop)|Youtube/i', $this->releaseName):
|
||||
return false;
|
||||
case $this->isBookForeign():
|
||||
break;
|
||||
@@ -1997,7 +2002,7 @@ class Categorize
|
||||
public function isMagazine(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case ! preg_match('/[a-z\-\._ ][\-._ ](January|February|March|April|May|June|July|August|September|October|November|December)[\-._ ](\d{1,2},)?20\d\d[\-._ ]|^\(.+[ .]\d{1,2}[ .]20\d\d[ .].+\.scr|[\-._ ](Catalogue|FHM|NUTS|Pictorial|Tatler|XXX)[\-._ ]|^\(?(Allehanda|Club|Computer([a-z0-9]+)?|Connect \d+|Corriere|ct|Diario|Digit(al)?|Esquire|FHM|Gadgets|Galileo|Glam|GQ|Infosat|Inked|Instyle|io|Kicker|Liberation|New Scientist|NGV|Nuts|Popular|Professional|Reise|Sette(tv)?|Springer|Stuff|Studentlitteratur|Vegetarian|Vegetable|Videomarkt|Wired)[\-._ ]|Brady(.+)?Games|Catalog|Columbus.+Dispatch|Correspondenten|Corriere[\-._ ]Della[\-._ ]Sera|Cosmopolitan|Dagbladet|Digital[\-._ ]Guide|Economist|Eload ?24|ExtraTime|Fatto[\-._ ]Quotidiano|Flight[\-._ ](International|Journal)|Finanzwoche|France.+Football|Foto.+Video|Games?(Master|Markt|tar|TM)|Gardening|Gazzetta|Globe[\-._ ]And[\-._ ]Mail|Guitar|Heimkino|Hustler|La.+(Lettura|Rblica|Stampa)|Le[\-._ ](Monde|Temps)|Les[\-._ ]Echos|e?Magazin(es?)?|Mac(life|welt)|Marie.+Claire|Maxim|Men.+(Health|Fitness)|Motocross|Motorcycle|Mountain[\-._ ]Bike|MusikWoche|National[\-._ ]Geographic|New[\-._ ]Yorker|PC([\-._ ](Gamer|Welt|World)|Games|Go|Tip)|Penthouse|Photograph(er|ic)|Playboy|Posten|Quotidiano|(Golf|Readers?).+Digest|SFX[\-._ ]UK|Recipe(.+Guide|s)|SkyNews|Sport[\-._ ]?Week|Strategy.+Guide|TabletPC|Tattoo[\-._ ]Life|The[\-._ ]Guardian|Tageszeitung|Tid(bits|ning)|Top[\-._ ]Gear[\-._ ]|Total[\-._ ]Guitar|Travel[\-._ ]Guides?|Tribune[\-._ ]De[\-._ ]|US[\-._ ]Weekly|USA[\-._ ]Today|TruePDF|Vogue|Verlag|Warcraft|Web.+Designer|What[\-._ ]Car|Zeitung/i', $this->releaseName):
|
||||
case ! preg_match('/[a-z\-\._ ][._ -](January|February|March|April|May|June|July|August|September|October|November|December)[._ -](\d{1,2},)?20\d\d[._ -]|^\(.+[ .]\d{1,2}[ .]20\d\d[ .].+\.scr|[._ -](Catalogue|FHM|NUTS|Pictorial|Tatler|XXX)[._ -]|^\(?(Allehanda|Club|Computer([a-z0-9]+)?|Connect \d+|Corriere|ct|Diario|Digit(al)?|Esquire|FHM|Gadgets|Galileo|Glam|GQ|Infosat|Inked|Instyle|io|Kicker|Liberation|New Scientist|NGV|Nuts|Popular|Professional|Reise|Sette(tv)?|Springer|Stuff|Studentlitteratur|Vegetarian|Vegetable|Videomarkt|Wired)[._ -]|Brady(.+)?Games|Catalog|Columbus.+Dispatch|Correspondenten|Corriere[._ -]Della[._ -]Sera|Cosmopolitan|Dagbladet|Digital[._ -]Guide|Economist|Eload ?24|ExtraTime|Fatto[._ -]Quotidiano|Flight[._ -](International|Journal)|Finanzwoche|France.+Football|Foto.+Video|Games?(Master|Markt|tar|TM)|Gardening|Gazzetta|Globe[._ -]And[._ -]Mail|Guitar|Heimkino|Hustler|La.+(Lettura|Rblica|Stampa)|Le[._ -](Monde|Temps)|Les[._ -]Echos|e?Magazin(es?)?|Mac(life|welt)|Marie.+Claire|Maxim|Men.+(Health|Fitness)|Motocross|Motorcycle|Mountain[._ -]Bike|MusikWoche|National[._ -]Geographic|New[._ -]Yorker|PC([._ -](Gamer|Welt|World)|Games|Go|Tip)|Penthouse|Photograph(er|ic)|Playboy|Posten|Quotidiano|(Golf|Readers?).+Digest|SFX[._ -]UK|Recipe(.+Guide|s)|SkyNews|Sport[._ -]?Week|Strategy.+Guide|TabletPC|Tattoo[._ -]Life|The[._ -]Guardian|Tageszeitung|Tid(bits|ning)|Top[._ -]Gear[._ -]|Total[._ -]Guitar|Travel[._ -]Guides?|Tribune[._ -]De[._ -]|US[._ -]Weekly|USA[._ -]Today|TruePDF|Vogue|Verlag|Warcraft|Web.+Designer|What[._ -]Car|Zeitung/i', $this->releaseName):
|
||||
return false;
|
||||
case $this->isBookForeign():
|
||||
break;
|
||||
@@ -2031,7 +2036,7 @@ class Categorize
|
||||
public function isEBook(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case ! preg_match('/^ePub|[\-._ ](Ebook|E?\-book|\) WW|Publishing)|[\.\-_\(\[ ](azw|epub|html|mobi|pdf|rtf|tif|txt)[\.\-_\)\] ]|[\. ](azw|doc|epub|mobi|pdf)(?![\w .])|\.ebook-\w$/i', $this->releaseName):
|
||||
case ! preg_match('/^ePub|[._ -](Ebook|E?\-book|\) WW|Publishing)|[\.\-_\(\[ ](azw|epub|html|mobi|pdf|rtf|tif|txt)[\.\-_\)\] ]|[\. ](azw|doc|epub|mobi|pdf)(?![\w .])|\.ebook-\w$/i', $this->releaseName):
|
||||
return false;
|
||||
case $this->isBookForeign():
|
||||
break;
|
||||
@@ -2052,7 +2057,7 @@ class Categorize
|
||||
public function isMisc(): bool
|
||||
{
|
||||
switch (true) {
|
||||
case preg_match('/[^a-z0-9]((480|720|1080)[ip]|s\d{1,3}[\-._ ]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ]))[^a-z0-9]/i', $this->releaseName):
|
||||
case preg_match('/[^a-z0-9]((480|720|1080)[ip]|s\d{1,3}[._ -]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ]))[^a-z0-9]/i', $this->releaseName):
|
||||
return false;
|
||||
case preg_match('/[a-f0-9]{32,64}/i', $this->releaseName):
|
||||
$this->tmpCat = Category::OTHER_HASHED;
|
||||
|
||||
@@ -5,13 +5,8 @@ namespace Blacklight;
|
||||
/**
|
||||
* Class ConsoleTools.
|
||||
*/
|
||||
class ConsoleTools
|
||||
class ConsoleTools extends ColorCLI
|
||||
{
|
||||
/**
|
||||
* @var \Blacklight\ColorCLI
|
||||
*/
|
||||
public $colorCli;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
@@ -22,9 +17,8 @@ class ConsoleTools
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->lastMessageLength = 0;
|
||||
|
||||
$this->colorCli = new ColorCLI();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +36,7 @@ class ConsoleTools
|
||||
echo str_repeat(\chr(8), $this->lastMessageLength);
|
||||
|
||||
$this->lastMessageLength = \strlen($message);
|
||||
$this->colorCli->headerOver($message);
|
||||
$this->headerOver($message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +54,7 @@ class ConsoleTools
|
||||
echo str_repeat(\chr(8), $this->lastMessageLength);
|
||||
|
||||
$this->lastMessageLength = \strlen($message);
|
||||
$this->colorCli->primaryOver($message);
|
||||
$this->primaryOver($message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+18
-18
@@ -212,7 +212,7 @@ class Movie
|
||||
*/
|
||||
public function getMovieInfo($imdbId)
|
||||
{
|
||||
return MovieInfo::query()->where('imdbid', str_pad($imdbId, 7, '0', STR_PAD_LEFT))->first();
|
||||
return MovieInfo::query()->where('imdbid', $imdbId)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -596,16 +596,16 @@ class Movie
|
||||
}
|
||||
|
||||
// Check TMDB for IMDB info.
|
||||
$tmdb = $this->fetchTMDBProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
|
||||
$tmdb = $this->fetchTMDBProperties($imdbId);
|
||||
|
||||
// Check IMDB for movie info.
|
||||
$imdb = $this->fetchIMDBProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
|
||||
$imdb = $this->fetchIMDBProperties($imdbId);
|
||||
|
||||
// Check TRAKT for movie info
|
||||
$trakt = $this->fetchTraktTVProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
|
||||
$trakt = $this->fetchTraktTVProperties($imdbId);
|
||||
|
||||
// Check OMDb for movie info
|
||||
$omdb = $this->fetchOmdbAPIProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
|
||||
$omdb = $this->fetchOmdbAPIProperties($imdbId);
|
||||
|
||||
// Check iTunes for movie info as last resort (iTunes do not provide all the info we need)
|
||||
|
||||
@@ -616,40 +616,40 @@ class Movie
|
||||
}
|
||||
|
||||
// Check FanArt.tv for cover and background images.
|
||||
$fanart = $this->fetchFanartTVProperties(str_pad($imdbId, 7, '0', STR_PAD_LEFT));
|
||||
$fanart = $this->fetchFanartTVProperties($imdbId);
|
||||
|
||||
$mov = [];
|
||||
|
||||
$mov['cover'] = $mov['backdrop'] = $mov['banner'] = 0;
|
||||
$mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = '';
|
||||
|
||||
$mov['imdbid'] = str_pad($imdbId, 7, '0', STR_PAD_LEFT);
|
||||
$mov['imdbid'] = $imdbId;
|
||||
$mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid'];
|
||||
$mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id'];
|
||||
|
||||
// Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes.
|
||||
if (! empty($fanart['cover'])) {
|
||||
$mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $fanart['cover'], $this->imgSavePath);
|
||||
$mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath);
|
||||
} elseif (! empty($tmdb['cover'])) {
|
||||
$mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $tmdb['cover'], $this->imgSavePath);
|
||||
$mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath);
|
||||
} elseif (! empty($imdb['cover'])) {
|
||||
$mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $imdb['cover'], $this->imgSavePath);
|
||||
$mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath);
|
||||
} elseif (! empty($omdb['cover'])) {
|
||||
$mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $omdb['cover'], $this->imgSavePath);
|
||||
$mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath);
|
||||
} elseif (! empty($iTunes['cover'])) {
|
||||
$mov['cover'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-cover', $iTunes['cover'], $this->imgSavePath);
|
||||
$mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath);
|
||||
}
|
||||
|
||||
// Backdrops.
|
||||
if (! empty($fanart['backdrop'])) {
|
||||
$mov['backdrop'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024);
|
||||
$mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024);
|
||||
} elseif (! empty($tmdb['backdrop'])) {
|
||||
$mov['backdrop'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024);
|
||||
$mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024);
|
||||
}
|
||||
|
||||
// Banner
|
||||
if (! empty($fanart['banner'])) {
|
||||
$mov['banner'] = $this->releaseImage->saveImage(str_pad($imdbId, 7, '0', STR_PAD_LEFT).'-banner', $fanart['banner'], $this->imgSavePath);
|
||||
$mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath);
|
||||
}
|
||||
|
||||
// RottenTomatoes rating from OmdbAPI
|
||||
@@ -1095,12 +1095,12 @@ class Movie
|
||||
if ($imdbID !== false) {
|
||||
$this->service = $service;
|
||||
if ($this->echooutput && $this->service !== '' && Utility::isCLI()) {
|
||||
$this->colorCli->primary($service.' found IMDBid: tt'.$imdbID, true);
|
||||
$this->colorCli->primary($this->service.' found IMDBid: tt'.$imdbID, true);
|
||||
}
|
||||
|
||||
$movieInfoId = MovieInfo::query()->where('imdbid', $imdbID)->first(['id']);
|
||||
|
||||
Release::query()->where('id', $id)->update(['imdbid' => str_pad($imdbID, 7, '0', STR_PAD_LEFT), 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
|
||||
Release::query()->where('id', $id)->update(['imdbid' =>$imdbID, 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
|
||||
|
||||
// If set, scan for imdb info.
|
||||
if ($processImdb === 1) {
|
||||
@@ -1112,7 +1112,7 @@ class Movie
|
||||
} elseif ($info === true) {
|
||||
$movieInfoId = MovieInfo::query()->where('imdbid', $imdbID)->first(['id']);
|
||||
|
||||
Release::query()->where('id', $id)->update(['imdbid' => str_pad($imdbID, 7, '0', STR_PAD_LEFT), 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
|
||||
Release::query()->where('id', $id)->update(['imdbid' =>$imdbID, 'movieinfo_id' => $movieInfoId !== null ? $movieInfoId['id'] : null]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -16,10 +16,10 @@ use App\Extensions\util\PhpYenc;
|
||||
*/
|
||||
|
||||
/*
|
||||
* 'Service discontinued' (RFC977)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
* 'Service discontinued' (RFC977)
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
define('NET_NNTP_PROTOCOL_RESPONSECODE_DISCONNECTING_FORCED', 400);
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ class NZB
|
||||
$XMLWriter->startElement('head');
|
||||
$XMLWriter->startElement('meta');
|
||||
$XMLWriter->writeAttribute('type', 'category');
|
||||
$XMLWriter->text($release->category->parent->title.' >'.$release->category->title);
|
||||
$XMLWriter->text(! empty($release->category->parent) ? $release->category->parent->title.' >'.$release->category->title : 'Other > Misc');
|
||||
$XMLWriter->endElement();
|
||||
$XMLWriter->startElement('meta');
|
||||
$XMLWriter->writeAttribute('type', 'name');
|
||||
|
||||
+51
-52
@@ -172,7 +172,6 @@ class NameFixer
|
||||
$this->consoletools = ($options['ConsoleTools'] instanceof ConsoleTools ? $options['ConsoleTools'] : new ConsoleTools());
|
||||
$this->category = ($options['Categorize'] instanceof Categorize ? $options['Categorize'] : new Categorize(['Settings' => null]));
|
||||
$this->sphinx = ($options['SphinxSearch'] instanceof SphinxSearch ? $options['SphinxSearch'] : new SphinxSearch());
|
||||
$this->colorCli = new ColorCLI();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +226,7 @@ class NameFixer
|
||||
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' releases to process.');
|
||||
$this->consoletools->primary(number_format($total).' releases to process.');
|
||||
|
||||
foreach ($releases as $rel) {
|
||||
$releaseRow = Release::fromQuery(
|
||||
@@ -256,7 +255,7 @@ class NameFixer
|
||||
}
|
||||
$this->_echoFoundCount($echo, ' NFO\'s');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +310,7 @@ class NameFixer
|
||||
$total = \count($releases);
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' file names to process.');
|
||||
$this->consoletools->primary(number_format($total).' file names to process.');
|
||||
|
||||
foreach ($releases as $release) {
|
||||
$this->reset();
|
||||
@@ -322,7 +321,7 @@ class NameFixer
|
||||
|
||||
$this->_echoFoundCount($echo, ' files');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,7 +376,7 @@ class NameFixer
|
||||
$total = \count($releases);
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' CRC32\'s to process.');
|
||||
$this->consoletools->primary(number_format($total).' CRC32\'s to process.');
|
||||
|
||||
foreach ($releases as $release) {
|
||||
$this->reset();
|
||||
@@ -388,7 +387,7 @@ class NameFixer
|
||||
|
||||
$this->_echoFoundCount($echo, ' crc32\'s');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +440,7 @@ class NameFixer
|
||||
$total = \count($releases);
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' xxx file names to process.');
|
||||
$this->consoletools->primary(number_format($total).' xxx file names to process.');
|
||||
|
||||
foreach ($releases as $release) {
|
||||
$this->reset();
|
||||
@@ -451,7 +450,7 @@ class NameFixer
|
||||
}
|
||||
$this->_echoFoundCount($echo, ' files');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,7 +505,7 @@ class NameFixer
|
||||
$total = \count($releases);
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' srr file extensions to process.');
|
||||
$this->consoletools->primary(number_format($total).' srr file extensions to process.');
|
||||
|
||||
foreach ($releases as $release) {
|
||||
$this->reset();
|
||||
@@ -516,7 +515,7 @@ class NameFixer
|
||||
}
|
||||
$this->_echoFoundCount($echo, ' files');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +565,7 @@ class NameFixer
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
|
||||
$this->colorCli->primary(number_format($total).' releases to process.');
|
||||
$this->consoletools->primary(number_format($total).' releases to process.');
|
||||
$Nfo = new Nfo();
|
||||
$nzbContents = new NZBContents(
|
||||
[
|
||||
@@ -587,7 +586,7 @@ class NameFixer
|
||||
}
|
||||
$this->_echoFoundCount($echo, ' files');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +650,7 @@ class NameFixer
|
||||
$total = \count($releases);
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' unique ids to process.');
|
||||
$this->consoletools->primary(number_format($total).' unique ids to process.');
|
||||
foreach ($releases as $rel) {
|
||||
$this->checked++;
|
||||
$this->reset();
|
||||
@@ -660,7 +659,7 @@ class NameFixer
|
||||
}
|
||||
$this->_echoFoundCount($echo, ' UID\'s');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,7 +715,7 @@ class NameFixer
|
||||
$total = \count($releases);
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' mediainfo movie names to process.');
|
||||
$this->consoletools->primary(number_format($total).' mediainfo movie names to process.');
|
||||
foreach ($releases as $rel) {
|
||||
$this->checked++;
|
||||
$this->reset();
|
||||
@@ -725,7 +724,7 @@ class NameFixer
|
||||
}
|
||||
$this->_echoFoundCount($echo, ' MediaInfo\'s');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,7 +789,7 @@ class NameFixer
|
||||
$total = \count($releases);
|
||||
if ($total > 0) {
|
||||
$this->_totalReleases = $total;
|
||||
$this->colorCli->primary(number_format($total).' hash_16K to process.');
|
||||
$this->consoletools->primary(number_format($total).' hash_16K to process.');
|
||||
foreach ($releases as $rel) {
|
||||
$this->checked++;
|
||||
$this->reset();
|
||||
@@ -799,7 +798,7 @@ class NameFixer
|
||||
}
|
||||
$this->_echoFoundCount($echo, ' hashes');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to fix.');
|
||||
$this->consoletools->info('Nothing to fix.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -841,7 +840,7 @@ class NameFixer
|
||||
protected function _echoFoundCount($echo, $type): void
|
||||
{
|
||||
if ($echo === true) {
|
||||
$this->colorCli->header(
|
||||
$this->consoletools->header(
|
||||
PHP_EOL.
|
||||
number_format($this->fixed).
|
||||
' releases have had their names changed out of: '.
|
||||
@@ -849,7 +848,7 @@ class NameFixer
|
||||
$type.'.'
|
||||
);
|
||||
} else {
|
||||
$this->colorCli->header(
|
||||
$this->consoletools->header(
|
||||
PHP_EOL.
|
||||
number_format($this->fixed).
|
||||
' releases could have their names changed. '.
|
||||
@@ -865,7 +864,7 @@ class NameFixer
|
||||
*/
|
||||
protected function _echoStartMessage($time, $type): void
|
||||
{
|
||||
$this->colorCli->header(
|
||||
$this->consoletools->header(
|
||||
sprintf(
|
||||
'Fixing search names %s using %s.',
|
||||
($time === 1 ? 'in the past 6 hours' : 'since the beginning'),
|
||||
@@ -880,7 +879,7 @@ class NameFixer
|
||||
protected function _echoRenamed($show): void
|
||||
{
|
||||
if ($this->checked % 500 === 0 && $show === 1) {
|
||||
$this->colorCli->alternate(PHP_EOL.number_format($this->checked).' files processed.'.PHP_EOL);
|
||||
$this->consoletools->alternate(PHP_EOL.number_format($this->checked).' files processed.'.PHP_EOL);
|
||||
}
|
||||
|
||||
if ($show === 2) {
|
||||
@@ -931,7 +930,7 @@ class NameFixer
|
||||
$this->fixed++;
|
||||
|
||||
$newName = explode('\\', $newName);
|
||||
$newName = preg_replace(['/^[\-=_\.:\s]+/', '/[\-=_\.:\s]+$/'], '', $newName[0]);
|
||||
$newName = preg_replace(['/^[=_\.:\s-]+/', '/[=_\.:\s-]+$/'], '', $newName[0]);
|
||||
|
||||
if ($this->echooutput && $show) {
|
||||
$groupName = UsenetGroup::getNameByID($release->groups_id);
|
||||
@@ -944,25 +943,25 @@ class NameFixer
|
||||
|
||||
echo PHP_EOL;
|
||||
|
||||
$this->colorCli->headerOver('New name: ').
|
||||
$this->colorCli->primary(substr($newName, 0, 299)).
|
||||
$this->colorCli->headerOver('Old name: ').
|
||||
$this->colorCli->primary($release->searchname).
|
||||
$this->colorCli->headerOver('Use name: ').
|
||||
$this->colorCli->primary($release->name).
|
||||
$this->colorCli->headerOver('New cat: ').
|
||||
$this->colorCli->primary($newCatName).
|
||||
$this->colorCli->headerOver('Old cat: ').
|
||||
$this->colorCli->primary($oldCatName).
|
||||
$this->colorCli->headerOver('Group: ').
|
||||
$this->colorCli->primary($groupName).
|
||||
$this->colorCli->headerOver('Method: ').
|
||||
$this->colorCli->primary($type.$method).
|
||||
$this->colorCli->headerOver('Releases ID: ').
|
||||
$this->colorCli->primary($release->releases_id);
|
||||
$this->consoletools->headerOver('New name: ').
|
||||
$this->consoletools->primary(substr($newName, 0, 299)).
|
||||
$this->consoletools->headerOver('Old name: ').
|
||||
$this->consoletools->primary($release->searchname).
|
||||
$this->consoletools->headerOver('Use name: ').
|
||||
$this->consoletools->primary($release->name).
|
||||
$this->consoletools->headerOver('New cat: ').
|
||||
$this->consoletools->primary($newCatName).
|
||||
$this->consoletools->headerOver('Old cat: ').
|
||||
$this->consoletools->primary($oldCatName).
|
||||
$this->consoletools->headerOver('Group: ').
|
||||
$this->consoletools->primary($groupName).
|
||||
$this->consoletools->headerOver('Method: ').
|
||||
$this->consoletools->primary($type.$method).
|
||||
$this->consoletools->headerOver('Releases ID: ').
|
||||
$this->consoletools->primary($release->releases_id);
|
||||
if (! empty($release->filename)) {
|
||||
$this->colorCli->headerOver('Filename: ').
|
||||
$this->colorCli->primary($release->filename);
|
||||
$this->consoletools->headerOver('Filename: ').
|
||||
$this->consoletools->primary($release->filename);
|
||||
}
|
||||
|
||||
if ($type !== 'PAR2, ') {
|
||||
@@ -1195,8 +1194,8 @@ class NameFixer
|
||||
$limit = 'LIMIT 1000000';
|
||||
}
|
||||
|
||||
$this->colorCli->header(PHP_EOL.'Match PreFiles '.$args[1].' Started at '.now());
|
||||
$this->colorCli->primary('Matching predb filename to cleaned release_files.name.');
|
||||
$this->consoletools->header(PHP_EOL.'Match PreFiles '.$args[1].' Started at '.now());
|
||||
$this->consoletools->primary('Matching predb filename to cleaned release_files.name.');
|
||||
|
||||
$counter = $counted = 0;
|
||||
$timestart = now();
|
||||
@@ -1225,7 +1224,7 @@ class NameFixer
|
||||
$total = \count($query);
|
||||
|
||||
if ($total > 0) {
|
||||
$this->colorCli->header(PHP_EOL.number_format($total).' releases to process.');
|
||||
$this->consoletools->header(PHP_EOL.number_format($total).' releases to process.');
|
||||
|
||||
foreach ($query as $row) {
|
||||
$success = $this->matchPreDbFiles($row, true, 1, $show);
|
||||
@@ -1236,9 +1235,9 @@ class NameFixer
|
||||
$this->consoletools->overWritePrimary('Renamed Releases: ['.number_format($counted).'] '.$this->consoletools->percentString(++$counter, $total));
|
||||
}
|
||||
}
|
||||
$this->colorCli->header(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timestart).' seconds'.'.');
|
||||
$this->consoletools->header(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timestart).' seconds'.'.');
|
||||
} else {
|
||||
$this->colorCli->info('Nothing to do.');
|
||||
$this->consoletools->info('Nothing to do.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1414,7 +1413,7 @@ class NameFixer
|
||||
if ($time === 1) {
|
||||
$te = ' in the past 3 hours';
|
||||
}
|
||||
$this->colorCli->header('Fixing search names'.$te.' using the predb hash.');
|
||||
$this->consoletools->header('Fixing search names'.$te.' using the predb hash.');
|
||||
}
|
||||
$regex = 'AND (r.ishashed = 1 OR rf.ishashed = 1)';
|
||||
|
||||
@@ -1432,7 +1431,7 @@ class NameFixer
|
||||
|
||||
$res = Release::fromQuery($query);
|
||||
$total = \count($res);
|
||||
$this->colorCli->primary(number_format($total).' releases to process.');
|
||||
$this->consoletools->primary(number_format($total).' releases to process.');
|
||||
foreach ($res as $row) {
|
||||
if (preg_match('/[a-fA-F0-9]{32,40}/i', $row->name, $matches)) {
|
||||
$updated += $this->matchPredbHash($matches[0], $row, $echo, $nameStatus, $show);
|
||||
@@ -1440,13 +1439,13 @@ class NameFixer
|
||||
$updated += $this->matchPredbHash($matches[0], $row, $echo, $nameStatus, $show);
|
||||
}
|
||||
if ($show === 2) {
|
||||
$this->colorCli->overWritePrimary('Renamed Releases: ['.number_format($updated).'] '.$this->consoletools->percentString($checked++, $total));
|
||||
$this->consoletools->overWritePrimary('Renamed Releases: ['.number_format($updated).'] '.$this->consoletools->percentString($checked++, $total));
|
||||
}
|
||||
}
|
||||
if ($echo === 1) {
|
||||
$this->colorCli->header(PHP_EOL.$updated.' releases have had their names changed out of: '.number_format($checked).' files.');
|
||||
$this->consoletools->header(PHP_EOL.$updated.' releases have had their names changed out of: '.number_format($checked).' files.');
|
||||
} else {
|
||||
$this->colorCli->header(PHP_EOL.$updated.' releases could have their names changed. '.number_format($checked).' files were checked.');
|
||||
$this->consoletools->header(PHP_EOL.$updated.' releases could have their names changed. '.number_format($checked).' files were checked.');
|
||||
}
|
||||
|
||||
return $updated;
|
||||
|
||||
@@ -126,7 +126,6 @@ class ReleaseRemover
|
||||
$this->releases = ($options['Releases'] instanceof Releases ? $options['Releases'] : new Releases());
|
||||
$this->nzb = ($options['NZB'] instanceof NZB ? $options['NZB'] : new NZB());
|
||||
$this->releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage());
|
||||
$this->colorCli = new ColorCLI();
|
||||
|
||||
$this->query = '';
|
||||
$this->error = '';
|
||||
@@ -185,8 +184,8 @@ class ReleaseRemover
|
||||
$this->deleteReleases();
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
|
||||
$this->colorCli->header(now()->diffInSeconds($timeStart).' seconds', true);
|
||||
$this->consoleTools->headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
|
||||
$this->consoleTools->header(now()->diffInSeconds($timeStart).' seconds', true);
|
||||
}
|
||||
|
||||
return $this->browser
|
||||
@@ -228,7 +227,7 @@ class ReleaseRemover
|
||||
|
||||
if ($time === 'full') {
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' - no time limit.', true);
|
||||
$this->consoleTools->header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' - no time limit.', true);
|
||||
}
|
||||
} else {
|
||||
if (! is_numeric($time)) {
|
||||
@@ -237,7 +236,7 @@ class ReleaseRemover
|
||||
return $this->returnError();
|
||||
}
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' from the past '.$time.' hour(s).', true);
|
||||
$this->consoleTools->header('Removing '.($type === '' ? 'All crap releases ' : $type.' crap releases').' from the past '.$time.' hour(s).', true);
|
||||
}
|
||||
$this->crapTime = ' AND r.adddate > (NOW() - INTERVAL '.$time.' HOUR)';
|
||||
}
|
||||
@@ -315,8 +314,8 @@ class ReleaseRemover
|
||||
}
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
|
||||
$this->colorCli->header(now()->diffInSeconds($timeStart).' seconds', true);
|
||||
$this->consoleTools->headerOver(($this->delete ? 'Deleted ' : 'Would have deleted ').$this->deletedCount.' release(s). This script ran for ');
|
||||
$this->consoleTools->header(now()->diffInSeconds($timeStart).' seconds', true);
|
||||
}
|
||||
|
||||
return $this->browser
|
||||
@@ -798,7 +797,7 @@ class ReleaseRemover
|
||||
}
|
||||
|
||||
// Provide useful output of operations
|
||||
$this->colorCli->header(
|
||||
$this->consoleTools->header(
|
||||
sprintf(
|
||||
'Finding crap releases for %s: Using %s method against release %s.'.
|
||||
'%s',
|
||||
@@ -832,7 +831,7 @@ class ReleaseRemover
|
||||
$this->deleteReleases();
|
||||
}
|
||||
} else {
|
||||
$this->colorCli->error("No regular expressions were selected for blacklist removal. Make sure you have activated REGEXPs in Site Edit and you're specifying a valid ID.", true);
|
||||
$this->consoleTools->error("No regular expressions were selected for blacklist removal. Make sure you have activated REGEXPs in Site Edit and you're specifying a valid ID.", true);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -902,7 +901,7 @@ class ReleaseRemover
|
||||
$ftUsing = PHP_EOL;
|
||||
|
||||
// Provide useful output of operations
|
||||
$this->colorCli->header(
|
||||
$this->consoleTools->header(
|
||||
sprintf(
|
||||
'Finding crap releases for %s: Using %s method against release filenames.'.PHP_EOL.
|
||||
'%s',
|
||||
@@ -1033,10 +1032,10 @@ class ReleaseRemover
|
||||
if ($this->delete) {
|
||||
$this->releases->deleteSingle(['g' => $release->guid, 'i' => $release->id], $this->nzb, $this->releaseImage);
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary('Deleting: '.$this->method.': '.$release->searchname, true);
|
||||
$this->consoleTools->primary('Deleting: '.$this->method.': '.$release->searchname, true);
|
||||
}
|
||||
} elseif ($this->echoCLI) {
|
||||
$this->colorCli->primary('Would be deleting: '.$this->method.': '.$release->searchname, true);
|
||||
$this->consoleTools->primary('Would be deleting: '.$this->method.': '.$release->searchname, true);
|
||||
}
|
||||
$deletedCount++;
|
||||
}
|
||||
@@ -1253,7 +1252,7 @@ class ReleaseRemover
|
||||
}
|
||||
|
||||
// Print the query to the user, ask them if they want to continue using it.
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
'This is the query we have formatted using your criteria, you can run it in SQL to see if you like the results:'.
|
||||
PHP_EOL.$this->query.';'.PHP_EOL.
|
||||
'If you are satisfied, type yes and press enter. Anything else will exit.',
|
||||
@@ -1263,7 +1262,7 @@ class ReleaseRemover
|
||||
// Check the users response.
|
||||
$userInput = trim(fgets(fopen('php://stdin', 'rtb')));
|
||||
if ($userInput !== 'yes') {
|
||||
$this->colorCli->primary('You typed: "'.$userInput.'", the program will exit.', true);
|
||||
$this->consoleTools->primary('You typed: "'.$userInput.'", the program will exit.', true);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1314,7 +1313,7 @@ class ReleaseRemover
|
||||
}
|
||||
|
||||
if ($this->echoCLI && $this->error !== '') {
|
||||
$this->colorCli->error($this->error, true);
|
||||
$this->consoleTools->error($this->error, true);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Blacklight;
|
||||
|
||||
/**
|
||||
* Class ReleaseSearch.
|
||||
*/
|
||||
class ReleaseSearch
|
||||
{
|
||||
/**
|
||||
* Array where keys are the column name, and value is the search string.
|
||||
* @var array
|
||||
*/
|
||||
private $searchOptions;
|
||||
|
||||
/**
|
||||
* Sets the string to join the releases table to the release search table if using full text.
|
||||
* @var string
|
||||
*/
|
||||
private $fullTextJoinString;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sphinxQueryOpt;
|
||||
|
||||
/**
|
||||
* ReleaseSearch constructor.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->fullTextJoinString = 'INNER JOIN releases_se rse ON rse.id = r.id';
|
||||
$this->sphinxQueryOpt = ';limit=10000;maxmatches=10000;sort=relevance;mode=extended';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create part of a SQL query for searching releases.
|
||||
*
|
||||
* @param array $options Array where keys are the column name, and value is the search string.
|
||||
*
|
||||
*
|
||||
* @return string|\Illuminate\Database\Query\Builder
|
||||
*/
|
||||
public function getSearchSQL(array $options = [])
|
||||
{
|
||||
$this->searchOptions = $options;
|
||||
|
||||
return $this->sphinxSQL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string for joining the release search table to the releases table.
|
||||
* @return string
|
||||
*/
|
||||
public function getFullTextJoinString(): string
|
||||
{
|
||||
return $this->fullTextJoinString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function sphinxSQL(): string
|
||||
{
|
||||
$searchQuery = $fullReturn = '';
|
||||
|
||||
foreach ($this->searchOptions as $columnName => $searchString) {
|
||||
$searchWords = '';
|
||||
foreach (explode(' ', $searchString) as $word) {
|
||||
$word = str_replace("'", "\\'", trim($word, "\n\t\r\0\x0B "));
|
||||
if ($word !== '') {
|
||||
$searchWords .= ($word.' ');
|
||||
}
|
||||
}
|
||||
$searchWords = rtrim($searchWords, "\n\t\r\0\x0B ");
|
||||
if ($searchWords !== '') {
|
||||
$searchQuery .= sprintf(
|
||||
'@%s %s ',
|
||||
$columnName,
|
||||
$searchWords
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($searchQuery !== '') {
|
||||
$fullReturn = sprintf("AND (rse.query = '@@relaxed %s')", trim($searchQuery).$this->sphinxQueryOpt);
|
||||
}
|
||||
|
||||
return $fullReturn;
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -66,7 +66,7 @@ class Releases extends Release
|
||||
$orderBy = $this->getBrowseOrder($orderBy);
|
||||
|
||||
$qry = sprintf(
|
||||
"SELECT r.id, r.searchname, r.groups_id, r.guid, r.postdate, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, cp.title AS parent_category, c.title AS sub_category,
|
||||
"SELECT r.id, r.searchname, r.groups_id, r.guid, r.postdate, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, cp.title AS parent_category, c.title AS sub_category,
|
||||
CONCAT(cp.title, ' > ', c.title) AS category_name,
|
||||
CONCAT(cp.id, ',', c.id) AS category_ids,
|
||||
df.failed AS failed,
|
||||
@@ -76,7 +76,7 @@ class Releases extends Release
|
||||
tve.title, tve.firstaired
|
||||
FROM
|
||||
(
|
||||
SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, g.name AS group_name
|
||||
SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, g.name AS group_name
|
||||
FROM releases r
|
||||
LEFT JOIN usenet_groups g ON g.id = r.groups_id
|
||||
%s
|
||||
@@ -385,7 +385,7 @@ class Releases extends Release
|
||||
{
|
||||
$orderBy = $this->getBrowseOrder($orderBy);
|
||||
$sql = sprintf(
|
||||
"SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, cp.title AS parent_category, c.title AS sub_category,
|
||||
"SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, cp.title AS parent_category, c.title AS sub_category,
|
||||
CONCAT(cp.title, '-', c.title) AS category_name,
|
||||
%s AS category_ids,
|
||||
g.name AS group_name,
|
||||
@@ -641,7 +641,7 @@ class Releases extends Release
|
||||
($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '')
|
||||
);
|
||||
$baseSql = sprintf(
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, cp.title AS parent_category, c.title AS sub_category,
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, cp.title AS parent_category, c.title AS sub_category,
|
||||
CONCAT(cp.title, ' > ', c.title) AS category_name,
|
||||
%s AS category_ids,
|
||||
df.failed AS failed,
|
||||
@@ -728,7 +728,7 @@ class Releases extends Release
|
||||
($minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : '')
|
||||
);
|
||||
$baseSql = sprintf(
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, m.imdbid, m.tmdbid, m.traktid, cp.title AS parent_category, c.title AS sub_category,
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, m.imdbid, m.tmdbid, m.traktid, cp.title AS parent_category, c.title AS sub_category,
|
||||
CONCAT(cp.title, ' > ', c.title) AS category_name,
|
||||
%s AS category_ids,
|
||||
g.name AS group_name,
|
||||
@@ -874,7 +874,7 @@ class Releases extends Release
|
||||
! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
|
||||
);
|
||||
$baseSql = sprintf(
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview,
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus,
|
||||
v.title, v.countries_id, v.started, v.tvdb, v.trakt,
|
||||
v.imdb, v.tmdb, v.tvmaze, v.tvrage, v.source,
|
||||
tvi.summary, tvi.publisher, tvi.image,
|
||||
@@ -1019,7 +1019,7 @@ class Releases extends Release
|
||||
! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : ''
|
||||
);
|
||||
$baseSql = sprintf(
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview,
|
||||
"SELECT r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.tv_episodes_id, r.haspreview, r.jpgstatus,
|
||||
v.title, v.type, v.tvdb, v.trakt,v.imdb, v.tmdb, v.tvmaze, v.tvrage,
|
||||
tve.series, tve.episode, tve.se_complete, tve.title, tve.firstaired, cp.title AS parent_category, c.title AS sub_category,
|
||||
CONCAT(cp.title, ' > ', c.title) AS category_name,
|
||||
@@ -1094,7 +1094,7 @@ class Releases extends Release
|
||||
($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '')
|
||||
);
|
||||
$baseSql = sprintf(
|
||||
"SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.haspreview, cp.title AS parent_category, c.title AS sub_category,
|
||||
"SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.haspreview, r.jpgstatus, cp.title AS parent_category, c.title AS sub_category,
|
||||
CONCAT(cp.title, ' > ', c.title) AS category_name,
|
||||
%s AS category_ids,
|
||||
g.name AS group_name,
|
||||
@@ -1164,7 +1164,7 @@ class Releases extends Release
|
||||
$this->showPasswords(),
|
||||
(! empty($searchResult) ? 'AND r.id IN ('.implode(',', $searchResult).')' : ''),
|
||||
! empty($tags) ? " AND tt.tag_name IN ('".implode("','", $tags)."')" : '',
|
||||
($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = %d ', str_pad($imDbId, 7, '0', STR_PAD_LEFT)) : '',
|
||||
($imDbId !== -1 && is_numeric($imDbId)) ? sprintf(' AND m.imdbid = %d ', $imDbId) : '',
|
||||
($tmDbId !== -1 && is_numeric($tmDbId)) ? sprintf(' AND m.tmdbid = %d ', $tmDbId) : '',
|
||||
($traktId !== -1 && is_numeric($traktId)) ? sprintf(' AND m.traktid = %d ', $traktId) : '',
|
||||
! empty($excludedCategories) ? sprintf('AND r.categories_id NOT IN('.implode(',', $excludedCategories).')') : '',
|
||||
@@ -1173,7 +1173,7 @@ class Releases extends Release
|
||||
$minSize > 0 ? sprintf('AND r.size >= %d', $minSize) : ''
|
||||
);
|
||||
$baseSql = sprintf(
|
||||
"SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.imdbid, r.videos_id, r.tv_episodes_id, r.haspreview, m.imdbid, m.tmdbid, m.traktid, cp.title AS parent_category, c.title AS sub_category,
|
||||
"SELECT r.id, r.searchname, r.guid, r.postdate, r.groups_id, r.categories_id, r.size, r.totalpart, r.fromname, r.passwordstatus, r.grabs, r.comments, r.adddate, r.imdbid, r.videos_id, r.tv_episodes_id, r.haspreview, r.jpgstatus, m.imdbid, m.tmdbid, m.traktid, cp.title AS parent_category, c.title AS sub_category,
|
||||
concat(cp.title, ' > ', c.title) AS category_name,
|
||||
%s AS category_ids,
|
||||
g.name AS group_name,
|
||||
|
||||
@@ -106,11 +106,11 @@ class PreDb
|
||||
$options += $defaults;
|
||||
|
||||
if (empty($options['path'])) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (! is_numeric($options['limit'])) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
$limit = $options['limit'] > 0 ? "LIMIT {$options['limit']}" : '';
|
||||
@@ -153,7 +153,7 @@ SQL_EXPORT;
|
||||
$options += $defaults;
|
||||
|
||||
if (empty($options['path'])) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (! isset($this->ps['LoadData'])) {
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Blacklight\http;
|
||||
use App\Models\Category;
|
||||
use App\Models\Settings;
|
||||
use Blacklight\utility\Utility;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Class Output -- abstract class for printing web requests outside of Smarty.
|
||||
@@ -53,7 +52,6 @@ abstract class Capabilities
|
||||
'Settings' => null,
|
||||
];
|
||||
$options += $defaults;
|
||||
$this->pdo = DB::connection()->getPdo();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -479,7 +479,7 @@ class XML_Response
|
||||
$this->writeZedAttr('tvmazeid', $this->release->tvmaze);
|
||||
}
|
||||
if (isset($this->release->imdb) && $this->release->imdb > 0) {
|
||||
$this->writeZedAttr('imdbid', str_pad($this->release->imdb, 7, '0', STR_PAD_LEFT));
|
||||
$this->writeZedAttr('imdbid', $this->release->imdb);
|
||||
}
|
||||
if (isset($this->release->tmdb) && $this->release->tmdb > 0) {
|
||||
$this->writeZedAttr('tmdbid', $this->release->tmdb);
|
||||
|
||||
+241
-343
@@ -5,11 +5,14 @@ namespace Blacklight\libraries;
|
||||
use Blacklight\Nfo;
|
||||
use Blacklight\NZB;
|
||||
use Blacklight\NNTP;
|
||||
use Spatie\Async\Pool;
|
||||
use App\Models\Settings;
|
||||
use Blacklight\ColorCLI;
|
||||
use App\Models\UsenetGroup;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Opis\Closure\SerializableClosure;
|
||||
use Blacklight\processing\PostProcess;
|
||||
|
||||
/**
|
||||
@@ -20,7 +23,7 @@ use Blacklight\processing\PostProcess;
|
||||
* For example, you get all the ID's of the active groups in the groups table, you then iterate over them and spawn
|
||||
* processes of misc/update_binaries.php passing the group ID's.
|
||||
*/
|
||||
class Forking extends \fork_daemon
|
||||
class Forking
|
||||
{
|
||||
private const OUTPUT_NONE = 0; // Don't display child output.
|
||||
private const OUTPUT_REALTIME = 1; // Display child output in real time.
|
||||
@@ -84,7 +87,6 @@ class Forking extends \fork_daemon
|
||||
* @var string
|
||||
*/
|
||||
private $safeBackfillGroup = '';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
@@ -120,32 +122,12 @@ class Forking extends \fork_daemon
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
SerializableClosure::removeSecurityProvider();
|
||||
$this->colorCli = new ColorCLI();
|
||||
|
||||
$this->register_logging(
|
||||
[0 => $this, 1 => 'logger'],
|
||||
(\defined('NN_MULTIPROCESSING_LOG_TYPE') ? NN_MULTIPROCESSING_LOG_TYPE : \fork_daemon::LOG_LEVEL_INFO)
|
||||
);
|
||||
$this->dnr_path = PHP_BINARY.' misc/update/multiprocessing/.do_not_run/switch.php "php ';
|
||||
|
||||
if (\defined('NN_MULTIPROCESSING_MAX_CHILD_WORK')) {
|
||||
$this->max_work_per_child_set(NN_MULTIPROCESSING_MAX_CHILD_WORK);
|
||||
} else {
|
||||
$this->max_work_per_child_set(1);
|
||||
}
|
||||
|
||||
if (\defined('NN_MULTIPROCESSING_MAX_CHILD_TIME')) {
|
||||
$this->child_max_run_time_set(NN_MULTIPROCESSING_MAX_CHILD_TIME);
|
||||
} else {
|
||||
$this->child_max_run_time_set(1800);
|
||||
}
|
||||
|
||||
// Use a single exit method for all children, makes things easier.
|
||||
$this->register_parent_child_exit([0 => $this, 1 => 'childExit']);
|
||||
|
||||
if (\defined('NN_MULTIPROCESSING_CHILD_OUTPUT_TYPE')) {
|
||||
switch (NN_MULTIPROCESSING_CHILD_OUTPUT_TYPE) {
|
||||
switch (config('nntmux.multiprocessing_child_output_type')) {
|
||||
case 0:
|
||||
$this->outputType = self::OUTPUT_NONE;
|
||||
break;
|
||||
@@ -158,11 +140,8 @@ class Forking extends \fork_daemon
|
||||
default:
|
||||
$this->outputType = self::OUTPUT_REALTIME;
|
||||
}
|
||||
} else {
|
||||
$this->outputType = self::OUTPUT_REALTIME;
|
||||
}
|
||||
|
||||
$this->dnr_path = PHP_BINARY.' '.NN_MULTIPROCESSING.'.do_not_run/switch.php "php ';
|
||||
$this->dnr_path = PHP_BINARY.' misc/update/multiprocessing/.do_not_run/switch.php "php ';
|
||||
|
||||
$this->maxSize = (int) Settings::settingValue('..maxsizetoprocessnfo');
|
||||
$this->minSize = (int) Settings::settingValue('..minsizetoprocessnfo');
|
||||
@@ -194,17 +173,14 @@ class Forking extends \fork_daemon
|
||||
// Get work to fork.
|
||||
$this->getWork();
|
||||
|
||||
// Process the work we got.
|
||||
$this->processWork();
|
||||
|
||||
// Process extra work that should not be forked and done after.
|
||||
$this->processEndWork();
|
||||
|
||||
if (config('nntmux.echocli')) {
|
||||
$this->colorCli->header(
|
||||
'Multi-processing for '.$this->workType.' finished in '.(now()->timestamp - $startTime).
|
||||
' seconds at '.date(DATE_RFC2822).'.'.PHP_EOL
|
||||
);
|
||||
' seconds at '.now()->toRfc2822String().'.'.PHP_EOL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,25 +198,25 @@ class Forking extends \fork_daemon
|
||||
*/
|
||||
private function getWork()
|
||||
{
|
||||
$maxProcesses = 0;
|
||||
$this->maxProcesses = 0;
|
||||
|
||||
switch ($this->workType) {
|
||||
|
||||
case 'backfill':
|
||||
$maxProcesses = $this->backfillMainMethod();
|
||||
$this->backfill();
|
||||
break;
|
||||
|
||||
case 'binaries':
|
||||
$maxProcesses = $this->binariesMainMethod();
|
||||
$this->binaries();
|
||||
break;
|
||||
|
||||
case 'fixRelNames_standard':
|
||||
case 'fixRelNames_predbft':
|
||||
$maxProcesses = $this->fixRelNamesMainMethod();
|
||||
$this->fixRelNames();
|
||||
break;
|
||||
|
||||
case 'releases':
|
||||
$maxProcesses = $this->releasesMainMethod();
|
||||
$this->releases();
|
||||
break;
|
||||
|
||||
case 'postProcess_ama':
|
||||
@@ -248,16 +224,16 @@ class Forking extends \fork_daemon
|
||||
break;
|
||||
|
||||
case 'postProcess_add':
|
||||
$maxProcesses = $this->postProcessAddMainMethod();
|
||||
$this->postProcessAdd();
|
||||
break;
|
||||
|
||||
case 'postProcess_mov':
|
||||
$this->ppRenamedOnly = (isset($this->workTypeOptions[0]) && $this->workTypeOptions[0] === true);
|
||||
$maxProcesses = $this->postProcessMovMainMethod();
|
||||
$this->postProcessMov();
|
||||
break;
|
||||
|
||||
case 'postProcess_nfo':
|
||||
$maxProcesses = $this->postProcessNfoMainMethod();
|
||||
$this->postProcessNfo();
|
||||
break;
|
||||
|
||||
case 'postProcess_sha':
|
||||
@@ -266,23 +242,21 @@ class Forking extends \fork_daemon
|
||||
|
||||
case 'postProcess_tv':
|
||||
$this->ppRenamedOnly = (isset($this->workTypeOptions[0]) && $this->workTypeOptions[0] === true);
|
||||
$maxProcesses = $this->postProcessTvMainMethod();
|
||||
$this->postProcessTv();
|
||||
break;
|
||||
|
||||
case 'safe_backfill':
|
||||
$maxProcesses = $this->safeBackfillMainMethod();
|
||||
$this->safeBackfill();
|
||||
break;
|
||||
|
||||
case 'safe_binaries':
|
||||
$maxProcesses = $this->safeBinariesMainMethod();
|
||||
$this->safeBinaries();
|
||||
break;
|
||||
|
||||
case 'update_per_group':
|
||||
$maxProcesses = $this->updatePerGroupMainMethod();
|
||||
$this->updatePerGroup();
|
||||
break;
|
||||
}
|
||||
|
||||
$this->setMaxProcesses($maxProcesses);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,32 +265,26 @@ class Forking extends \fork_daemon
|
||||
private function processWork()
|
||||
{
|
||||
$this->_workCount = \count($this->work);
|
||||
if ($this->_workCount > 0) {
|
||||
if (config('nntmux.echocli') === true) {
|
||||
$this->colorCli->header(
|
||||
'Multi-processing started at '.date(DATE_RFC2822).' for '.$this->workType.' with '.$this->_workCount.
|
||||
' job(s) to do using a max of '.$this->maxProcesses.' child process(es).'
|
||||
);
|
||||
}
|
||||
|
||||
$this->addwork($this->work);
|
||||
$this->process_work(true);
|
||||
} elseif (config('nntmux.echocli') === true) {
|
||||
if ($this->_workCount > 0 && config('nntmux.echocli') === true) {
|
||||
$this->colorCli->header(
|
||||
'Multi-processing started at '.now()->toRfc2822String().' for '.$this->workType.' with '.$this->_workCount.
|
||||
' job(s) to do using a max of '.$this->maxProcesses.' child process(es).'
|
||||
);
|
||||
}
|
||||
if (empty($this->_workCount) && config('nntmux.echocli') === true) {
|
||||
$this->colorCli->header('No work to do!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process any work that does not need to be forked, but needs to run at the end.
|
||||
* Process any work that does not need to be forked, but needs to run at the start.
|
||||
*/
|
||||
private function processStartWork()
|
||||
{
|
||||
switch ($this->workType) {
|
||||
case 'safe_backfill':
|
||||
case 'safe_binaries':
|
||||
$this->_executeCommand(
|
||||
PHP_BINARY.' '.NN_UPDATE.'tmux/bin/update_groups.php'
|
||||
);
|
||||
$this->_executeCommand(PHP_BINARY.' misc/update/tmux/bin/update_groups.php');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -328,14 +296,13 @@ class Forking extends \fork_daemon
|
||||
{
|
||||
switch ($this->workType) {
|
||||
case 'releases':
|
||||
$this->_executeCommand(
|
||||
$this->dnr_path.'releases '.\count($this->work).'_"'
|
||||
);
|
||||
|
||||
$this->_executeCommand($this->dnr_path.'releases '.\count($this->work).'_"');
|
||||
|
||||
break;
|
||||
case 'update_per_group':
|
||||
$this->_executeCommand(
|
||||
$this->dnr_path.'releases '.\count($this->work).'_"'
|
||||
);
|
||||
$this->_executeCommand($this->dnr_path.'releases '.\count($this->work).'_"');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -344,13 +311,8 @@ class Forking extends \fork_daemon
|
||||
//////////////////////////////////////// All backFill code here ////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function backfillMainMethod(): int
|
||||
private function backfill()
|
||||
{
|
||||
$this->register_child_run([0 => $this, 1 => 'backFillChildWorker']);
|
||||
// The option for backFill is for doing up to x articles. Else it's done by date.
|
||||
$this->work = DB::select(
|
||||
sprintf(
|
||||
@@ -359,29 +321,24 @@ class Forking extends \fork_daemon
|
||||
)
|
||||
);
|
||||
|
||||
return (int) Settings::settingValue('..backfillthreads');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $groups
|
||||
*/
|
||||
public function backFillChildWorker($groups)
|
||||
{
|
||||
foreach ($groups as $group) {
|
||||
$this->_executeCommand(
|
||||
PHP_BINARY.' '.NN_UPDATE.'backfill.php '.
|
||||
$group->name.(isset($group->max) ? (' '.$group->max) : '')
|
||||
);
|
||||
$pool = Pool::create()->concurrency($this->maxProcesses)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
$this->processWork();
|
||||
$maxWork = \count($this->work);
|
||||
foreach ($this->work as $group) {
|
||||
$pool->add(function () use ($group) {
|
||||
$this->_executeCommand(PHP_BINARY.' misc/update/backfill.php '.$group->name.(isset($group->max) ? (' '.$group->max) : ''));
|
||||
})->then(function () use ($group, $maxWork) {
|
||||
$this->colorCli->primary('Task #'.$maxWork.' Backfilled group '.$group->name);
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
});
|
||||
$maxWork--;
|
||||
}
|
||||
$pool->wait();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private function safeBackfillMainMethod(): int
|
||||
private function safeBackfill()
|
||||
{
|
||||
$this->register_child_run([0 => $this, 1 => 'safeBackfillChildWorker']);
|
||||
|
||||
$backfill_qty = (int) Settings::settingValue('site.tmux.backfill_qty');
|
||||
$backfill_order = (int) Settings::settingValue('site.tmux.backfill_order');
|
||||
$backfill_days = (int) Settings::settingValue('site.tmux.backfill_days');
|
||||
@@ -414,9 +371,9 @@ class Forking extends \fork_daemon
|
||||
$backfilldays = '';
|
||||
if ($backfill_days === 1) {
|
||||
$days = 'backfill_target';
|
||||
$backfilldays = now()->subDays(Carbon::createFromDate($days));
|
||||
$backfilldays = now()->diffInDays(Carbon::createFromDate($days));
|
||||
} elseif ($backfill_days === 2) {
|
||||
$backfilldays = now()->subDays(Carbon::createFromFormat('Y-m-d', Settings::settingValue('..safebackfilldate'))->diffInDays())->format('Y-m-d');
|
||||
$backfilldays = now()->diffInDays(Carbon::createFromFormat('Y-m-d', Settings::settingValue('..safebackfilldate')));
|
||||
}
|
||||
|
||||
$data = DB::select(
|
||||
@@ -430,7 +387,7 @@ class Forking extends \fork_daemon
|
||||
WHERE g.first_record IS NOT NULL
|
||||
AND g.first_record_postdate IS NOT NULL
|
||||
AND g.backfill = 1
|
||||
AND %s < g.first_record_postdate
|
||||
AND (NOW() - INTERVAL %d DAY ) < g.first_record_postdate
|
||||
GROUP BY a.name, a.last_record, g.name, g.first_record
|
||||
%s LIMIT 1',
|
||||
$backfilldays,
|
||||
@@ -452,26 +409,24 @@ class Forking extends \fork_daemon
|
||||
$geteach = $count / $maxmssgs;
|
||||
}
|
||||
|
||||
$queue = [];
|
||||
$queues = [];
|
||||
for ($i = 0; $i <= $geteach - 1; $i++) {
|
||||
$queue[$i] = sprintf('get_range backfill %s %s %s %s', $data[0]->name, $data[0]->our_first - $i * $maxmssgs - $maxmssgs, $data[0]->our_first - $i * $maxmssgs - 1, $i + 1);
|
||||
$queues[$i] = sprintf('get_range backfill %s %s %s %s', $data[0]->name, $data[0]->our_first - $i * $maxmssgs - $maxmssgs, $data[0]->our_first - $i * $maxmssgs - 1, $i + 1);
|
||||
}
|
||||
$this->work = $queue;
|
||||
}
|
||||
|
||||
return $threads;
|
||||
}
|
||||
$pool = Pool::create()->concurrency($threads)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
|
||||
/**
|
||||
* @param $ranges
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function safeBackfillChildWorker($ranges, $identifier = '')
|
||||
{
|
||||
foreach ($ranges as $range) {
|
||||
$this->_executeCommand(
|
||||
$this->dnr_path.$range.'"'
|
||||
);
|
||||
$this->processWork();
|
||||
foreach ($queues as $queue) {
|
||||
$pool->add(function () use ($queue) {
|
||||
$this->_executeCommand($this->dnr_path.$queue.'"');
|
||||
})->then(function () use ($data) {
|
||||
$this->colorCli->primary('Backfilled group '.$data[0]->name);
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
});
|
||||
}
|
||||
$pool->wait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,12 +434,8 @@ class Forking extends \fork_daemon
|
||||
//////////////////////////////////////// All binaries code here ////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private function binariesMainMethod()
|
||||
private function binaries()
|
||||
{
|
||||
$this->register_child_run([0 => $this, 1 => 'binariesChildWorker']);
|
||||
$this->work = DB::select(
|
||||
sprintf(
|
||||
'SELECT name, %d AS max FROM usenet_groups WHERE active = 1',
|
||||
@@ -492,35 +443,37 @@ class Forking extends \fork_daemon
|
||||
)
|
||||
);
|
||||
|
||||
return (int) Settings::settingValue('..binarythreads');
|
||||
}
|
||||
$this->maxProcesses = (int) Settings::settingValue('..binarythreads');
|
||||
|
||||
/**
|
||||
* @param $groups
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function binariesChildWorker($groups, $identifier = '')
|
||||
{
|
||||
foreach ($groups as $group) {
|
||||
$this->_executeCommand(
|
||||
PHP_BINARY.' '.NN_UPDATE.'update_binaries.php '.$group->name.' '.$group->max
|
||||
);
|
||||
$pool = Pool::create()->concurrency($this->maxProcesses)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
|
||||
$maxWork = \count($this->work);
|
||||
|
||||
$this->processWork();
|
||||
foreach ($this->work as $group) {
|
||||
$pool->add(function () use ($group) {
|
||||
$this->_executeCommand(PHP_BINARY.' misc/update/update_binaries.php '.$group->name.' '.$group->max);
|
||||
})->then(function () use ($group, $maxWork) {
|
||||
$this->colorCli->primary('Task #'.$maxWork.' Updated group '.$group->name);
|
||||
})->catch(function (\Throwable $exception) {
|
||||
echo $exception->getMessage();
|
||||
});
|
||||
$maxWork--;
|
||||
}
|
||||
|
||||
$pool->wait();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function safeBinariesMainMethod()
|
||||
private function safeBinaries()
|
||||
{
|
||||
$this->register_child_run([0 => $this, 1 => 'safeBinariesChildWorker']);
|
||||
|
||||
$maxheaders = (int) Settings::settingValue('..max_headers_iteration') ?: 1000000;
|
||||
$maxmssgs = (int) Settings::settingValue('..maxmssgs');
|
||||
$threads = (int) Settings::settingValue('..binarythreads');
|
||||
$this->maxProcesses = (int) Settings::settingValue('..binarythreads');
|
||||
|
||||
$groups = DB::select(
|
||||
$this->work = DB::select(
|
||||
'
|
||||
SELECT g.name AS groupname, g.last_record AS our_last,
|
||||
a.last_record AS their_last
|
||||
@@ -529,53 +482,53 @@ class Forking extends \fork_daemon
|
||||
ORDER BY a.last_record DESC'
|
||||
);
|
||||
|
||||
if (! empty($groups)) {
|
||||
if (! empty($this->work)) {
|
||||
$i = 1;
|
||||
$queue = [];
|
||||
foreach ($groups as $group) {
|
||||
$queues = [];
|
||||
foreach ($this->work as $group) {
|
||||
if ((int) $group->our_last === 0) {
|
||||
$queue[$i] = sprintf('update_group_headers %s', $group->groupname);
|
||||
$queues[$i] = sprintf('update_group_headers %s', $group->groupname);
|
||||
$i++;
|
||||
} else {
|
||||
//only process if more than 20k headers available and skip the first 20k
|
||||
$count = $group->their_last - $group->our_last - 20000;
|
||||
//echo "count: " . $count . "maxmsgs x2: " . ($maxmssgs * 2) . PHP_EOL;
|
||||
if ($count <= $maxmssgs * 2) {
|
||||
$queue[$i] = sprintf('update_group_headers %s', $group->groupname);
|
||||
$queues[$i] = sprintf('update_group_headers %s', $group->groupname);
|
||||
$i++;
|
||||
} else {
|
||||
$queue[$i] = sprintf('part_repair %s', $group->groupname);
|
||||
$queues[$i] = sprintf('part_repair %s', $group->groupname);
|
||||
$i++;
|
||||
$geteach = floor(min($count, $maxheaders) / $maxmssgs);
|
||||
$remaining = min($count, $maxheaders) - $geteach * $maxmssgs;
|
||||
//echo "maxmssgs: " . $maxmssgs . " geteach: " . $geteach . " remaining: " . $remaining . PHP_EOL;
|
||||
for ($j = 0; $j < $geteach; $j++) {
|
||||
$queue[$i] = sprintf('get_range binaries %s %s %s %s', $group->groupname, $group->our_last + $j * $maxmssgs + 1, $group->our_last + $j * $maxmssgs + $maxmssgs, $i);
|
||||
$queues[$i] = sprintf('get_range binaries %s %s %s %s', $group->groupname, $group->our_last + $j * $maxmssgs + 1, $group->our_last + $j * $maxmssgs + $maxmssgs, $i);
|
||||
$i++;
|
||||
}
|
||||
//add remainder to queue
|
||||
$queue[$i] = sprintf('get_range binaries %s %s %s %s', $group->groupname, $group->our_last + ($j + 1) * $maxmssgs + 1, $group->our_last + ($j + 1) * $maxmssgs + $remaining + 1, $i);
|
||||
$queues[$i] = sprintf('get_range binaries %s %s %s %s', $group->groupname, $group->our_last + ($j + 1) * $maxmssgs + 1, $group->our_last + ($j + 1) * $maxmssgs + $remaining + 1, $i);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($queue);
|
||||
$this->work = $queue;
|
||||
}
|
||||
$pool = Pool::create()->concurrency($this->maxProcesses)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
|
||||
return $threads;
|
||||
}
|
||||
$this->processWork();
|
||||
foreach ($queues as $queue) {
|
||||
preg_match('/alt\..+/i', $queue, $match);
|
||||
$pool->add(function () use ($queue) {
|
||||
$this->_executeCommand($this->dnr_path.$queue.'"');
|
||||
})->then(function () use ($match) {
|
||||
if (! empty($match)) {
|
||||
$this->colorCli->primary('Updated group '.$match[0]);
|
||||
}
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ranges
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function safeBinariesChildWorker($ranges, $identifier = '')
|
||||
{
|
||||
foreach ($ranges as $range) {
|
||||
$this->_executeCommand(
|
||||
$this->dnr_path.$range.'"'
|
||||
);
|
||||
$pool->wait();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,20 +536,15 @@ class Forking extends \fork_daemon
|
||||
//////////////////////////////////// All fix release names code here ///////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private function fixRelNamesMainMethod()
|
||||
private function fixRelNames()
|
||||
{
|
||||
$this->register_child_run([0 => $this, 1 => 'fixRelNamesChildWorker']);
|
||||
|
||||
$threads = (int) Settings::settingValue('..fixnamethreads');
|
||||
$this->maxProcesses = (int) Settings::settingValue('..fixnamethreads');
|
||||
$maxperrun = (int) Settings::settingValue('..fixnamesperrun');
|
||||
|
||||
if ($threads > 16) {
|
||||
$threads = 16;
|
||||
} elseif ($threads === 0) {
|
||||
$threads = 1;
|
||||
if ($this->maxProcesses > 16) {
|
||||
$this->maxProcesses = 16;
|
||||
} elseif ($this->maxProcesses === 0) {
|
||||
$this->maxProcesses = 1;
|
||||
}
|
||||
|
||||
$leftGuids = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
||||
@@ -622,68 +570,76 @@ class Forking extends \fork_daemon
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$queue = [];
|
||||
$queues = [];
|
||||
foreach ($leftGuids as $leftGuid) {
|
||||
$count++;
|
||||
if ($maxperrun > 0) {
|
||||
$queue[$count] = sprintf('%s %s %s %s', $this->workTypeOptions[0], $leftGuid, $maxperrun, $count);
|
||||
$queues[$count] = sprintf('%s %s %s %s', $this->workTypeOptions[0], $leftGuid, $maxperrun, $count);
|
||||
}
|
||||
}
|
||||
$this->work = $queue;
|
||||
|
||||
return $threads;
|
||||
}
|
||||
$this->work = $queues;
|
||||
|
||||
/**
|
||||
* @param $guids
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function fixRelNamesChildWorker($guids, $identifier = '')
|
||||
{
|
||||
foreach ($guids as $guid) {
|
||||
$this->_executeCommand(
|
||||
PHP_BINARY.' '.NN_UPDATE.'tmux/bin/groupfixrelnames.php "'.$guid.'"'.' true'
|
||||
);
|
||||
$pool = Pool::create()->concurrency($this->maxProcesses)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
|
||||
$maxWork = \count($queues);
|
||||
|
||||
$this->processWork();
|
||||
foreach ($this->work as $queue) {
|
||||
$pool->add(function () use ($queue) {
|
||||
$this->_executeCommand(PHP_BINARY.' misc/update/tmux/bin/groupfixrelnames.php "'.$queue.'"'.' true');
|
||||
})->then(function () use ($maxWork) {
|
||||
$this->colorCli->primary('Task #'.$maxWork.' Finished fixing releases names');
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
});
|
||||
$maxWork--;
|
||||
}
|
||||
$pool->wait();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////// All releases code here ////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
private function releasesMainMethod()
|
||||
private function releases()
|
||||
{
|
||||
$this->register_child_run([0 => $this, 1 => 'releasesChildWorker']);
|
||||
$work = DB::select('SELECT id, name FROM usenet_groups WHERE (active = 1 OR backfill = 1)');
|
||||
$this->maxProcesses = (int) Settings::settingValue('..releasethreads');
|
||||
|
||||
$groups = DB::select('SELECT id FROM usenet_groups WHERE (active = 1 OR backfill = 1)');
|
||||
|
||||
foreach ($groups as $group) {
|
||||
$uGroups = [];
|
||||
foreach ($work as $group) {
|
||||
try {
|
||||
if (! empty(DB::select(sprintf('SELECT id FROM collections LIMIT 1')))) {
|
||||
$this->work[] = ['id' => $group->id];
|
||||
$query = DB::select(sprintf('SELECT id FROM collections WHERE groups_id = %d LIMIT 1', $group->id));
|
||||
if (! empty($query)) {
|
||||
$uGroups[] = ['id' => $group->id, 'name' => $group->name];
|
||||
}
|
||||
} catch (\PDOException $e) {
|
||||
if (config('app.debug' === true)) {
|
||||
if (config('app.debug') === true) {
|
||||
Log::debug($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (int) Settings::settingValue('..releasethreads');
|
||||
}
|
||||
$maxWork = \count($uGroups);
|
||||
|
||||
/**
|
||||
* @param $groups
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function releasesChildWorker($groups, $identifier = '')
|
||||
{
|
||||
foreach ($groups as $group) {
|
||||
$this->_executeCommand($this->dnr_path.'releases '.$group['id'].'"');
|
||||
$this->work = $uGroups;
|
||||
|
||||
$pool = Pool::create()->concurrency($this->maxProcesses)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
|
||||
$this->processWork();
|
||||
foreach ($uGroups as $group) {
|
||||
$pool->add(function () use ($group) {
|
||||
$this->_executeCommand($this->dnr_path.'releases '.$group['id'].'"');
|
||||
})->then(function () use ($maxWork) {
|
||||
$this->colorCli->primary('Task #'.$maxWork.' Finished performing release processing');
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
});
|
||||
$maxWork--;
|
||||
}
|
||||
|
||||
$pool->wait();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -694,49 +650,59 @@ class Forking extends \fork_daemon
|
||||
* Only 1 exit method is used for post process, since they are all similar.
|
||||
*
|
||||
*
|
||||
* @param array $groups
|
||||
* @param string $identifier
|
||||
* @param array $releases
|
||||
* @param int $maxProcess
|
||||
*/
|
||||
public function postProcessChildWorker($groups, $identifier = '')
|
||||
public function postProcess($releases, $maxProcess)
|
||||
{
|
||||
$type = '';
|
||||
$type = $desc = '';
|
||||
if ($this->processAdditional) {
|
||||
$type = 'pp_additional ';
|
||||
$desc = 'additional postprocessing';
|
||||
} elseif ($this->processNFO) {
|
||||
$type = 'pp_nfo ';
|
||||
$desc = 'nfo postprocessing';
|
||||
} elseif ($this->processMovies) {
|
||||
$type = 'pp_movie ';
|
||||
$desc = 'movies postprocessing';
|
||||
} elseif ($this->processTV) {
|
||||
$type = 'pp_tv ';
|
||||
$desc = 'tv postprocessing';
|
||||
}
|
||||
foreach ($groups as $group) {
|
||||
$pool = Pool::create()->concurrency($maxProcess)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
$count = \count($releases);
|
||||
$this->processWork();
|
||||
foreach ($releases as $release) {
|
||||
if ($type !== '') {
|
||||
$this->_executeCommand(
|
||||
$this->dnr_path.$type.$group->id.(isset($group->renamed) ? (' '.$group->renamed) : '').'"'
|
||||
);
|
||||
$pool->add(function () use ($release, $type) {
|
||||
$this->_executeCommand($this->dnr_path.$type.$release->id.(isset($release->renamed) ? (' '.$release->renamed) : '').'"');
|
||||
})->then(function () use ($desc, $count) {
|
||||
$this->colorCli->primary('Finished task #'.$count.' for '.$desc);
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
})->timeout(function () use ($count) {
|
||||
$this->colorCli->notice('Task #'.$count.': Timeout occurred.');
|
||||
});
|
||||
$count--;
|
||||
}
|
||||
}
|
||||
$pool->wait();
|
||||
}
|
||||
|
||||
private $ppAddMinSize;
|
||||
private $ppAddMaxSize;
|
||||
|
||||
/**
|
||||
* Check if we should process Additional's.
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function checkProcessAdditional()
|
||||
private function postProcessAdd()
|
||||
{
|
||||
$this->ppAddMinSize =
|
||||
Settings::settingValue('..minsizetopostprocess') !== '' ? (int) Settings::settingValue('..minsizetopostprocess') : 1;
|
||||
$this->ppAddMinSize = ($this->ppAddMinSize > 0 ? ('AND r.size > '.($this->ppAddMinSize * 1048576)) : '');
|
||||
$this->ppAddMaxSize =
|
||||
(Settings::settingValue('..maxsizetopostprocess') !== '') ? (int) Settings::settingValue('..maxsizetopostprocess') : 100;
|
||||
$this->ppAddMaxSize = ($this->ppAddMaxSize > 0 ? ('AND r.size < '.($this->ppAddMaxSize * 1073741824)) : '');
|
||||
|
||||
return DB::select(sprintf('
|
||||
SELECT r.id
|
||||
$ppAddMinSize = Settings::settingValue('..minsizetopostprocess') !== '' ? (int) Settings::settingValue('..minsizetopostprocess') : 1;
|
||||
$ppAddMinSize = ($ppAddMinSize > 0 ? ('AND r.size > '.($ppAddMinSize * 1048576)) : '');
|
||||
$ppAddMaxSize = (Settings::settingValue('..maxsizetopostprocess') !== '') ? (int) Settings::settingValue('..maxsizetopostprocess') : 100;
|
||||
$ppAddMaxSize = ($ppAddMaxSize > 0 ? ('AND r.size < '.($ppAddMaxSize * 1073741824)) : '');
|
||||
$this->maxProcesses = 1;
|
||||
$ppQueue = DB::select(
|
||||
sprintf(
|
||||
'
|
||||
SELECT r.leftguid AS id
|
||||
FROM releases r
|
||||
LEFT JOIN categories c ON c.id = r.categories_id
|
||||
WHERE r.nzbstatus = %d
|
||||
@@ -744,41 +710,20 @@ class Forking extends \fork_daemon
|
||||
AND r.haspreview = -1
|
||||
AND c.disablepreview = 0
|
||||
%s %s
|
||||
LIMIT 1', NZB::NZB_ADDED, $this->ppAddMaxSize, $this->ppAddMinSize)) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function postProcessAddMainMethod()
|
||||
{
|
||||
$maxProcesses = 1;
|
||||
if ($this->checkProcessAdditional()) {
|
||||
$this->processAdditional = true;
|
||||
$this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']);
|
||||
$this->work = DB::select(
|
||||
sprintf(
|
||||
'
|
||||
SELECT leftguid AS id
|
||||
FROM releases r
|
||||
LEFT JOIN categories c ON c.id = r.categories_id
|
||||
WHERE r.nzbstatus = %d
|
||||
AND r.passwordstatus BETWEEN -6 AND -1
|
||||
AND r.haspreview = -1
|
||||
AND c.disablepreview = 0
|
||||
%s %s
|
||||
GROUP BY leftguid
|
||||
GROUP BY r.leftguid
|
||||
LIMIT 16',
|
||||
NZB::NZB_ADDED,
|
||||
$this->ppAddMaxSize,
|
||||
$this->ppAddMinSize
|
||||
)
|
||||
);
|
||||
$maxProcesses = (int) Settings::settingValue('..postthreads');
|
||||
NZB::NZB_ADDED,
|
||||
$ppAddMaxSize,
|
||||
$ppAddMinSize
|
||||
)
|
||||
);
|
||||
if (\count($ppQueue) > 0) {
|
||||
$this->processAdditional = true;
|
||||
$this->work = $ppQueue;
|
||||
$this->maxProcesses = (int) Settings::settingValue('..postthreads');
|
||||
}
|
||||
|
||||
return $maxProcesses;
|
||||
$this->postProcess($this->work, $this->maxProcesses);
|
||||
}
|
||||
|
||||
private $nfoQueryString = '';
|
||||
@@ -801,30 +746,28 @@ class Forking extends \fork_daemon
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function postProcessNfoMainMethod(): int
|
||||
private function postProcessNfo()
|
||||
{
|
||||
$maxProcesses = 1;
|
||||
$this->maxProcesses = 1;
|
||||
if ($this->checkProcessNfo()) {
|
||||
$this->processNFO = true;
|
||||
$this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']);
|
||||
$this->work = DB::select(
|
||||
sprintf(
|
||||
'
|
||||
SELECT leftguid AS id
|
||||
SELECT r.leftguid AS id
|
||||
FROM releases r
|
||||
WHERE 1=1 %s
|
||||
GROUP BY leftguid
|
||||
GROUP BY r.leftguid
|
||||
LIMIT 16',
|
||||
$this->nfoQueryString
|
||||
)
|
||||
);
|
||||
$maxProcesses = (int) Settings::settingValue('..nfothreads');
|
||||
$this->maxProcesses = (int) Settings::settingValue('..nfothreads');
|
||||
}
|
||||
|
||||
return $maxProcesses;
|
||||
$this->postProcess($this->work, $this->maxProcesses);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -848,15 +791,13 @@ class Forking extends \fork_daemon
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function postProcessMovMainMethod(): int
|
||||
private function postProcessMov()
|
||||
{
|
||||
$maxProcesses = 1;
|
||||
$this->maxProcesses = 1;
|
||||
if ($this->checkProcessMovies()) {
|
||||
$this->processMovies = true;
|
||||
$this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']);
|
||||
$this->work = DB::select(
|
||||
sprintf(
|
||||
'
|
||||
@@ -874,10 +815,10 @@ class Forking extends \fork_daemon
|
||||
($this->ppRenamedOnly ? 'AND isrenamed = 1' : '')
|
||||
)
|
||||
);
|
||||
$maxProcesses = (int) Settings::settingValue('..postthreadsnon');
|
||||
$this->maxProcesses = (int) Settings::settingValue('..postthreadsnon');
|
||||
}
|
||||
|
||||
return $maxProcesses;
|
||||
$this->postProcess($this->work, $this->maxProcesses);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -903,15 +844,13 @@ class Forking extends \fork_daemon
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function postProcessTvMainMethod()
|
||||
private function postProcessTv()
|
||||
{
|
||||
$maxProcesses = 1;
|
||||
$this->maxProcesses = 1;
|
||||
if ($this->checkProcessTV()) {
|
||||
$this->processTV = true;
|
||||
$this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']);
|
||||
$this->work = DB::select(
|
||||
sprintf(
|
||||
'
|
||||
@@ -930,10 +869,10 @@ class Forking extends \fork_daemon
|
||||
($this->ppRenamedOnly ? 'AND isrenamed = 1' : '')
|
||||
)
|
||||
);
|
||||
$maxProcesses = (int) Settings::settingValue('..postthreadsnon');
|
||||
$this->maxProcesses = (int) Settings::settingValue('..postthreadsnon');
|
||||
}
|
||||
|
||||
return $maxProcesses;
|
||||
$this->postProcess($this->work, $this->maxProcesses);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -972,44 +911,33 @@ class Forking extends \fork_daemon
|
||||
$postProcess->processXXX();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $groups
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function requestIDChildWorker($groups, $identifier = '')
|
||||
{
|
||||
foreach ($groups as $group) {
|
||||
$this->_executeCommand($this->dnr_path.'requestid '.$group['id'].'"');
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////// All "update_per_Group" code goes here ////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function updatePerGroupMainMethod()
|
||||
private function updatePerGroup()
|
||||
{
|
||||
$this->register_child_run([0 => $this, 1 => 'updatePerGroupChildWorker']);
|
||||
$this->work = DB::select('SELECT id FROM usenet_groups WHERE (active = 1 OR backfill = 1)');
|
||||
$this->work = DB::select('SELECT id , name FROM usenet_groups WHERE (active = 1 OR backfill = 1)');
|
||||
|
||||
return (int) Settings::settingValue('..releasethreads');
|
||||
}
|
||||
$maxProcess = (int) Settings::settingValue('..releasethreads');
|
||||
|
||||
/**
|
||||
* @param $groups
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function updatePerGroupChildWorker($groups, $identifier = '')
|
||||
{
|
||||
foreach ($groups as $group) {
|
||||
$this->_executeCommand(
|
||||
$this->dnr_path.'update_per_group '.$group->id.'"'
|
||||
);
|
||||
$pool = Pool::create()->concurrency($maxProcess)->timeout(config('nntmux.multiprocessing_max_child_time'));
|
||||
$this->processWork();
|
||||
foreach ($this->work as $group) {
|
||||
$pool->add(function () use ($group) {
|
||||
$this->_executeCommand($this->dnr_path.'update_per_group '.$group->id.'"');
|
||||
})->then(function () use ($group) {
|
||||
$name = UsenetGroup::getNameByID($group->id);
|
||||
$this->colorCli->primary('Finished updating binaries, processing releases and additional postprocessing for group:'.$name);
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
});
|
||||
}
|
||||
|
||||
$pool->wait();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1017,7 +945,7 @@ class Forking extends \fork_daemon
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Execute a shell command, use the appropriate PHP function based on user setting.
|
||||
* Execute a shell command.
|
||||
*
|
||||
* @param string $command
|
||||
*/
|
||||
@@ -1036,35 +964,6 @@ class Forking extends \fork_daemon
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount of max child processes.
|
||||
*
|
||||
* @param int $maxProcesses
|
||||
*/
|
||||
private function setMaxProcesses($maxProcesses)
|
||||
{
|
||||
// Check if override setting is on.
|
||||
if (\defined('NN_MULTIPROCESSING_MAX_CHILDREN_OVERRIDE') && NN_MULTIPROCESSING_MAX_CHILDREN_OVERRIDE > 0) {
|
||||
$maxProcesses = NN_MULTIPROCESSING_MAX_CHILDREN_OVERRIDE;
|
||||
}
|
||||
|
||||
if (is_numeric($maxProcesses) && $maxProcesses > 0) {
|
||||
switch ($this->workType) {
|
||||
case 'postProcess_tv':
|
||||
case 'postProcess_mov':
|
||||
case 'postProcess_nfo':
|
||||
case 'postProcess_add':
|
||||
if ($maxProcesses > 16) {
|
||||
$maxProcesses = 16;
|
||||
}
|
||||
}
|
||||
$this->maxProcesses = (int) $maxProcesses;
|
||||
$this->max_children_set($this->maxProcesses);
|
||||
} else {
|
||||
$this->max_children_set(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Echo a message to CLI.
|
||||
*
|
||||
@@ -1081,17 +980,16 @@ class Forking extends \fork_daemon
|
||||
* This method is executed whenever a child is finished doing work.
|
||||
*
|
||||
* @param string $pid The PID numbers.
|
||||
* @param string $identifier Optional identifier to give a PID a name.
|
||||
*/
|
||||
public function childExit($pid, $identifier = '')
|
||||
public function exit($pid)
|
||||
{
|
||||
if (config('nntmux.echocli')) {
|
||||
$this->colorCli->header(
|
||||
'Process ID #'.$pid.' has completed.'.PHP_EOL.
|
||||
'There are '.($this->forked_children_count - 1).' process(es) still active with '.
|
||||
(--$this->_workCount).' job(s) left in the queue.',
|
||||
'There are '.($this->maxProcesses - 1).' process(es) still active with '.
|
||||
(--$this->_workCount).' job(s) left in the queue.',
|
||||
true
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Blacklight\libraries;
|
||||
|
||||
use Spatie\Async\Pool;
|
||||
|
||||
/**
|
||||
* Class ForkingImportNZB.
|
||||
*
|
||||
@@ -42,7 +44,7 @@ class ForkingImportNZB extends Forking
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->importPath = (PHP_BINARY.' '.NN_MISC.'testing'.DS.'nzb-import.php ');
|
||||
$this->importPath = PHP_BINARY.' misc/testing/nzb-import.php ';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +69,7 @@ class ForkingImportNZB extends Forking
|
||||
|
||||
if (config('nntmux.echocli')) {
|
||||
$this->colorCli->header(
|
||||
'Multi-processing started at '.date(DATE_RFC2822).' with '.$this->_workCount.
|
||||
'Multi-processing started at '.now()->toRfc2822String().' with '.$this->_workCount.
|
||||
' job(s) to do using a max of '.$maxProcesses.' child process(es).'
|
||||
);
|
||||
}
|
||||
@@ -77,35 +79,30 @@ class ForkingImportNZB extends Forking
|
||||
$this->useFileName = $useFileName;
|
||||
$this->maxPerProcess = $maxPerProcess;
|
||||
|
||||
$this->max_children_set($maxProcesses);
|
||||
$this->register_child_run([0 => $this, 1 => 'importChildWorker']);
|
||||
$this->child_max_run_time_set(86400);
|
||||
$this->addwork($directories);
|
||||
$this->process_work(true);
|
||||
foreach ($directories as $directory) {
|
||||
$pool = Pool::create()->concurrency($maxProcesses)->timeout(3600);
|
||||
$pool->add(function () use ($directory) {
|
||||
$this->_executeCommand(
|
||||
$this->importPath.'"'.
|
||||
$directory.'" '.
|
||||
$this->deleteComplete.' '.
|
||||
$this->deleteFailed.' '.
|
||||
$this->useFileName.' '.
|
||||
$this->maxPerProcess
|
||||
);
|
||||
})->then(function () {
|
||||
$this->colorCli->header('Finished importing new nzbs', true);
|
||||
})->catch(function (\Throwable $exception) {
|
||||
// Handle exception
|
||||
});
|
||||
$pool->wait();
|
||||
}
|
||||
|
||||
if (config('nntmux.echocli')) {
|
||||
$this->colorCli->header(
|
||||
'Multi-processing for import finished in '.(now()->timestamp - $startTime).
|
||||
' seconds at '.date(DATE_RFC2822).'.'.PHP_EOL
|
||||
'Multi-processing for import finished in '.(now()->timestamp - $startTime).
|
||||
' seconds at '.now()->toRfc2822String().'.'.PHP_EOL
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $directories
|
||||
* @param string $identifier
|
||||
*/
|
||||
public function importChildWorker($directories, $identifier = '')
|
||||
{
|
||||
foreach ($directories as $directory) {
|
||||
$this->_executeCommand(
|
||||
$this->importPath.'"'.
|
||||
$directory.'" '.
|
||||
$this->deleteComplete.' '.
|
||||
$this->deleteFailed.' '.
|
||||
$this->useFileName.' '.
|
||||
$this->maxPerProcess
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ class TraktAPI
|
||||
public function searchId($id, $site = 'trakt', $type = 0)
|
||||
{
|
||||
if (! \in_array($site, self::$types, false) || ! ctype_digit($id)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
if ($site === 'imdb') {
|
||||
$id = 'tt'.$id;
|
||||
@@ -268,7 +268,7 @@ class TraktAPI
|
||||
public function showSummary($show = '', $type = 'full')
|
||||
{
|
||||
if (empty($show)) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
$showUrl = self::API_URL.'shows/'.Str::slug($show);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ use Blacklight\Genres;
|
||||
use App\Models\Release;
|
||||
use App\Models\Category;
|
||||
use App\Models\Settings;
|
||||
use Blacklight\ColorCLI;
|
||||
use Blacklight\Releases;
|
||||
use App\Models\MusicInfo;
|
||||
use App\Models\Collection;
|
||||
@@ -102,11 +101,6 @@ class ProcessReleases
|
||||
*/
|
||||
private $collectionTimeout;
|
||||
|
||||
/**
|
||||
* @var \Blacklight\ColorCLI
|
||||
*/
|
||||
protected $colorCli;
|
||||
|
||||
/**
|
||||
* @param array $options Class instances / Echo to cli ?
|
||||
*
|
||||
@@ -133,7 +127,6 @@ class ProcessReleases
|
||||
$this->releaseCleaning = ($options['ReleaseCleaning'] instanceof ReleaseCleaning ? $options['ReleaseCleaning'] : new ReleaseCleaning());
|
||||
$this->releases = ($options['Releases'] instanceof Releases ? $options['Releases'] : new Releases());
|
||||
$this->releaseImage = ($options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage());
|
||||
$this->colorCli = new ColorCLI();
|
||||
|
||||
$dummy = Settings::settingValue('..delaytime');
|
||||
$this->collectionDelayTime = ($dummy !== '' ? (int) $dummy : 2);
|
||||
@@ -145,7 +138,7 @@ class ProcessReleases
|
||||
$this->completion = ($dummy !== '' ? (int) $dummy : 0);
|
||||
if ($this->completion > 100) {
|
||||
$this->completion = 100;
|
||||
$this->colorCli->error(PHP_EOL.'You have an invalid setting for completion. It cannot be higher than 100.');
|
||||
$this->consoleTools->error(PHP_EOL.'You have an invalid setting for completion. It cannot be higher than 100.');
|
||||
}
|
||||
$this->collectionTimeout = (int) Settings::settingValue('indexer.processing.collection_timeout');
|
||||
}
|
||||
@@ -175,12 +168,12 @@ class ProcessReleases
|
||||
}
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')');
|
||||
$this->consoleTools->header('Starting release update process ('.now()->format('Y-m-d H:i:s').')');
|
||||
}
|
||||
|
||||
if (! file_exists(Settings::settingValue('..nzbpath'))) {
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath'));
|
||||
$this->consoleTools->error('Bad or missing nzb directory - '.Settings::settingValue('..nzbpath'));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -207,11 +200,7 @@ class ProcessReleases
|
||||
|| $nzbFilesAdded >= $this->releaseCreationLimit
|
||||
);
|
||||
|
||||
// Only run if non-mgr as mgr is not specific to group
|
||||
if ($groupName !== 'mgr') {
|
||||
$this->deletedReleasesByGroup($groupID);
|
||||
$this->deleteReleases();
|
||||
}
|
||||
$this->deleteReleases();
|
||||
|
||||
return $totalReleasesAdded;
|
||||
}
|
||||
@@ -284,7 +273,7 @@ class ProcessReleases
|
||||
$startTime = now();
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Attempting to find complete collections.');
|
||||
$this->consoleTools->header('Process Releases -> Attempting to find complete collections.');
|
||||
}
|
||||
|
||||
$where = (! empty($groupID) ? ' AND c.groups_id = '.$groupID.' ' : ' ');
|
||||
@@ -307,7 +296,7 @@ class ProcessReleases
|
||||
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
($count ?? 0).' collections were found to be complete. Time: '.
|
||||
$totalTime.Str::plural(' second', $totalTime),
|
||||
true
|
||||
@@ -326,7 +315,7 @@ class ProcessReleases
|
||||
$startTime = now();
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Calculating collection sizes (in bytes).');
|
||||
$this->consoleTools->header('Process Releases -> Calculating collection sizes (in bytes).');
|
||||
}
|
||||
// Get the total size in bytes of the collection for collections where filecheck = 2.
|
||||
DB::transaction(function () use ($groupID, $startTime) {
|
||||
@@ -349,12 +338,12 @@ class ProcessReleases
|
||||
)
|
||||
);
|
||||
if ($checked > 0 && $this->echoCLI) {
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
$checked.' collections set to filecheck = 3(size calculated)',
|
||||
true
|
||||
);
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
$this->colorCli->primary($totalTime.Str::plural(' second', $totalTime), true);
|
||||
$this->consoleTools->primary($totalTime.Str::plural(' second', $totalTime), true);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
@@ -370,7 +359,7 @@ class ProcessReleases
|
||||
$startTime = now();
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Delete collections smaller/larger than minimum size/file count from group/site setting.');
|
||||
$this->consoleTools->header('Process Releases -> Delete collections smaller/larger than minimum size/file count from group/site setting.');
|
||||
}
|
||||
|
||||
$groupID === '' ? $groupIDs = UsenetGroup::getActiveIDs() : $groupIDs = [['id' => $groupID]];
|
||||
@@ -442,7 +431,7 @@ class ProcessReleases
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary('Deleted '.($minSizeDeleted + $maxSizeDeleted + $minFilesDeleted).' collections: '.PHP_EOL.$minSizeDeleted.' smaller than, '.$maxSizeDeleted.' bigger than, '.$minFilesDeleted.' with less files than site/group settings in: '.$totalTime.Str::plural(' second', $totalTime), true);
|
||||
$this->consoleTools->primary('Deleted '.($minSizeDeleted + $maxSizeDeleted + $minFilesDeleted).' collections: '.PHP_EOL.$minSizeDeleted.' smaller than, '.$maxSizeDeleted.' bigger than, '.$minFilesDeleted.' with less files than site/group settings in: '.$totalTime.Str::plural(' second', $totalTime), true);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
@@ -463,7 +452,7 @@ class ProcessReleases
|
||||
$returnCount = $duplicate = 0;
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Create releases from complete collections.');
|
||||
$this->consoleTools->header('Process Releases -> Create releases from complete collections.');
|
||||
}
|
||||
$collectionsQuery = Collection::query()
|
||||
->where('collections.filecheck', self::COLLFC_SIZED)
|
||||
@@ -476,7 +465,7 @@ class ProcessReleases
|
||||
->limit($this->releaseCreationLimit);
|
||||
$collections = $collectionsQuery->get();
|
||||
if ($this->echoCLI && $collections->count() > 0) {
|
||||
$this->colorCli->primary(\count($collections).' Collections ready to be converted to releases.', true);
|
||||
$this->consoleTools->primary(\count($collections).' Collections ready to be converted to releases.', true);
|
||||
}
|
||||
|
||||
foreach ($collections as $collection) {
|
||||
@@ -618,7 +607,7 @@ class ProcessReleases
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
PHP_EOL.
|
||||
number_format($returnCount).
|
||||
' Releases added and '.
|
||||
@@ -645,7 +634,7 @@ class ProcessReleases
|
||||
$startTime = now();
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Create the NZB, delete collections/binaries/parts.');
|
||||
$this->consoleTools->header('Process Releases -> Create the NZB, delete collections/binaries/parts.');
|
||||
}
|
||||
|
||||
$releasesQuery = Release::query()->with('category.parent')->where('nzbstatus', '=', 0);
|
||||
@@ -671,7 +660,7 @@ class ProcessReleases
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
number_format($nzbCount).' NZBs created/Collections deleted in '.
|
||||
$totalTime.Str::plural(' second', $totalTime).PHP_EOL.
|
||||
'Total time: '.$totalTime.Str::plural(' second', $totalTime),
|
||||
@@ -695,7 +684,7 @@ class ProcessReleases
|
||||
{
|
||||
$startTime = now();
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Categorize releases.');
|
||||
$this->consoleTools->header('Process Releases -> Categorize releases.');
|
||||
}
|
||||
switch ((int) $categorize) {
|
||||
case 2:
|
||||
@@ -714,7 +703,7 @@ class ProcessReleases
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary($totalTime.Str::plural(' second', $totalTime));
|
||||
$this->consoleTools->primary($totalTime.Str::plural(' second', $totalTime));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,7 +721,7 @@ class ProcessReleases
|
||||
if ((int) $postProcess === 1) {
|
||||
(new PostProcess(['Echo' => $this->echoCLI]))->processAll($nntp);
|
||||
} elseif ($this->echoCLI) {
|
||||
$this->colorCli->info(
|
||||
$this->consoleTools->info(
|
||||
'Post-processing is not running inside the Process Releases class.'.PHP_EOL.
|
||||
'If you are using tmux or screen they might have their own scripts running Post-processing.'
|
||||
);
|
||||
@@ -754,8 +743,8 @@ class ProcessReleases
|
||||
// CBP older than retention.
|
||||
if ($this->echoCLI) {
|
||||
echo
|
||||
$this->colorCli->header('Process Releases -> Delete finished collections.'.PHP_EOL).
|
||||
$this->colorCli->primary(sprintf(
|
||||
$this->consoleTools->header('Process Releases -> Delete finished collections.'.PHP_EOL).
|
||||
$this->consoleTools->primary(sprintf(
|
||||
'Deleting collections/binaries/parts older than %d hours.',
|
||||
Settings::settingValue('..partretentionhours')
|
||||
), true);
|
||||
@@ -775,7 +764,7 @@ class ProcessReleases
|
||||
$totalTime = $firstQuery->diffInSeconds($startTime);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
'Finished deleting '.$deleted.' old collections/binaries/parts in '.
|
||||
$totalTime.Str::plural(' second', $totalTime),
|
||||
true
|
||||
@@ -787,7 +776,7 @@ class ProcessReleases
|
||||
if (random_int(0, 200) <= 1) {
|
||||
// CBP collection orphaned with no binaries or parts.
|
||||
if ($this->echoCLI) {
|
||||
echo $this->colorCli->header('Process Releases -> Remove CBP orphans.'.PHP_EOL).$this->colorCli->primary('Deleting orphaned collections.');
|
||||
echo $this->consoleTools->header('Process Releases -> Remove CBP orphans.'.PHP_EOL).$this->consoleTools->primary('Deleting orphaned collections.');
|
||||
}
|
||||
|
||||
$deleted = 0;
|
||||
@@ -801,12 +790,12 @@ class ProcessReleases
|
||||
$totalTime = now()->diffInSeconds($firstQuery);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary('Finished deleting '.$deleted.' orphaned collections in '.$totalTime.Str::plural(' second', $totalTime), true);
|
||||
$this->consoleTools->primary('Finished deleting '.$deleted.' orphaned collections in '.$totalTime.Str::plural(' second', $totalTime), true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary('Deleting collections that were missed after NZB creation.', true);
|
||||
$this->consoleTools->primary('Deleting collections that were missed after NZB creation.', true);
|
||||
}
|
||||
|
||||
$deleted = 0;
|
||||
@@ -823,7 +812,7 @@ class ProcessReleases
|
||||
$totalTime = $fourthQuery->diffInSeconds($startTime);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary('Finished deleting '.$deleted.' collections missed after NZB creation in '.$colDelTime.Str::plural(' second', $colDelTime).PHP_EOL.'Removed '.number_format($deletedCount).' parts/binaries/collection rows in '.$totalTime.Str::plural(' second', $totalTime), true);
|
||||
$this->consoleTools->primary('Finished deleting '.$deleted.' collections missed after NZB creation in '.$colDelTime.Str::plural(' second', $colDelTime).PHP_EOL.'Removed '.number_format($deletedCount).' parts/binaries/collection rows in '.$totalTime.Str::plural(' second', $totalTime), true);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
@@ -843,7 +832,7 @@ class ProcessReleases
|
||||
$minSizeDeleted = $maxSizeDeleted = $minFilesDeleted = 0;
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Delete releases smaller/larger than minimum size/file count from group/site setting.');
|
||||
$this->consoleTools->header('Process Releases -> Delete releases smaller/larger than minimum size/file count from group/site setting.');
|
||||
}
|
||||
|
||||
$groupID === '' ? $groupIDs = UsenetGroup::getActiveIDs() : $groupIDs = [['id' => $groupID]];
|
||||
@@ -878,7 +867,7 @@ class ProcessReleases
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
'Deleted '.($minSizeDeleted + $maxSizeDeleted + $minFilesDeleted).
|
||||
' releases: '.PHP_EOL.
|
||||
$minSizeDeleted.' smaller than, '.$maxSizeDeleted.' bigger than, '.$minFilesDeleted.
|
||||
@@ -905,7 +894,7 @@ class ProcessReleases
|
||||
|
||||
// Delete old releases and finished collections.
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->header('Process Releases -> Delete old releases and passworded releases.');
|
||||
$this->consoleTools->header('Process Releases -> Delete old releases and passworded releases.');
|
||||
}
|
||||
|
||||
// Releases past retention.
|
||||
@@ -1014,7 +1003,7 @@ class ProcessReleases
|
||||
}
|
||||
|
||||
if ($this->echoCLI) {
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
'Removed releases: '.
|
||||
number_format($retentionDeleted).
|
||||
' past retention, '.
|
||||
@@ -1047,7 +1036,7 @@ class ProcessReleases
|
||||
);
|
||||
if ($totalDeleted > 0) {
|
||||
$totalTime = now()->diffInSeconds($startTime);
|
||||
$this->colorCli->primary(
|
||||
$this->consoleTools->primary(
|
||||
'Removed '.number_format($totalDeleted).' releases in '.
|
||||
$totalTime.Str::plural(' second', $totalTime),
|
||||
true
|
||||
@@ -1286,7 +1275,7 @@ class ProcessReleases
|
||||
}
|
||||
$obj = $objQuery->delete();
|
||||
if ($this->echoCLI && $obj > 0) {
|
||||
$this->colorCli->primary('Deleted '.$obj.' broken/stuck collections.', true);
|
||||
$this->consoleTools->primary('Deleted '.$obj.' broken/stuck collections.', true);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Blacklight\processing;
|
||||
use App\Models\Video;
|
||||
use App\Models\TvInfo;
|
||||
use App\Models\VideoAlias;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/**
|
||||
@@ -37,7 +36,6 @@ abstract class Videos
|
||||
protected const TYPE_FILM = 1; // Type of video is a Film/Movie
|
||||
protected const TYPE_ANIME = 2; // Type of video is a Anime
|
||||
|
||||
protected $pdo;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@@ -61,7 +59,6 @@ abstract class Videos
|
||||
];
|
||||
$options += $defaults;
|
||||
|
||||
$this->pdo = DB::connection()->getPdo();
|
||||
$this->echooutput = ($options['Echo'] && config('nntmux.echocli'));
|
||||
$this->titleCache = [];
|
||||
}
|
||||
|
||||
@@ -262,32 +262,36 @@ class Popporn extends AdultMovies
|
||||
$this->_response = getRawHtml(self::POPURL.$this->_trailUrl, $this->cookie);
|
||||
if ($this->_response !== false) {
|
||||
if ($ret = $this->_html->loadHtml($this->_response)->find('div.product-info, div.title', 1)) {
|
||||
$this->_title = trim($ret->plaintext);
|
||||
$title = str_replace('XXX', '', $ret->plaintext);
|
||||
$title = trim(preg_replace('/\(.*?\)|[._-]/i', ' ', $title));
|
||||
similar_text(strtolower($movie), strtolower($title), $p);
|
||||
if ($p >= 90) {
|
||||
if ($ret = $ret->findOne('a')) {
|
||||
$this->_trailUrl = trim($ret->href);
|
||||
unset($this->_response);
|
||||
$this->_response = getRawHtml(self::POPURL.$this->_trailUrl, $this->cookie);
|
||||
if ($this->_response !== false) {
|
||||
$this->_html->loadHtml($this->_response);
|
||||
if ($ret = $this->_html->findOne('#link-to-this')) {
|
||||
$this->_directUrl = trim($ret->href);
|
||||
unset($this->_response);
|
||||
$this->_response = getRawHtml($this->_directUrl, $this->cookie);
|
||||
if (! empty($ret->plaintext)) {
|
||||
$this->_title = trim($ret->plaintext);
|
||||
$title = str_replace('XXX', '', $ret->plaintext);
|
||||
$title = trim(preg_replace('/\(.*?\)|[._-]/i', ' ', $title));
|
||||
similar_text(strtolower($movie), strtolower($title), $p);
|
||||
if ($p >= 90) {
|
||||
if ($ret = $ret->findOne('a')) {
|
||||
$this->_trailUrl = trim($ret->href);
|
||||
unset($this->_response);
|
||||
$this->_response = getRawHtml(self::POPURL.$this->_trailUrl, $this->cookie);
|
||||
if ($this->_response !== false) {
|
||||
$this->_html->loadHtml($this->_response);
|
||||
if ($ret = $this->_html->findOne('#link-to-this')) {
|
||||
$this->_directUrl = trim($ret->href);
|
||||
unset($this->_response);
|
||||
$this->_response = getRawHtml($this->_directUrl, $this->cookie);
|
||||
$this->_html->loadHtml($this->_response);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$this->_response = getRawHtml(self::IF18, $this->cookie);
|
||||
|
||||
@@ -58,7 +58,6 @@ class AniDB
|
||||
$options += $defaults;
|
||||
|
||||
$this->echooutput = ($options['Echo'] && config('nntmux.echocli'));
|
||||
$this->pdo = DB::connection()->getPdo();
|
||||
$this->padb = new PaDb(['Echo' => $options['Echo']]);
|
||||
$this->colorCli = new ColorCLI();
|
||||
|
||||
|
||||
@@ -804,24 +804,24 @@ class ProcessAdditional
|
||||
{
|
||||
$nzbPath = $this->_nzb->NZBPath($this->_release->guid);
|
||||
if ($nzbPath === false) {
|
||||
$this->_echo('NZB not found for GUID: '.$this->_release->guid.', deleting the release.', 'warning');
|
||||
$this->_echo('NZB not found for GUID: '.$this->_release->guid, 'warning');
|
||||
|
||||
$this->_deleteRelease();
|
||||
$this->_decrementPasswordStatus();
|
||||
}
|
||||
|
||||
$nzbContents = Utility::unzipGzipFile($nzbPath);
|
||||
if (! $nzbContents) {
|
||||
$this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid.', deleting the release.', 'warning');
|
||||
$this->_echo('NZB is empty or broken for GUID: '.$this->_release->guid, 'warning');
|
||||
|
||||
$this->_deleteRelease();
|
||||
$this->_decrementPasswordStatus();
|
||||
}
|
||||
|
||||
// Get a list of files in the nzb.
|
||||
$this->_nzbContents = $this->_nzb->nzbFileList($nzbContents, ['no-file-key' => false, 'strip-count' => true]);
|
||||
if (\count($this->_nzbContents) === 0) {
|
||||
$this->_echo('NZB is potentially broken for GUID: '.$this->_release->guid.', deleting the release.', 'warning');
|
||||
$this->_echo('NZB is potentially broken for GUID: '.$this->_release->guid, 'warning');
|
||||
|
||||
$this->_deleteRelease();
|
||||
$this->_decrementPasswordStatus();
|
||||
}
|
||||
// Sort keys.
|
||||
ksort($this->_nzbContents, SORT_NATURAL);
|
||||
|
||||
@@ -54,7 +54,7 @@ class Git extends GitRepository
|
||||
$options += $defaults;
|
||||
|
||||
parent::__construct($options['filepath']);
|
||||
$this->branch = parent::getCurrentBranchName();
|
||||
$this->branch = $this->getCurrentBranchName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,115 @@
|
||||
2019-05-09 DariusIII
|
||||
* Chg: Update fontawesome and tinyMCE to latest versions
|
||||
* Fix: Fix browse queries and add back missing jpgstatus column select (should fix missing sample button on browse pages)
|
||||
2019-05-08 DariusIII
|
||||
* Fix: Fix adding user from admin area (fixes issue #972)
|
||||
* Chg: Update profile deletion behaviour
|
||||
2019-05-07 DariusIII
|
||||
* Chg: Fix code style of many files
|
||||
* Chg: Update code fixing in dev, used libraries and laravel/framework to latest versions
|
||||
2019-05-05 DariusIII
|
||||
* Chg: Update pnotify to version 4.0.0 and tinyMCE to latest version
|
||||
2019-05-03 DariusIII
|
||||
* Chg: Update laravel/framework and rest of the used libraries to their latest versions
|
||||
2019-04-28 DariusIII
|
||||
* Chg: Add option to disable purging of inactive user accounts
|
||||
* Fix: Throw API error if apikey is missing
|
||||
* Chg: Update nesbot/carbon (2.17.0 => 2.17.1) and intervention/imagecache (2.3.3 => 2.3.4)
|
||||
2019-04-25 DariusIII
|
||||
* Chg: Update laravel/framework (v5.8.13 => v5.8.14) and other libraries
|
||||
* Chg: Exclude admin area from csrf protection
|
||||
2019-04-22 DariusIII
|
||||
* Chg: Add failed route to csrf protection exclusion
|
||||
* Chg: Update imdbphp/imdbphp (v6.2.0 => v6.2.1)
|
||||
2019-04-21 DariusIII
|
||||
* Fix: Fix error related to $user variable in RssController
|
||||
* Chg: Update used libraries to latest versions
|
||||
2019-04-18 DariusIII
|
||||
* Chg: Update laravel/framework and nesbot/carbon to latest versions
|
||||
2019-04-17 DariusIII
|
||||
* Chg: Update symfony components
|
||||
2019-04-16 DariusIII
|
||||
* Chg: Add back genealabs/laravel-caffeine
|
||||
* Chg: Update used libraries to their latest versions
|
||||
2019-04-15 DariusIII
|
||||
* Chg: Update recategorize.php script
|
||||
* Chg: Update XXX UHD and XXX ClipSD matching regexes
|
||||
* Fix: Fix predb_import_daily_batch.php script (Fixes issue #970)
|
||||
* Chg: Update package.json
|
||||
* Chg: ConsoleTools now extends ColorCLI class
|
||||
* Chg: Remove unused PDO class instantiation
|
||||
* Chg: Remove $this->pdo as it is not used
|
||||
* Chg: Remove unused ReleaseSearch class
|
||||
2019-04-14 DariusIII
|
||||
* Fix: Fix test-ReleaseCleaner.php script (Fixes issue #965)
|
||||
2019-04-11 DariusIII
|
||||
* Chg: Use $this-> in Git class
|
||||
* Chg: Update usage of $this->userdata in controllers
|
||||
2019-04-10 DariusIII
|
||||
* Chg: Update laravel/framework (v5.8.10 => v5.8.11)
|
||||
* Chg: Reduce querying of users table in ProfileController, simplify role and permissions code checks
|
||||
* Fix: Fix wrong table name used in RootCategoriesTableSeeder class
|
||||
2019-04-09 DariusIII
|
||||
* Chg: Update spatie/laravel-permission (2.36.1 => 2.37.0)
|
||||
* Chg: Update clue/stream-filter (v1.4.0 => v1.4.1)
|
||||
* Chg: Update BasePageController to update lastlogin every 3 hours for better new releases handling
|
||||
2019-04-08 DariusIII
|
||||
* Chg: Update BasePageController, change 15 minute last login update code
|
||||
* Chg: Update pear/archive_tar (1.4.6 => 1.4.7)
|
||||
* Chg: Update misc/testing/DB/change_imdb_column.php script
|
||||
* Chg: Update browse.tpl
|
||||
2019-04-07 DariusIII
|
||||
* Chg: Update myclabs/deep-copy (1.8.1 => 1.9.0)
|
||||
2019-04-06 DariusIII
|
||||
* Chg: Update nesbot/carbon (2.16.2 => 2.16.3)
|
||||
* Chg: Remove padding of imdbid as column is now varchar and stores imdbid properly
|
||||
* Chg: Use our own is_it_json function
|
||||
2019-04-05 DariusIII
|
||||
* Fix: Update Forking class, fix releases check query
|
||||
* Chg: Use output of userCheck if it passes the json check
|
||||
* Chg: Don't use constant for multiprocessing path, use the path directly
|
||||
2019-04-04 DariusIII
|
||||
* Chg: Update laravel/framework (v5.8.9 => v5.8.10)
|
||||
* Chg: Add migrations and update themes for new imdbid length
|
||||
* Chg: Update releases, movieinfo and user_movies migrations imdbid column definition to be string(varchar in mysql) due to changes in imdbid numbering
|
||||
* Chg: Add nntmux shell command script to shorten typing (ie ./nntmux nntmux:all in place of php artisan nntmux:all command)
|
||||
2019-04-03 DariusIII
|
||||
* Chg: Update tmux install script to install Tmux version 2.9
|
||||
* Chg: Update used libraries
|
||||
* Chg: Update env.example with multiprocessing switches and use them in nntmux config and Forking
|
||||
* Chg: Remove deleting of releases by group as non-mgr mode does not exist anymore
|
||||
2019-04-02 DariusIII
|
||||
* Chg: Update symfony components to their latest versions and downgrade voku/simple_html_dom
|
||||
* Chg: Update laravel/framework (v5.8.8 => v5.8.9)
|
||||
2019-04-01 DariusIII
|
||||
* Chg: Move check for PPA queue inside main PPA function
|
||||
* Chg: Check if title check returns no result in PopPorn class
|
||||
* CHg: Revert to old behavior on bad nzb (decrement password status, do not delete the release)
|
||||
* Fix: Fix bad check for debug condition in Forking
|
||||
* Chg: Use now() helper in Forking date display
|
||||
* Chg: Update used libraries to their latest versions
|
||||
2019-03-31 DariusIII
|
||||
* Chg: Update Date output
|
||||
2019-03-29 DariusIII
|
||||
* Chg: Add timeout to Forking class
|
||||
2019-03-28 DariusIII
|
||||
* Chg: Separate PPA from rest of the postprocessing
|
||||
* Chg: Adjust output messages for binaries and releases processing
|
||||
* Chg: Revert all but PPA to older behaviour
|
||||
2019-03-27 DariusIII
|
||||
* Chg: Remove $groups assignment from queries and use $this->work
|
||||
* Chg: Switch back to using PHP_BINARY in Forking in place of php
|
||||
* Fix: Fix queries for nfo, tv and movies postprocessing
|
||||
* Chg: Update returned messages after thread is finished
|
||||
2019-03-26 DariusIII
|
||||
* Chg: Update ForkingImportNZB
|
||||
2019-03-25 DariusIII
|
||||
* Chg: Update multiprocessing scripts
|
||||
* Chg: Update Forking class to use spatie/async
|
||||
2019-03-22 DariusIII
|
||||
* Chg: Add spatie/async
|
||||
* Chg: Update symfony components
|
||||
* Chg: Update doctrine/instantiator (1.1.0 => 1.2.0)
|
||||
* Chg: Update laravel/framework (v5.8.5 => v5.8.7)
|
||||
2019-03-21 DariusIII
|
||||
* Fix: Fix logic and add check for duplicated data
|
||||
|
||||
@@ -30,7 +30,9 @@ class Kernel extends ConsoleKernel
|
||||
$schedule->exec('php '.base_path().'/misc/testing/DB/checkUsers.php')->twiceDaily(1, 13);
|
||||
$schedule->command('telescope:prune')->daily();
|
||||
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
||||
$schedule->job(new RemoveInactiveAccounts())->daily();
|
||||
if (config('nntmux.purge_inactive_users') === true) {
|
||||
$schedule->job(new RemoveInactiveAccounts())->daily();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -333,4 +333,21 @@ if (! function_exists('makeFieldLinks')) {
|
||||
return sprintf('%02dh:%02dm:%02ds', $time / 3600, $time / 60 % 60, $time % 60);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('is_it_json')) {
|
||||
|
||||
/**
|
||||
* @param array|string $isIt
|
||||
* @return bool
|
||||
*/
|
||||
function is_it_json($isIt)
|
||||
{
|
||||
if (is_array($isIt)) {
|
||||
return false;
|
||||
}
|
||||
json_decode($isIt);
|
||||
|
||||
return json_last_error() === JSON_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class MovieController extends BasePageController
|
||||
|
||||
$meta_title = $title = 'Movie Add';
|
||||
|
||||
$id = str_pad($request->input('id'), 7, '0', STR_PAD_LEFT);
|
||||
$id = $request->input('id');
|
||||
|
||||
if ($request->has('id') && \strlen($id) === 7) {
|
||||
$movCheck = $movie->getMovieInfo($id);
|
||||
|
||||
@@ -75,8 +75,8 @@ class UserController extends BasePageController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
@@ -134,7 +134,7 @@ class UserController extends BasePageController
|
||||
$invites = $role['defaultinvites'];
|
||||
}
|
||||
}
|
||||
$ret = User::signUp($request->input('username'), $request->input('password'), $request->input('email'), '', $request->input('notes'), $invites, '', true, $request->input('role'));
|
||||
$ret = User::signUp($request->input('username'), $request->input('password'), $request->input('email'), '', $request->input('notes'), $invites, '', true, $request->input('role'), false);
|
||||
$this->smarty->assign('role', $request->input('role'));
|
||||
} else {
|
||||
$editedUser = User::find($request->input('id'));
|
||||
|
||||
@@ -69,7 +69,7 @@ class ApiController extends BasePageController
|
||||
// Page is accessible only by the apikey
|
||||
|
||||
if ($function !== 'c' && $function !== 'r') {
|
||||
if (! $request->has('apikey')) {
|
||||
if (! $request->has('apikey') || ($request->has('apikey') && empty($request->input('apikey')))) {
|
||||
Utility::showApiError(200, 'Missing parameter (apikey)');
|
||||
} else {
|
||||
$apiKey = $request->input('apikey');
|
||||
|
||||
@@ -230,11 +230,11 @@ class BasePageController extends Controller
|
||||
*/
|
||||
protected function setUserPreferences(): void
|
||||
{
|
||||
$this->userdata['categoryexclusions'] = User::getCategoryExclusionById(Auth::id());
|
||||
$this->userdata->categoryexclusions = User::getCategoryExclusionById(Auth::id());
|
||||
|
||||
// Change the theme to user's selected theme if they selected one, else use the admin one.
|
||||
if ((int) Settings::settingValue('site.main.userselstyle') === 1) {
|
||||
$this->theme = $this->userdata['style'] ?? 'None';
|
||||
$this->theme = $this->userdata->style ?? 'None';
|
||||
if ($this->theme === 'None') {
|
||||
$this->theme = Settings::settingValue('site.main.style');
|
||||
}
|
||||
@@ -243,14 +243,14 @@ class BasePageController extends Controller
|
||||
}
|
||||
|
||||
// Update last login every 15 mins.
|
||||
if ((strtotime($this->userdata['now']) - 900) > strtotime($this->userdata['lastlogin'])) {
|
||||
if (now()->subHours(3) > $this->userdata->lastlogin) {
|
||||
event(new UserLoggedIn($this->userdata));
|
||||
}
|
||||
|
||||
$this->smarty->assign('userdata', $this->userdata);
|
||||
$this->smarty->assign('loggedin', 'true');
|
||||
|
||||
if ($this->userdata['nzbvortex_api_key'] !== '' && $this->userdata['nzbvortex_server_url'] !== '') {
|
||||
if ($this->userdata->nzbvortex_api_key !== '' && $this->userdata->nzbvortex_server_url !== '') {
|
||||
$this->smarty->assign('weHasVortex', true);
|
||||
} else {
|
||||
$this->smarty->assign('weHasVortex', false);
|
||||
@@ -278,7 +278,7 @@ class BasePageController extends Controller
|
||||
|
||||
$role = User::ROLE_USER;
|
||||
if (! empty($this->userdata)) {
|
||||
$role = $this->userdata['roles_id'];
|
||||
$role = $this->userdata->roles_id;
|
||||
}
|
||||
|
||||
$content = new Contents();
|
||||
@@ -288,7 +288,7 @@ class BasePageController extends Controller
|
||||
$this->smarty->assign('recentforumpostslist', Forumpost::getPosts(Settings::settingValue('..showrecentforumposts')));
|
||||
}
|
||||
|
||||
$parentcatlist = Category::getForMenu($this->userdata['categoryexclusions']);
|
||||
$parentcatlist = Category::getForMenu($this->userdata->categoryexclusions);
|
||||
|
||||
$this->smarty->assign('parentcatlist', $parentcatlist);
|
||||
$this->smarty->assign('catClass', Category::class);
|
||||
|
||||
@@ -53,7 +53,7 @@ class BooksController extends BasePageController
|
||||
$books = [];
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
|
||||
$rslt = $book->getBookRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata['categoryexclusions']);
|
||||
$rslt = $book->getBookRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
|
||||
$maxwords = 50;
|
||||
foreach ($results as $result) {
|
||||
|
||||
@@ -23,12 +23,12 @@ class BrowseController extends BasePageController
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata['categoryexclusions'], -1);
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata->categoryexclusions, -1);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
|
||||
$this->smarty->assign('catname', 'All');
|
||||
|
||||
$this->smarty->assign('lastvisit', $this->userdata['lastlogin']);
|
||||
$this->smarty->assign('lastvisit', $this->userdata->lastlogin);
|
||||
|
||||
foreach ($results as $result) {
|
||||
$browse[] = $result;
|
||||
@@ -82,7 +82,7 @@ class BrowseController extends BasePageController
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
|
||||
$rslt = $releases->getBrowseRange($page, $catarray, $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata['categoryexclusions'], $grp);
|
||||
$rslt = $releases->getBrowseRange($page, $catarray, $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata->categoryexclusions, $grp);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
|
||||
$browse = [];
|
||||
@@ -93,7 +93,7 @@ class BrowseController extends BasePageController
|
||||
|
||||
$this->smarty->assign('catname', $id);
|
||||
|
||||
$this->smarty->assign('lastvisit', $this->userdata['lastlogin']);
|
||||
$this->smarty->assign('lastvisit', $this->userdata->lastlogin);
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
@@ -151,7 +151,7 @@ class BrowseController extends BasePageController
|
||||
$group = $request->input('g');
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), '', -1, $this->userdata['categoryexclusions'], $group);
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), '', -1, $this->userdata->categoryexclusions, $group);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
|
||||
$browse = [];
|
||||
@@ -191,7 +191,7 @@ class BrowseController extends BasePageController
|
||||
$tags = explode(',', $request->input('tags'));
|
||||
$page = request()->has('page') && is_numeric(request()->input('page')) ? request()->input('page') : 1;
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), '', -1, $this->userdata['categoryexclusions'], -1, 0, $tags);
|
||||
$rslt = $releases->getBrowseRange($page, [-1], $offset, config('nntmux.items_per_page'), '', -1, $this->userdata->categoryexclusions, -1, 0, $tags);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
|
||||
$browse = [];
|
||||
|
||||
@@ -57,7 +57,7 @@ class ConsoleController extends BasePageController
|
||||
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
|
||||
|
||||
$consoles = [];
|
||||
$rslt = $console->getConsoleRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata['categoryexclusions']);
|
||||
$rslt = $console->getConsoleRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$maxwords = 50;
|
||||
|
||||
@@ -20,7 +20,7 @@ class ContentController extends BasePageController
|
||||
|
||||
$role = 0;
|
||||
if (! empty($this->userdata)) {
|
||||
$role = $this->userdata['role'];
|
||||
$role = $this->userdata->role;
|
||||
}
|
||||
|
||||
/* The role column in the content table values are :
|
||||
|
||||
@@ -58,7 +58,7 @@ class DetailsController extends BasePageController
|
||||
$reAudio = $re->getAudio($data['id']);
|
||||
$reSubs = $re->getSubs($data['id']);
|
||||
$comments = ReleaseComment::getComments($data['id']);
|
||||
$similars = $releases->searchSimilar($data['id'], $data['searchname'], $this->userdata['categoryexclusions']);
|
||||
$similars = $releases->searchSimilar($data['id'], $data['searchname'], $this->userdata->categoryexclusions);
|
||||
$failed = DnzbFailure::getFailedCount($data['id']);
|
||||
$downloadedBy = UserDownload::query()->with('user')->where('releases_id', $data['id'])->get(['users_id']);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class GamesController extends BasePageController
|
||||
$ordering = $games->getGamesOrdering();
|
||||
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
|
||||
$offset = ($page - 1) * config('nntmux.items_per_cover_page');
|
||||
$rslt = $games->getGamesRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, '', $this->userdata['categoryexclusions']);
|
||||
$rslt = $games->getGamesRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, '', $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$title = ($request->has('title') && ! empty($request->input('title'))) ? stripslashes($request->input('title')) : '';
|
||||
|
||||
@@ -29,7 +29,7 @@ class GetNzbController extends BasePageController
|
||||
if (Auth::check()) {
|
||||
$uid = $this->userdata->id;
|
||||
$maxDownloads = $this->userdata->role->downloadrequests;
|
||||
$rssToken = $this->userdata['api_token'];
|
||||
$rssToken = $this->userdata->api_token;
|
||||
if ($this->userdata->hasRole('Disabled')) {
|
||||
Utility::showApiError(101);
|
||||
}
|
||||
|
||||
@@ -79,10 +79,8 @@ class MovieController extends BasePageController
|
||||
$category = $cat !== null ? $cat['id'] : Category::MOVIE_ROOT;
|
||||
}
|
||||
|
||||
$cpapi = $this->userdata['cp_api'];
|
||||
$cpurl = $this->userdata['cp_url'];
|
||||
$this->smarty->assign('cpapi', $cpapi);
|
||||
$this->smarty->assign('cpurl', $cpurl);
|
||||
$this->smarty->assign('cpapi', $this->userdata->cp_api);
|
||||
$this->smarty->assign('cpurl', $this->userdata->cp_url);
|
||||
|
||||
$catarray = [];
|
||||
if ((int) $category !== -1) {
|
||||
@@ -100,7 +98,7 @@ class MovieController extends BasePageController
|
||||
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
|
||||
|
||||
$movies = [];
|
||||
$rslt = $movie->getMovieRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata['categoryexclusions']);
|
||||
$rslt = $movie->getMovieRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, -1, $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
|
||||
|
||||
foreach ($results as $result) {
|
||||
|
||||
@@ -54,7 +54,7 @@ class MusicController extends BasePageController
|
||||
$orderby = request()->has('ob') && \in_array(request()->input('ob'), $ordering, false) ? request()->input('ob') : '';
|
||||
|
||||
$musics = [];
|
||||
$rslt = $music->getMusicRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata['categoryexclusions']);
|
||||
$rslt = $music->getMusicRange($page, $catarray, $offset, config('nntmux.items_per_cover_page'), $orderby, $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $rslt[0]->_totalcount ?? 0, config('nntmux.items_per_cover_page'), $page, $request->url(), $request->query());
|
||||
|
||||
$artist = ($request->has('artist') && ! empty($request->input('artist'))) ? stripslashes($request->input('artist')) : '';
|
||||
|
||||
@@ -59,7 +59,7 @@ class MyMoviesController extends BasePageController
|
||||
|
||||
if ($action === 'doadd') {
|
||||
$category = ($request->has('category') && \is_array($request->input('category')) && ! empty($request->input('category'))) ? $request->input('category') : [];
|
||||
UserMovie::addMovie($this->userdata->id, str_pad($imdbid, 7, '0', STR_PAD_LEFT), $category);
|
||||
UserMovie::addMovie($this->userdata->id, $imdbid, $category);
|
||||
if ($request->has('from')) {
|
||||
return redirect($request->input('from'));
|
||||
}
|
||||
@@ -152,7 +152,7 @@ class MyMoviesController extends BasePageController
|
||||
|
||||
$page = $request->has('page') && is_numeric($request->input('page')) ? $request->input('page') : 1;
|
||||
|
||||
$results = $mv->getMovieRange($page, $movie['categoryNames'], $offset, config('nntmux.items_per_cover_page'), $ordering, -1, $this->userdata['categoryexclusions']);
|
||||
$results = $mv->getMovieRange($page, $movie['categoryNames'], $offset, config('nntmux.items_per_cover_page'), $ordering, -1, $this->userdata->categoryexclusions);
|
||||
|
||||
$this->smarty->assign('covgroup', '');
|
||||
|
||||
@@ -160,7 +160,7 @@ class MyMoviesController extends BasePageController
|
||||
$this->smarty->assign('orderby'.$ordertype, WWW_TOP.'/mymovies/browse?ob='.$ordertype.'&offset=0');
|
||||
}
|
||||
|
||||
$this->smarty->assign('lastvisit', $this->userdata['lastlogin']);
|
||||
$this->smarty->assign('lastvisit', $this->userdata->lastlogin);
|
||||
|
||||
$this->smarty->assign('results', $results);
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ class MyShowsController extends BasePageController
|
||||
$results = [];
|
||||
foreach ($shows as $showk => $show) {
|
||||
$showcats = explode('|', $show['categories']);
|
||||
if (\is_array($showcats) && \count($showcats) > 0) {
|
||||
if (\is_array($showcats) && ! empty($showcats)) {
|
||||
$catarr = [];
|
||||
foreach ($showcats as $scat) {
|
||||
if (! empty($scat)) {
|
||||
@@ -183,9 +183,9 @@ class MyShowsController extends BasePageController
|
||||
$offset = ($page - 1) * config('nntmux.items_per_page');
|
||||
$ordering = $releases->getBrowseOrdering();
|
||||
$orderby = $request->has('ob') && \in_array($request->input('ob'), $ordering, false) ? $request->input('ob') : '';
|
||||
$browseCount = $releases->getShowsCount($shows, -1, $this->userdata['categoryexclusions']);
|
||||
$browseCount = $releases->getShowsCount($shows, -1, $this->userdata->categoryexclusions);
|
||||
|
||||
$rslt = $releases->getShowsRange($shows ?? [], $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata['categoryexclusions']);
|
||||
$rslt = $releases->getShowsRange($shows ?? [], $offset, config('nntmux.items_per_page'), $orderby, -1, $this->userdata->categoryexclusions);
|
||||
$results = $this->paginate($rslt ?? [], $browseCount, config('nntmux.items_per_page'), $page, request()->url(), request()->query());
|
||||
|
||||
$this->smarty->assign('covgroup', '');
|
||||
@@ -194,7 +194,7 @@ class MyShowsController extends BasePageController
|
||||
$this->smarty->assign('orderby'.$ordertype, WWW_TOP.'/myshows/browse?ob='.$ordertype.'&offset=0');
|
||||
}
|
||||
|
||||
$this->smarty->assign('lastvisit', $this->userdata['lastlogin']);
|
||||
$this->smarty->assign('lastvisit', $this->userdata->lastlogin);
|
||||
|
||||
$this->smarty->assign(['results' => $results, 'resultsadd' => $rslt]);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Models\UserDownload;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\ReleaseComment;
|
||||
use Blacklight\utility\Utility;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Jrean\UserVerification\Facades\UserVerification;
|
||||
|
||||
@@ -53,21 +54,20 @@ class ProfileController extends BasePageController
|
||||
$downloadList = UserDownload::getDownloadRequestsForUser($userID);
|
||||
$this->smarty->assign('downloadlist', $downloadList);
|
||||
|
||||
$data = User::find($userID);
|
||||
if ($data === null) {
|
||||
if ($this->userdata === null) {
|
||||
$this->show404('No such user!');
|
||||
}
|
||||
|
||||
// Check if the user selected a theme.
|
||||
if (! isset($data['style']) || $data['style'] === 'None') {
|
||||
$data['style'] = 'Using the admin selected theme.';
|
||||
if (! isset($this->userdata->style) || $this->userdata->style === 'None') {
|
||||
$this->userdata->style = 'Using the admin selected theme.';
|
||||
}
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'apirequests' => UserRequest::getApiRequests($userID),
|
||||
'grabstoday' => UserDownload::getDownloadRequests($userID),
|
||||
'userinvitedby' => $data['invitedby'] !== '' ? User::find($data['invitedby']) : '',
|
||||
'user' => $data,
|
||||
'userinvitedby' => $this->userdata->invitedby !== '' ? User::find($this->userdata->invitedby) : '',
|
||||
'user' => $this->userdata,
|
||||
'privateprofiles' => $privateProfiles,
|
||||
'publicview' => $publicView,
|
||||
'privileged' => $privileged,
|
||||
@@ -98,7 +98,7 @@ class ProfileController extends BasePageController
|
||||
|
||||
$meta_title = 'View User Profile';
|
||||
$meta_keywords = 'view,profile,user,details';
|
||||
$meta_description = 'View User Profile for '.$data['username'];
|
||||
$meta_description = 'View User Profile for '.$this->userdata->username;
|
||||
|
||||
$content = $this->smarty->fetch('profile.tpl');
|
||||
|
||||
@@ -128,8 +128,7 @@ class ProfileController extends BasePageController
|
||||
$action = $request->input('action') ?? 'view';
|
||||
|
||||
$userid = $this->userdata->id;
|
||||
$data = User::find($userid);
|
||||
if (! $data) {
|
||||
if (! $this->userdata) {
|
||||
$this->show404('No such user!');
|
||||
}
|
||||
|
||||
@@ -170,12 +169,12 @@ class ProfileController extends BasePageController
|
||||
|
||||
User::updateUser(
|
||||
$userid,
|
||||
$data['username'],
|
||||
$this->userdata->username,
|
||||
$request->input('email'),
|
||||
$data['grabs'],
|
||||
$data['roles_id'],
|
||||
$data['notes'],
|
||||
$data['invites'],
|
||||
$this->userdata->grabs,
|
||||
$this->userdata->roles_id,
|
||||
$this->userdata->notes,
|
||||
$this->userdata->invites,
|
||||
$request->has('movieview') ? 1 : 0,
|
||||
$request->has('musicview') ? 1 : 0,
|
||||
$request->has('gameview') ? 1 : 0,
|
||||
@@ -197,80 +196,80 @@ class ProfileController extends BasePageController
|
||||
(int) Settings::settingValue('site.main.userselstyle') === 1 ? $request->input('style') : 'None'
|
||||
);
|
||||
|
||||
if ((int) $request->input('viewconsole') === 1 && $data->role->hasPermissionTo('view console') === true && ! $data->hasDirectPermission('view console')) {
|
||||
$data->givePermissionTo('view console');
|
||||
} elseif ((int) $request->input('viewconsole') === 0 && $data->role->hasPermissionTo('view console') === true && $data->hasPermissionTo('view console')) {
|
||||
$data->revokePermissionTo('view console');
|
||||
} elseif ($data->role->hasPermissionTo('view console') === false && $data->hasDirectPermission('view console') && ((int) $request->input('viewconsole') === 0 || (int) $request->input('viewconsole') === 1)) {
|
||||
$data->revokePermissionTo('view console');
|
||||
if ((int) $request->input('viewconsole') === 1 && $this->userdata->can('view console') && ! $this->userdata->hasDirectPermission('view console')) {
|
||||
$this->userdata->givePermissionTo('view console');
|
||||
} elseif ((int) $request->input('viewconsole') === 0 && $this->userdata->can('view console') && $this->userdata->hasDirectPermission('view console')) {
|
||||
$this->userdata->revokePermissionTo('view console');
|
||||
} elseif ($this->userdata->cant('view console') && \in_array((int) $request->input('viewconsole'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view console');
|
||||
}
|
||||
|
||||
if ((int) $request->input('viewmovies') === 1 && $data->role->hasPermissionTo('view movies') === true && ! $data->hasDirectPermission('view movies')) {
|
||||
$data->givePermissionTo('view movies');
|
||||
} elseif ((int) $request->input('viewmovies') === 0 && $data->role->hasPermissionTo('view movies') === true && $data->hasDirectPermission('view movies')) {
|
||||
$data->revokePermissionTo('view movies');
|
||||
} elseif ($data->role->hasPermissionTo('view movies') === false && $data->hasDirectPermission('view movies') && ((int) $request->input('viewmovies') === 0 || (int) $request->input('viewmovies') === 1)) {
|
||||
$data->revokePermissionTo('view movies');
|
||||
if ((int) $request->input('viewmovies') === 1 && $this->userdata->can('view movies') && ! $this->userdata->hasDirectPermission('view movies')) {
|
||||
$this->userdata->givePermissionTo('view movies');
|
||||
} elseif ((int) $request->input('viewmovies') === 0 && $this->userdata->can('view movies') && $this->userdata->hasDirectPermission('view movies')) {
|
||||
$this->userdata->revokePermissionTo('view movies');
|
||||
} elseif ($this->userdata->cant('view movies') && $this->userdata->hasDirectPermission('view movies') && \in_array((int) $request->input('viewmovies'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view movies');
|
||||
}
|
||||
|
||||
if ((int) $request->input('viewaudio') === 1 && $data->role->hasPermissionTo('view audio') === true && ! $data->hasDirectPermission('view audio')) {
|
||||
$data->givePermissionTo('view audio');
|
||||
} elseif ((int) $request->input('viewaudio') === 0 && $data->role->hasPermissionTo('view audio') === true && $data->hasDirectPermission('view audio')) {
|
||||
$data->revokePermissionTo('view audio');
|
||||
} elseif ($data->role->hasPermissionTo('view audio') === false && $data->hasDirectPermission('view audio') && ((int) $request->input('viewaudio') === 0 || (int) $request->input('viewaudio') === 1)) {
|
||||
$data->revokePermissionTo('view audio');
|
||||
if ((int) $request->input('viewaudio') === 1 && $this->userdata->can('view audio') && ! $this->userdata->hasDirectPermission('view audio')) {
|
||||
$this->userdata->givePermissionTo('view audio');
|
||||
} elseif ((int) $request->input('viewaudio') === 0 && $this->userdata->can('view audio') && $this->userdata->hasDirectPermission('view audio')) {
|
||||
$this->userdata->revokePermissionTo('view audio');
|
||||
} elseif ($this->userdata->cant('view audio') && $this->userdata->hasDirectPermission('view audio') && \in_array((int) $request->input('viewaudio'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view audio');
|
||||
}
|
||||
|
||||
if ((int) $request->input('viewpc') === 1 && $data->role->hasPermissionTo('view pc') === true && ! $data->hasDirectPermission('view pc')) {
|
||||
$data->givePermissionTo('view pc');
|
||||
} elseif ((int) $request->input('viewpc') === 0 && $data->role->hasPermissionTo('view pc') === true && $data->hasDirectPermission('view pc')) {
|
||||
$data->revokePermissionTo('view pc');
|
||||
} elseif ($data->role->hasPermissionTo('view pc') === false && $data->hasDirectPermission('view pc') && ((int) $request->input('viewpc') === 0 || (int) $request->input('viewpc') === 1)) {
|
||||
$data->revokePermissionTo('view pc');
|
||||
if ((int) $request->input('viewpc') === 1 && $this->userdata->can('view pc') && ! $this->userdata->hasDirectPermission('view pc')) {
|
||||
$this->userdata->givePermissionTo('view pc');
|
||||
} elseif ((int) $request->input('viewpc') === 0 && $this->userdata->can('view pc') && $this->userdata->hasDirectPermission('view pc')) {
|
||||
$this->userdata->revokePermissionTo('view pc');
|
||||
} elseif ($this->userdata->cant('view pc') && $this->userdata->hasDirectPermission('view pc') && \in_array((int) $request->input('viewpc'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view pc');
|
||||
}
|
||||
|
||||
if ((int) $request->input('viewtv') === 1 && $data->role->hasPermissionTo('view tv') === true && ! $data->hasDirectPermission('view tv')) {
|
||||
$data->givePermissionTo('view tv');
|
||||
} elseif ((int) $request->input('viewtv') === 0 && $data->role->hasPermissionTo('view tv') === true && $data->hasDirectPermission('view tv')) {
|
||||
$data->revokePermissionTo('view tv');
|
||||
} elseif ($data->role->hasPermissionTo('view tv') === false && $data->hasDirectPermission('view tv') && ((int) $request->input('viewtv') === 0 || (int) $request->input('viewtv') === 1)) {
|
||||
$data->revokePermissionTo('view tv');
|
||||
if ((int) $request->input('viewtv') === 1 && $this->userdata->can('view tv') && ! $this->userdata->hasDirectPermission('view tv')) {
|
||||
$this->userdata->givePermissionTo('view tv');
|
||||
} elseif ((int) $request->input('viewtv') === 0 && $this->userdata->can('view tv') && $this->userdata->hasDirectPermission('view tv')) {
|
||||
$this->userdata->revokePermissionTo('view tv');
|
||||
} elseif ($this->userdata->cant('view tv') && $this->userdata->hasDirectPermission('view tv') && \in_array((int) $request->input('viewtv'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view tv');
|
||||
}
|
||||
|
||||
if ((int) $request->input('viewadult') === 1 && $data->role->hasPermissionTo('view adult') === true && ! $data->hasDirectPermission('view adult')) {
|
||||
$data->givePermissionTo('view adult');
|
||||
} elseif ((int) $request->input('viewadult') === 0 && $data->role->hasPermissionTo('view adult') === true && $data->hasDirectPermission('view adult')) {
|
||||
$data->revokePermissionTo('view adult');
|
||||
} elseif ($data->role->hasPermissionTo('view adult') === false && $data->hasDirectPermission('view adult') && ((int) $request->input('viewadult') === 0 || (int) $request->input('viewadult') === 1)) {
|
||||
$data->revokePermissionTo('view adult');
|
||||
if ((int) $request->input('viewadult') === 1 && $this->userdata->can('view adult') && ! $this->userdata->hasDirectPermission('view adult')) {
|
||||
$this->userdata->givePermissionTo('view adult');
|
||||
} elseif ((int) $request->input('viewadult') === 0 && $this->userdata->can('view adult') && $this->userdata->hasDirectPermission('view adult')) {
|
||||
$this->userdata->revokePermissionTo('view adult');
|
||||
} elseif ($this->userdata->cant('view adult') && $this->userdata->hasDirectPermission('view adult') && \in_array((int) $request->input('viewadult'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view adult');
|
||||
}
|
||||
|
||||
if ((int) $request->input('viewbooks') === 1 && $data->role->hasPermissionTo('view books') === true && ! $data->hasDirectPermission('view books')) {
|
||||
$data->givePermissionTo('view books');
|
||||
} elseif ((int) $request->input('viewbooks') === 0 && $data->role->hasPermissionTo('view books') === true && $data->hasDirectPermission('view books')) {
|
||||
$data->revokePermissionTo('view books');
|
||||
} elseif ($data->role->hasPermissionTo('view books') === false && $data->hasDirectPermission('view books') && ((int) $request->input('viewbooks') === 0 || (int) $request->input('viewbooks') === 1)) {
|
||||
$data->revokePermissionTo('view books');
|
||||
if ((int) $request->input('viewbooks') === 1 && $this->userdata->can('view books') && ! $this->userdata->hasDirectPermission('view books')) {
|
||||
$this->userdata->givePermissionTo('view books');
|
||||
} elseif ((int) $request->input('viewbooks') === 0 && $this->userdata->can('view books') && $this->userdata->hasDirectPermission('view books')) {
|
||||
$this->userdata->revokePermissionTo('view books');
|
||||
} elseif ($this->userdata->cant('view books') && $this->userdata->hasDirectPermission('view books') && \in_array((int) $request->input('viewbooks'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view books');
|
||||
}
|
||||
|
||||
if ((int) $request->input('viewother') === 1 && $data->role->hasPermissionTo('view other') === true && ! $data->hasDirectPermission('view other')) {
|
||||
$data->givePermissionTo('view other');
|
||||
} elseif ((int) $request->input('viewother') === 0 && $data->role->hasPermissionTo('view other') === true && $data->hasDirectPermission('view other')) {
|
||||
$data->revokePermissionTo('view other');
|
||||
} elseif ($data->role->hasPermissionTo('view other') === false && $data->hasDirectPermission('view other') && ((int) $request->input('viewother') === 0 || (int) $request->input('viewother') === 1)) {
|
||||
$data->revokePermissionTo('view other');
|
||||
if ((int) $request->input('viewother') === 1 && $this->userdata->can('view other') && ! $this->userdata->hasDirectPermission('view other')) {
|
||||
$this->userdata->givePermissionTo('view other');
|
||||
} elseif ((int) $request->input('viewother') === 0 && $this->userdata->can('view other') && $this->userdata->hasDirectPermission('view other')) {
|
||||
$this->userdata->revokePermissionTo('view other');
|
||||
} elseif ($this->userdata->cant('view other') && $this->userdata->hasDirectPermission('view other') && \in_array((int) $request->input('viewother'), [0, 1], true)) {
|
||||
$this->userdata->revokePermissionTo('view other');
|
||||
}
|
||||
|
||||
if ($request->has('password') && ! empty($request->input('password'))) {
|
||||
User::updatePassword($userid, $request->input('password'));
|
||||
}
|
||||
|
||||
if (! empty($request->input('email')) && $data['email'] !== $request->input('email')) {
|
||||
$data['email'] = $request->input('email');
|
||||
if (! empty($request->input('email')) && $this->userdata->email !== $request->input('email')) {
|
||||
$this->userdata->email = $request->input('email');
|
||||
|
||||
UserVerification::generate($data);
|
||||
UserVerification::generate($this->userdata);
|
||||
|
||||
UserVerification::send($data, 'User email verification required');
|
||||
UserVerification::send($this->userdata, 'User email verification required');
|
||||
}
|
||||
|
||||
return redirect('profile');
|
||||
@@ -287,7 +286,7 @@ class ProfileController extends BasePageController
|
||||
}
|
||||
|
||||
$this->smarty->assign('error', $errorStr);
|
||||
$this->smarty->assign('user', $data);
|
||||
$this->smarty->assign('user', $this->userdata);
|
||||
$this->smarty->assign('userexccat', User::getCategoryExclusionById($userid));
|
||||
|
||||
$this->smarty->assign('saburl_selected', $sab->url);
|
||||
@@ -325,10 +324,10 @@ class ProfileController extends BasePageController
|
||||
|
||||
$meta_title = 'Edit User Profile';
|
||||
$meta_keywords = 'edit,profile,user,details';
|
||||
$meta_description = 'Edit User Profile for '.$data['username'];
|
||||
$meta_description = 'Edit User Profile for '.$this->userdata->username;
|
||||
|
||||
$this->smarty->assign('cp_url_selected', $data['cp_url']);
|
||||
$this->smarty->assign('cp_api_selected', $data['cp_api']);
|
||||
$this->smarty->assign('cp_url_selected', $this->userdata->cp_url);
|
||||
$this->smarty->assign('cp_api_selected', $this->userdata->cp_api);
|
||||
$this->smarty->assign('yesno_ids', [1, 0]);
|
||||
$this->smarty->assign('yesno_names', ['Yes', 'No']);
|
||||
|
||||
@@ -339,8 +338,8 @@ class ProfileController extends BasePageController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy(Request $request)
|
||||
@@ -349,10 +348,9 @@ class ProfileController extends BasePageController
|
||||
$userId = $request->input('id');
|
||||
|
||||
if ($userId !== null && (int) $userId === $this->userdata->id && ! $this->userdata->hasRole('Admin')) {
|
||||
Auth::logout();
|
||||
$user = User::find($userId);
|
||||
$user->delete();
|
||||
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
if ($this->userdata->hasRole('Admin')) {
|
||||
|
||||
@@ -13,8 +13,8 @@ class RssController extends BasePageController
|
||||
{
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return array|\Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function myMoviesRss(Request $request)
|
||||
@@ -24,6 +24,10 @@ class RssController extends BasePageController
|
||||
|
||||
$user = $this->userCheck($request);
|
||||
|
||||
if (is_object($user)) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
$outputXML = (! ($request->has('o') && $request->input('o') === 'json'));
|
||||
|
||||
$userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0);
|
||||
@@ -35,7 +39,8 @@ class RssController extends BasePageController
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return array|\Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function myShowsRss(Request $request)
|
||||
@@ -43,6 +48,9 @@ class RssController extends BasePageController
|
||||
$rss = new RSS(['Settings' => $this->settings]);
|
||||
$offset = 0;
|
||||
$user = $this->userCheck($request);
|
||||
if (is_object($user)) {
|
||||
return $user;
|
||||
}
|
||||
$userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1;
|
||||
$userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0);
|
||||
$relData = $rss->getShowsRss($userNum, $user['user_id'], User::getCategoryExclusionById($user['user_id']), $userAirDate);
|
||||
@@ -53,7 +61,8 @@ class RssController extends BasePageController
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return array|\Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function fullFeedRss(Request $request)
|
||||
@@ -61,6 +70,9 @@ class RssController extends BasePageController
|
||||
$rss = new RSS(['Settings' => $this->settings]);
|
||||
$offset = 0;
|
||||
$user = $this->userCheck($request);
|
||||
if (is_object($user)) {
|
||||
return $user;
|
||||
}
|
||||
$userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1;
|
||||
$userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0);
|
||||
$userLimit = $request->has('limit') && is_numeric($request->input('limit')) ? $request->input('limit') : 100;
|
||||
@@ -105,8 +117,8 @@ class RssController extends BasePageController
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'categorylist' => Category::getCategories(true, $this->userdata['categoryexclusions']),
|
||||
'parentcategorylist' => Category::getForMenu($this->userdata['categoryexclusions']),
|
||||
'categorylist' => Category::getCategories(true, $this->userdata->categoryexclusions),
|
||||
'parentcategorylist' => Category::getForMenu($this->userdata->categoryexclusions),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -117,12 +129,21 @@ class RssController extends BasePageController
|
||||
$this->pagerender();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array|\Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function cartRss(Request $request)
|
||||
{
|
||||
$this->setPrefs();
|
||||
$rss = new RSS(['Settings' => $this->settings]);
|
||||
$offset = 0;
|
||||
$user = $this->userCheck($request);
|
||||
if (is_object($user)) {
|
||||
return $user;
|
||||
}
|
||||
$outputXML = (! ($request->has('o') && $request->input('o') === 'json'));
|
||||
$userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1;
|
||||
$userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0);
|
||||
@@ -140,8 +161,8 @@ class RssController extends BasePageController
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return array|\Illuminate\Http\JsonResponse
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function categoryFeedRss(Request $request)
|
||||
@@ -154,6 +175,9 @@ class RssController extends BasePageController
|
||||
}
|
||||
|
||||
$user = $this->userCheck($request);
|
||||
if (is_object($user)) {
|
||||
return $user;
|
||||
}
|
||||
$categoryId = explode(',', $request->input('id'));
|
||||
$userAirDate = $request->has('airdate') && is_numeric($request->input('airdate')) ? abs($request->input('airdate')) : -1;
|
||||
$userNum = ($request->has('num') && is_numeric($request->input('num')) ? abs($request->input('num')) : 0);
|
||||
|
||||
@@ -81,7 +81,7 @@ class SearchController extends BasePageController
|
||||
config('nntmux.items_per_page'),
|
||||
$orderBy,
|
||||
-1,
|
||||
$this->userdata['categoryexclusions'] ?? [],
|
||||
$this->userdata->categoryexclusions ?? [],
|
||||
'basic',
|
||||
$categoryID,
|
||||
0,
|
||||
@@ -92,7 +92,7 @@ class SearchController extends BasePageController
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'lastvisit' => $this->userdata['lastlogin'],
|
||||
'lastvisit' => $this->userdata->lastlogin,
|
||||
'category' => $categoryID,
|
||||
]
|
||||
);
|
||||
@@ -157,7 +157,7 @@ class SearchController extends BasePageController
|
||||
config('nntmux.items_per_page'),
|
||||
$orderBy,
|
||||
-1,
|
||||
$this->userdata['categoryexclusions'] ?? [],
|
||||
$this->userdata->categoryexclusions ?? [],
|
||||
'advanced',
|
||||
[$searchVars['searchadvcat'] === '' ? -1 : $searchVars['searchadvcat']]
|
||||
);
|
||||
@@ -166,7 +166,7 @@ class SearchController extends BasePageController
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'lastvisit' => $this->userdata['lastlogin'],
|
||||
'lastvisit' => $this->userdata->lastlogin,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ class VerifyCsrfToken extends Middleware
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
'failed',
|
||||
'admin/*',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class Predb extends Model
|
||||
|
||||
if (config('nntmux.echocli')) {
|
||||
$consoleTools->overWritePrimary(
|
||||
'Matching up preDB titles with release searchnames: '.$consoleTools->percentString(++$updated, $total)
|
||||
'Matching up preDB titles with release searchnames: '.$consoleTools->percentString(++$updated, $total)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-15
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Blacklight\ColorCLI;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -667,17 +666,17 @@ class User extends Authenticatable
|
||||
* @param $password
|
||||
* @param $email
|
||||
* @param $host
|
||||
* @param int $role
|
||||
* @param $notes
|
||||
* @param int $invites
|
||||
* @param int $invites
|
||||
* @param string $inviteCode
|
||||
* @param bool $forceInviteMode
|
||||
* @param bool $forceInviteMode
|
||||
*
|
||||
* @return bool|int
|
||||
* @param int $role
|
||||
* @param bool $validate
|
||||
* @return bool|int|string
|
||||
* @throws \Exception
|
||||
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
|
||||
*/
|
||||
public static function signUp($userName, $password, $email, $host, $notes, $invites = Invitation::DEFAULT_INVITES, $inviteCode = '', $forceInviteMode = false, $role = self::ROLE_USER)
|
||||
public static function signUp($userName, $password, $email, $host, $notes, $invites = Invitation::DEFAULT_INVITES, $inviteCode = '', $forceInviteMode = false, $role = self::ROLE_USER, $validate = true)
|
||||
{
|
||||
$user = [
|
||||
'username' => trim($userName),
|
||||
@@ -685,14 +684,18 @@ class User extends Authenticatable
|
||||
'email' => trim($email),
|
||||
];
|
||||
|
||||
$validator = Validator::make($user, [
|
||||
'username' => ['required', 'string', 'min:5', 'max:255', 'unique:users'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users', 'indisposable'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/'],
|
||||
]);
|
||||
if ($validate) {
|
||||
$validator = Validator::make($user, [
|
||||
'username' => ['required', 'string', 'min:5', 'max:255', 'unique:users'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users', 'indisposable'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed', 'regex:/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/'],
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
(new ColorCLI())->error(implode('', Arr::collapse($validator->errors()->toArray())));
|
||||
if ($validator->fails()) {
|
||||
$error = implode('', Arr::collapse($validator->errors()->toArray()));
|
||||
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure this is the last check, as if a further validation check failed, the invite would still have been used up.
|
||||
@@ -708,7 +711,7 @@ class User extends Authenticatable
|
||||
}
|
||||
}
|
||||
|
||||
return self::add($user['userName'], $user['password'], $user['email'], $role, $notes, $host, $invites, $invitedBy);
|
||||
return self::add($user['username'], $user['password'], $user['email'], $role, $notes, $host, $invites, $invitedBy);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,25 +53,22 @@ $filePattern = '(?P<filename>(?P<stamp>\d+)_predb_dump\.csv\.gz)';
|
||||
|
||||
$result = getDirListing($url);
|
||||
|
||||
$dirs = json_decode($result, true);
|
||||
|
||||
if ($dirs === null || (isset($dirs['message']) && strpos($dirs['message'], 'API rate limit exceeded for') === 0)) {
|
||||
if ($result === null || (isset($result['message']) && strpos($result['message'], 'API rate limit exceeded for') === 0)) {
|
||||
exit("Error: $result");
|
||||
}
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
foreach ($result as $dir) {
|
||||
if ($dir['name'] === '0README.txt') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$result = getDirListing($url.$dir['name'].'/');
|
||||
|
||||
$temp = json_decode($result, true);
|
||||
if ($temp === null) {
|
||||
if ($result === false) {
|
||||
exit("Error: $result");
|
||||
}
|
||||
|
||||
$data[$dir['name']] = $temp;
|
||||
$data[$dir['name']] = $result;
|
||||
}
|
||||
|
||||
$total = 0;
|
||||
|
||||
+10
-9
@@ -95,16 +95,12 @@
|
||||
"aharen/omdbapi": "^2.0",
|
||||
"anhskohbo/no-captcha": "^3.0",
|
||||
"b3rs3rk/steamfront": "dev-master",
|
||||
"barracudanetworks/forkdaemon-php": "~1.0",
|
||||
"bhuvidya/laravel-countries": "^1.0",
|
||||
"canihavesomecoffee/thetvdbapi": "^1.0",
|
||||
"chumper/zipper": "^1.0",
|
||||
"czproject/git-php": "^3.14",
|
||||
"laravelcollective/html": "^5.7",
|
||||
"dariusiii/laravel": "dev-master",
|
||||
"dariusiii/laravel-database-trigger": "dev-master",
|
||||
"ytake/laravel-smarty": "^2.5",
|
||||
"jrean/laravel-user-verification": "^7.0",
|
||||
"dariusiii/php-itunes-api": "^1.0",
|
||||
"dariusiii/rarinfo": "^2.5",
|
||||
"dborsatto/php-giantbomb": "^1.0",
|
||||
@@ -112,6 +108,7 @@
|
||||
"doctrine/dbal": "^2.7",
|
||||
"fideloper/proxy": "~4.0",
|
||||
"foolz/sphinxql-query-builder": "^2.0",
|
||||
"genealabs/laravel-caffeine": "^0.8.1",
|
||||
"geoip2/geoip2": "^2.9",
|
||||
"google/recaptcha": "~1.1",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
@@ -120,12 +117,14 @@
|
||||
"intervention/imagecache": "^2.3",
|
||||
"james-heinrich/getid3": "1.9.*",
|
||||
"joshpinkney/tv-maze-php-api": "dev-master",
|
||||
"jrean/laravel-user-verification": "^7.0",
|
||||
"kevinlebrun/colors.php": "^1.0",
|
||||
"laravel/framework": "5.8.*",
|
||||
"laravel/horizon": "^2.0",
|
||||
"laravel/scout": "^7.0",
|
||||
"laravel/telescope": "^2.0",
|
||||
"laravel/tinker": "~1.0",
|
||||
"laravelcollective/html": "^5.7",
|
||||
"league/climate": "^3.4",
|
||||
"mayconbordin/l5-fixtures": "dev-master",
|
||||
"messerli90/igdb": "^1.0",
|
||||
@@ -142,17 +141,19 @@
|
||||
"ramsey/uuid": "^3.7",
|
||||
"rtconner/laravel-tagging": "^3.0",
|
||||
"smarty/smarty": "^3.1",
|
||||
"spatie/async": "^1.0",
|
||||
"spatie/laravel-directory-cleanup": "^1.2",
|
||||
"spatie/laravel-fractal": "^5.3",
|
||||
"spatie/laravel-permission": "^2.12",
|
||||
"tunaabutbul/cloudflare-middleware": "^1.2",
|
||||
"vlucas/phpdotenv": "^3.3",
|
||||
"voku/simple_html_dom": "^4.2",
|
||||
"voku/simple_html_dom": "4.3.*",
|
||||
"wandersonwhcr/illuminate-romans": "^1.0",
|
||||
"watson/rememberable": "^2.0",
|
||||
"wildbit/swiftmailer-postmark": "^3.0",
|
||||
"yab/laravel-scout-mysql-driver": "^2.1",
|
||||
"yadakhov/insert-on-duplicate-key": "^1.2"
|
||||
"yadakhov/insert-on-duplicate-key": "^1.2",
|
||||
"ytake/laravel-smarty": "^2.5"
|
||||
},
|
||||
|
||||
"require-dev": {
|
||||
@@ -163,6 +164,7 @@
|
||||
"friendsofphp/php-cs-fixer": "^2.14",
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"laracasts/generators": "dev-master",
|
||||
"matt-allan/laravel-code-style": "^0.2.0",
|
||||
"mockery/mockery": "^1.0",
|
||||
"moontoast/math": "^1.1",
|
||||
"nunomaduro/collision": "^3.0",
|
||||
@@ -191,9 +193,8 @@
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"format": [
|
||||
"vendor/bin/php-cs-fixer fix --config .php-cs"
|
||||
]
|
||||
"check-style": "php-cs-fixer fix --dry-run --diff",
|
||||
"fix-style": "php-cs-fixer fix"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "to use GD library based image processing.",
|
||||
|
||||
Generated
+686
-438
File diff suppressed because it is too large
Load Diff
@@ -17,4 +17,10 @@ return [
|
||||
'admin_username' => env('ADMIN_USER', 'admin'),
|
||||
'admin_password' => env('ADMIN_PASS', 'admin'),
|
||||
'admin_email' => env('ADMIN_EMAIL', 'admin@example.com'),
|
||||
'multiprocessing_max_child_time' => env('NN_MULTIPROCESSING_MAX_CHILD_TIME', 1800),
|
||||
'multiprocessing_max_child_work' => env('NN_MULTIPROCESSING_MAX_CHILD_WORK', 1),
|
||||
'multiprocessing_max_children_override' => env('NN_MULTIPROCESSING_MAX_CHILDREN_OVERRIDE', 0),
|
||||
'multiprocessing_log_type' => env('NN_MULTIPROCESSING_LOG_TYPE', 6),
|
||||
'multiprocessing_child_output_type' => env('NN_MULTIPROCESSING_CHILD_OUTPUT_TYPE', 1),
|
||||
'purge_inactive_users' => env('PURGE_INACTIVE_USERS', false),
|
||||
];
|
||||
|
||||
@@ -118,10 +118,10 @@ return [
|
||||
'model_key' => 'name',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -660,5 +660,5 @@ return [
|
||||
'disablepreview' => 0,
|
||||
'minsizetoformrelease' => 0,
|
||||
'maxsizetoformrelease' => 0,
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
0 =>
|
||||
[
|
||||
0 => [
|
||||
'id' => 1,
|
||||
'title' => 'Other',
|
||||
'status' => 1,
|
||||
@@ -10,8 +9,7 @@ return [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
1 =>
|
||||
[
|
||||
1 => [
|
||||
'id' => 1000,
|
||||
'title' => 'Console',
|
||||
'status' => 1,
|
||||
@@ -19,8 +17,7 @@ return [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
2 =>
|
||||
[
|
||||
2 => [
|
||||
'id' => 2000,
|
||||
'title' => 'Movies',
|
||||
'status' => 1,
|
||||
@@ -28,8 +25,7 @@ return [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
3 =>
|
||||
[
|
||||
3 => [
|
||||
'id' => 3000,
|
||||
'title' => 'Audio',
|
||||
'status' => 1,
|
||||
@@ -37,8 +33,7 @@ return [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
4 =>
|
||||
[
|
||||
4 => [
|
||||
'id' => 4000,
|
||||
'title' => 'PC',
|
||||
'status' => 1,
|
||||
@@ -46,8 +41,7 @@ return [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
5 =>
|
||||
[
|
||||
5 => [
|
||||
'id' => 5000,
|
||||
'title' => 'TV',
|
||||
'status' => 1,
|
||||
@@ -55,8 +49,7 @@ return [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
6 =>
|
||||
[
|
||||
6 => [
|
||||
'id' => 6000,
|
||||
'title' => 'XXX',
|
||||
'status' => 1,
|
||||
@@ -64,8 +57,7 @@ return [
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
7 =>
|
||||
[
|
||||
7 => [
|
||||
'id' => 7000,
|
||||
'title' => 'Books',
|
||||
'status' => 1,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTaggedTable extends Migration
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTagsTable extends Migration
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFirewallTable extends Migration
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTagGroupsTable extends Migration
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ class UpdateTagsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tagging_tags', function ($table) {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -61,7 +60,6 @@ class CreateUsersTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePermissionTables extends Migration
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCategoriesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -28,7 +27,6 @@ class CreateCategoriesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCategoryRegexesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -33,7 +32,6 @@ class CreateCategoryRegexesTable extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCollectionRegexesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -32,7 +31,6 @@ class CreateCollectionRegexesTable extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBinaryblacklistTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -34,7 +33,6 @@ class CreateBinaryblacklistTable extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateContentTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -28,7 +27,7 @@ class CreateContentTable extends Migration
|
||||
$table->integer('status');
|
||||
$table->integer('ordinal')->nullable();
|
||||
$table->integer('role')->default(0);
|
||||
$table->index(['showinmenu','status','contenttype','role'], 'ix_showinmenu_status_contenttype_role');
|
||||
$table->index(['showinmenu', 'status', 'contenttype', 'role'], 'ix_showinmenu_status_contenttype_role');
|
||||
});
|
||||
|
||||
if (env('DB_CONNECTION') !== 'pgsql') {
|
||||
@@ -38,7 +37,6 @@ class CreateContentTable extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateForumpostTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -31,7 +30,6 @@ class CreateForumpostTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateGenresTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -30,7 +29,6 @@ class CreateGenresTable extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateGroupsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -39,7 +38,6 @@ class CreateGroupsTable extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleaseNamingRegexesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -32,7 +31,6 @@ class CreateReleaseNamingRegexesTable extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -23,11 +22,10 @@ class CreateSettingsTable extends Migration
|
||||
$table->string('value', 1000)->default('');
|
||||
$table->text('hint', 65535);
|
||||
$table->string('setting', 64)->default('')->unique('ui_settings_setting');
|
||||
$table->primary(['section','subsection','name']);
|
||||
$table->primary(['section', 'subsection', 'name']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCollectionsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -35,7 +34,6 @@ class CreateCollectionsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleasesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -34,7 +33,7 @@ class CreateReleasesTable extends Migration
|
||||
$table->integer('categories_id')->default(10);
|
||||
$table->integer('videos_id')->unsigned()->default(0)->index('ix_releases_videos_id')->comment('FK to videos.id of the parent series.');
|
||||
$table->integer('tv_episodes_id')->default(0)->index('ix_releases_tv_episodes_id')->comment('FK to tv_episodes.id for the episode.');
|
||||
$table->string('imdbid', 15)->nullable()->index('ix_releases_imdbid');
|
||||
$table->string('imdbid')->index('ix_releases_imdbid');
|
||||
$table->integer('xxxinfo_id')->default(0)->index('ix_releases_xxxinfo_id');
|
||||
$table->integer('musicinfo_id')->nullable()->comment('FK to musicinfo.id');
|
||||
$table->integer('consoleinfo_id')->nullable()->index('ix_releases_consoleinfo_id')->comment('FK to consoleinfo.id');
|
||||
@@ -69,14 +68,14 @@ processed');
|
||||
$table->boolean('proc_hash16k')->default(0)->comment('Has the release been hash16k
|
||||
processed');
|
||||
$table->boolean('proc_crc32')->default(0)->comment('Has the release been crc32 processed');
|
||||
$table->index(['groups_id','passwordstatus'], 'ix_releases_groupsid');
|
||||
$table->index(['postdate','searchname'], 'ix_releases_postdate_searchname');
|
||||
$table->index(['leftguid','predb_id'], 'ix_releases_leftguid');
|
||||
$table->index(['musicinfo_id','passwordstatus'], 'ix_releases_musicinfo_id');
|
||||
$table->index(['predb_id','searchname'], 'ix_releases_predb_id_searchname');
|
||||
$table->index(['haspreview','passwordstatus'], 'ix_releases_haspreview_passwordstatus');
|
||||
$table->index(['nfostatus','size'], 'ix_releases_nfostatus');
|
||||
$table->index(['dehashstatus','ishashed'], 'ix_releases_dehashstatus');
|
||||
$table->index(['groups_id', 'passwordstatus'], 'ix_releases_groupsid');
|
||||
$table->index(['postdate', 'searchname'], 'ix_releases_postdate_searchname');
|
||||
$table->index(['leftguid', 'predb_id'], 'ix_releases_leftguid');
|
||||
$table->index(['musicinfo_id', 'passwordstatus'], 'ix_releases_musicinfo_id');
|
||||
$table->index(['predb_id', 'searchname'], 'ix_releases_predb_id_searchname');
|
||||
$table->index(['haspreview', 'passwordstatus'], 'ix_releases_haspreview_passwordstatus');
|
||||
$table->index(['nfostatus', 'size'], 'ix_releases_nfostatus');
|
||||
$table->index(['dehashstatus', 'ishashed'], 'ix_releases_dehashstatus');
|
||||
});
|
||||
|
||||
DB::statement('ALTER TABLE releases DROP PRIMARY KEY , ADD PRIMARY KEY (id, categories_id)');
|
||||
@@ -84,7 +83,6 @@ processed');
|
||||
DB::statement('ALTER TABLE releases ADD INDEX ix_releases_nzb_guid (nzb_guid)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAnidbEpisodesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -22,11 +21,10 @@ class CreateAnidbEpisodesTable extends Migration
|
||||
$table->smallInteger('episode_no')->unsigned()->comment('Numeric version of episode (leave 0 for combined episodes).');
|
||||
$table->string('episode_title')->comment('Title of the episode (en, x-jat)');
|
||||
$table->date('airdate');
|
||||
$table->primary(['anidbid','episodeid']);
|
||||
$table->primary(['anidbid', 'episodeid']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAnidbInfoTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -30,11 +29,10 @@ class CreateAnidbInfoTable extends Migration
|
||||
$table->string('picture')->nullable();
|
||||
$table->string('categories', 1024)->nullable();
|
||||
$table->string('characters', 1024)->nullable();
|
||||
$table->index(['startdate','enddate','updated'], 'ix_anidb_info_datetime');
|
||||
$table->index(['startdate', 'enddate', 'updated'], 'ix_anidb_info_datetime');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAnidbTitlesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -21,11 +20,10 @@ class CreateAnidbTitlesTable extends Migration
|
||||
$table->string('type', 25)->comment('type of title.');
|
||||
$table->string('lang', 25);
|
||||
$table->string('title');
|
||||
$table->primary(['anidbid','type','lang','title']);
|
||||
$table->primary(['anidbid', 'type', 'lang', 'title']);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAudioDataTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -29,12 +28,11 @@ class CreateAudioDataTable extends Migration
|
||||
$table->string('audiolibrary', 50)->nullable();
|
||||
$table->string('audiolanguage', 50)->nullable();
|
||||
$table->string('audiotitle', 50)->nullable();
|
||||
$table->unique(['releases_id','audioid'], 'ix_releaseaudio_releaseid_audioid');
|
||||
$table->unique(['releases_id', 'audioid'], 'ix_releaseaudio_releaseid_audioid');
|
||||
$table->foreign('releases_id', 'FK_ad_releases')->references('id')->on('releases')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBinariesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -32,7 +31,6 @@ class CreateBinariesTable extends Migration
|
||||
DB::statement('ALTER TABLE binaries ADD UNIQUE INDEX ix_binaries_binaryhash (binaryhash)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBookinfoTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -36,7 +35,6 @@ class CreateBookinfoTable extends Migration
|
||||
DB::statement('ALTER TABLE bookinfo ADD FULLTEXT ix_bookinfo_author_title_ft (author, title)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateConsoleinfoTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -34,7 +33,6 @@ class CreateConsoleinfoTable extends Migration
|
||||
DB::statement('ALTER TABLE consoleinfo ADD FULLTEXT ix_consoleinfo_title_platform_ft (title, platform)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateDnzbFailuresTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -20,13 +19,12 @@ class CreateDnzbFailuresTable extends Migration
|
||||
$table->integer('release_id')->unsigned();
|
||||
$table->integer('users_id')->unsigned()->index('FK_users_df');
|
||||
$table->integer('failed')->unsigned()->default(0);
|
||||
$table->primary(['release_id','users_id']);
|
||||
$table->primary(['release_id', 'users_id']);
|
||||
$table->foreign('users_id', 'FK_users_df')->references('id')->on('users')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
$table->foreign('release_id', 'FK_df_releases')->references('id')->on('releases')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateGamesinfoTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -36,7 +35,6 @@ class CreateGamesinfoTable extends Migration
|
||||
DB::statement('ALTER TABLE gamesinfo ADD FULLTEXT ix_title_ft(title)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvitationsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -25,7 +24,6 @@ class CreateInvitationsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateLoggingTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -24,7 +23,6 @@ class CreateLoggingTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMissedPartsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -21,13 +20,12 @@ class CreateMissedPartsTable extends Migration
|
||||
$table->bigInteger('numberid')->unsigned();
|
||||
$table->integer('groups_id')->unsigned()->default(0)->comment('FK to groups.id');
|
||||
$table->boolean('attempts')->default(0)->index('ix_missed_parts_attempts');
|
||||
$table->unique(['numberid','groups_id'], 'ix_missed_parts_numberid_groupsid');
|
||||
$table->index(['groups_id','attempts'], 'ix_missed_parts_groupid_attempts');
|
||||
$table->index(['numberid','groups_id','attempts'], 'ix_missed_parts_numberid_groupsid_attempts');
|
||||
$table->unique(['numberid', 'groups_id'], 'ix_missed_parts_numberid_groupsid');
|
||||
$table->index(['groups_id', 'attempts'], 'ix_missed_parts_groupid_attempts');
|
||||
$table->index(['numberid', 'groups_id', 'attempts'], 'ix_missed_parts_numberid_groupsid_attempts');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMovieinfoTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -18,7 +17,7 @@ class CreateMovieinfoTable extends Migration
|
||||
$table->charset = 'utf8';
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
$table->increments('id');
|
||||
$table->integer('imdbid')->unsigned()->unique('ix_movieinfo_imdbid');
|
||||
$table->string('imdbid')->unique('ix_movieinfo_imdbid');
|
||||
$table->integer('tmdbid')->unsigned()->default(0);
|
||||
$table->integer('traktid')->unsigned()->default(0);
|
||||
$table->string('title')->default('')->index('ix_movieinfo_title');
|
||||
@@ -39,7 +38,6 @@ class CreateMovieinfoTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateMusicinfoTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -35,7 +34,6 @@ class CreateMusicinfoTable extends Migration
|
||||
DB::statement('ALTER TABLE musicinfo ADD FULLTEXT ix_musicinfo_artist_title_ft (artist, title)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateParHashesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -19,12 +18,11 @@ class CreateParHashesTable extends Migration
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
$table->integer('releases_id')->unsigned()->comment('FK to releases.id');
|
||||
$table->string('hash', 32)->comment('hash_16k block of par2');
|
||||
$table->primary(['releases_id','hash']);
|
||||
$table->primary(['releases_id', 'hash']);
|
||||
$table->foreign('releases_id', 'FK_ph_releases')->references('id')->on('releases')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePartsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -22,12 +21,11 @@ class CreatePartsTable extends Migration
|
||||
$table->bigInteger('number')->unsigned()->default(0);
|
||||
$table->integer('partnumber')->unsigned()->default(0);
|
||||
$table->integer('size')->unsigned()->default(0);
|
||||
$table->primary(['binaries_id','number']);
|
||||
$table->primary(['binaries_id', 'number']);
|
||||
$table->foreign('binaries_id', 'FK_binaries')->references('id')->on('binaries')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePredbTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -31,12 +30,11 @@ class CreatePredbTable extends Migration
|
||||
$table->string('files', 50)->nullable()->comment('How many files does this pre have ?');
|
||||
$table->string('filename')->default('');
|
||||
$table->boolean('searched')->default(0)->index('ix_predb_searched');
|
||||
$table->index(['requestid','groups_id'], 'ix_predb_requestid');
|
||||
$table->index(['requestid', 'groups_id'], 'ix_predb_requestid');
|
||||
});
|
||||
DB::statement('ALTER TABLE predb ADD FULLTEXT ft_predb_filename (filename)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePredbHashesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -24,7 +23,6 @@ class CreatePredbHashesTable extends Migration
|
||||
DB::statement('ALTER TABLE predb_hashes ADD PRIMARY KEY (hash)');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePredbImportsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -34,7 +33,6 @@ class CreatePredbImportsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleaseCommentsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -33,14 +32,13 @@ class CreateReleaseCommentsTable extends Migration
|
||||
$table->string('shareid', 40)->default('');
|
||||
$table->string('siteid', 40)->default('');
|
||||
$table->bigInteger('sourceid')->unsigned()->nullable();
|
||||
$table->unique(['text_hash','releases_id'], 'ix_release_comments_hash_releases_id');
|
||||
$table->unique(['text_hash', 'releases_id'], 'ix_release_comments_hash_releases_id');
|
||||
$table->foreign('releases_id', 'FK_rc_releases')->references('id')->on('releases')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
|
||||
DB::statement("ALTER TABLE release_comments ADD COLUMN nzb_guid BINARY(16) NOT NULL DEFAULT '0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleasesGroupsTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -19,12 +18,11 @@ class CreateReleasesGroupsTable extends Migration
|
||||
$table->collation = 'utf8_unicode_ci';
|
||||
$table->integer('releases_id')->unsigned()->default(0)->comment('FK to releases.id');
|
||||
$table->integer('groups_id')->unsigned()->default(0)->comment('FK to groups.id');
|
||||
$table->primary(['releases_id','groups_id']);
|
||||
$table->primary(['releases_id', 'groups_id']);
|
||||
$table->foreign('releases_id', 'FK_rg_releases')->references('id')->on('releases')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleaseRegexesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -20,11 +19,10 @@ class CreateReleaseRegexesTable extends Migration
|
||||
$table->integer('releases_id')->unsigned()->default(0);
|
||||
$table->integer('collection_regex_id')->default(0);
|
||||
$table->integer('naming_regex_id')->default(0);
|
||||
$table->primary(['releases_id','collection_regex_id','naming_regex_id'], 'ix_rel_coll_name_reg_id');
|
||||
$table->primary(['releases_id', 'collection_regex_id', 'naming_regex_id'], 'ix_rel_coll_name_reg_id');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleaseUniqueTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -24,7 +23,6 @@ class CreateReleaseUniqueTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleaseextrafullTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -23,7 +22,6 @@ class CreateReleaseextrafullTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateReleaseFilesTable extends Migration
|
||||
{
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
@@ -24,12 +23,11 @@ class CreateReleaseFilesTable extends Migration
|
||||
$table->string('crc32')->default('');
|
||||
$table->timestamps();
|
||||
$table->boolean('passworded')->default(0);
|
||||
$table->primary(['releases_id','name']);
|
||||
$table->primary(['releases_id', 'name']);
|
||||
$table->foreign('releases_id', 'FK_rf_releases')->references('id')->on('releases')->onUpdate('CASCADE')->onDelete('CASCADE');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user