1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Blacklight; |
4
|
|
|
|
5
|
|
|
use App\Models\Category; |
6
|
|
|
use App\Models\Settings; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Categorizing of releases by name/group. |
10
|
|
|
* |
11
|
|
|
* |
12
|
|
|
* Class Categorize |
13
|
|
|
*/ |
14
|
|
|
class Categorize |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* Temporary category while we sort through the name. |
18
|
|
|
* |
19
|
|
|
* @var int |
20
|
|
|
*/ |
21
|
|
|
protected $tmpCat = Category::OTHER_MISC; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Temporary tag while we sort through the name. |
25
|
|
|
* |
26
|
|
|
* @var array |
27
|
|
|
*/ |
28
|
|
|
protected $tmpTag = [Category::TAG_OTHER_MISC]; |
29
|
|
|
/** |
30
|
|
|
* @var bool |
31
|
|
|
*/ |
32
|
|
|
protected $categorizeForeign; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var bool |
36
|
|
|
*/ |
37
|
|
|
protected $catWebDL; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Release name to sort through. |
41
|
|
|
* @var string |
42
|
|
|
*/ |
43
|
|
|
public $releaseName; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Release poster to sort through. |
47
|
|
|
* @var string |
48
|
|
|
*/ |
49
|
|
|
public $poster; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Group id of the releasename we are sorting through. |
53
|
|
|
* @var int|string |
54
|
|
|
*/ |
55
|
|
|
public $groupid; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Categorize constructor. |
59
|
|
|
* |
60
|
|
|
* @throws \Exception |
61
|
|
|
*/ |
62
|
|
|
public function __construct() |
63
|
|
|
{ |
64
|
|
|
$this->categorizeForeign = (bool) Settings::settingValue('indexer.categorise.categorizeforeign'); |
65
|
|
|
$this->catWebDL = (bool) Settings::settingValue('indexer.categorise.catwebdl'); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Look up the site to see which language of categorizing to use. |
70
|
|
|
* Then work out which category is applicable for either a group or a binary. |
71
|
|
|
* Returns Category::OTHER_MISC if no category is appropriate. |
72
|
|
|
* |
73
|
|
|
* @param $groupID |
74
|
|
|
* @param string $releaseName |
75
|
|
|
* @param string $poster |
76
|
|
|
* |
77
|
|
|
* @return array |
78
|
|
|
* @throws \Exception |
79
|
|
|
*/ |
80
|
|
|
public function determineCategory($groupID, $releaseName = '', $poster = ''): array |
81
|
|
|
{ |
82
|
|
|
$this->releaseName = $releaseName; |
83
|
|
|
$this->groupid = $groupID; |
84
|
|
|
$this->poster = $poster; |
85
|
|
|
|
86
|
|
|
switch (true) { |
87
|
|
|
case $this->isMisc(): |
88
|
|
|
//Try against all functions, if still nothing, return Cat Misc. |
89
|
|
|
case $this->isPC(): |
90
|
|
|
case $this->isXxx(): |
91
|
|
|
case $this->isTV(): |
92
|
|
|
case $this->isMovie(): |
93
|
|
|
case $this->isConsole(): |
94
|
|
|
case $this->isBook(): |
95
|
|
|
case $this->isMusic(): |
96
|
|
|
return ['categories_id' => $this->tmpCat, 'tags' => $this->tmpTag]; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
return ['categories_id' => $this->tmpCat, 'tags' => $this->tmpTag]; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
// |
103
|
|
|
// Beginning of functions to determine category by release name. |
104
|
|
|
// |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return bool |
108
|
|
|
*/ |
109
|
|
|
public function isTV(): bool |
110
|
|
|
{ |
111
|
|
|
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) |
112
|
|
|
&& ! preg_match('/[._ -](flac|imageset|mp3|xxx)[._ -]|[ .]exe$/i', $this->releaseName)) { |
113
|
|
|
switch (true) { |
114
|
|
|
case $this->isOtherTV(): |
115
|
|
|
case $this->categorizeForeign && $this->isForeignTV(): |
116
|
|
|
case $this->isSportTV(): |
117
|
|
|
case $this->isDocumentaryTV(): |
118
|
|
|
case $this->isTVx265(): |
119
|
|
|
case $this->isUHDTV(): |
120
|
|
|
case $this->catWebDL && $this->isWEBDL(): |
121
|
|
|
case $this->isAnimeTV(): |
122
|
|
|
case $this->isHDTV(): |
123
|
|
|
case $this->isSDTV(): |
124
|
|
|
case $this->isOtherTV2(): |
125
|
|
|
return true; |
126
|
|
|
default: |
127
|
|
|
$this->tmpCat = Category::TV_OTHER; |
128
|
|
|
$this->tmpTag[] = Category::TAG_TV_OTHER; |
129
|
|
|
|
130
|
|
|
return true; |
131
|
|
|
} |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
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)) { |
135
|
|
|
if ($this->isSportTV()) { |
136
|
|
|
return true; |
137
|
|
|
} |
138
|
|
|
$this->tmpCat = Category::TV_OTHER; |
139
|
|
|
$this->tmpTag[] = Category::TAG_TV_OTHER; |
140
|
|
|
|
141
|
|
|
return true; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
return false; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @return bool |
149
|
|
|
*/ |
150
|
|
|
public function isOtherTV(): bool |
151
|
|
|
{ |
152
|
|
|
if (preg_match('/[._ -]S\d{1,3}.+(EP\d{1,3}|Extras|SUBPACK)[._ -]|News/i', $this->releaseName) |
153
|
|
|
//special case for "Have.I.Got.News.For.You" tv show |
154
|
|
|
&& ! preg_match('/[._ -]Got[._ -]News[._ -]For[._ -]You/i', $this->releaseName) |
155
|
|
|
) { |
156
|
|
|
$this->tmpCat = Category::TV_OTHER; |
157
|
|
|
$this->tmpTag[] = Category::TAG_TV_OTHER; |
158
|
|
|
|
159
|
|
|
return true; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
return false; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @return bool |
167
|
|
|
*/ |
168
|
|
|
public function isForeignTV(): bool |
169
|
|
|
{ |
170
|
|
|
switch (true) { |
|
|
|
|
171
|
|
|
case preg_match('/[._ -](NHL|stanley.+cup)[._ -]/', $this->releaseName): |
172
|
|
|
return false; |
173
|
|
|
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): |
174
|
|
|
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): |
175
|
|
|
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): |
176
|
|
|
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): |
177
|
|
|
case preg_match('/[._ -]FastSUB|NL|nlvlaams|patrfa|RealCO|Seizoen|slosinh|Videomann|Vostfr|xslidian[._ -]|x264\-iZU/i', $this->releaseName): |
178
|
|
|
$this->tmpCat = Category::TV_FOREIGN; |
179
|
|
|
$this->tmpTag[] = Category::TAG_TV_FOREIGN; |
180
|
|
|
|
181
|
|
|
return true; |
182
|
|
|
default: |
183
|
|
|
return false; |
184
|
|
|
} |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return bool |
189
|
|
|
*/ |
190
|
|
|
public function isSportTV(): bool |
191
|
|
|
{ |
192
|
|
|
switch (true) { |
|
|
|
|
193
|
|
|
case preg_match('/s\d{1,3}[._ -]?[ed]\d{1,3}([ex]\d{1,3}|[\-.\w ])/i', $this->releaseName): |
194
|
|
|
return false; |
195
|
|
|
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): |
196
|
|
|
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): |
197
|
|
|
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): |
198
|
|
|
case preg_match('/[._ -]?(Horse)[._ -]Racing[._ -]/i', $this->releaseName): |
199
|
|
|
case preg_match('/[._ -](VERUM|GRiP|Ebi|OVERTAKE|LEViTATE|WiNNiNG|ADMIT)/i', $this->releaseName): |
200
|
|
|
$this->tmpCat = Category::TV_SPORT; |
201
|
|
|
$this->tmpTag[] = Category::TAG_TV_SPORT; |
202
|
|
|
|
203
|
|
|
return true; |
204
|
|
|
default: |
205
|
|
|
return false; |
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @return bool |
211
|
|
|
*/ |
212
|
|
|
public function isDocumentaryTV(): bool |
213
|
|
|
{ |
214
|
|
|
if (preg_match('/[._ -](Docu|Documentary)[._ -]/i', $this->releaseName)) { |
215
|
|
|
$this->tmpCat = Category::TV_DOCU; |
216
|
|
|
$this->tmpTag[] = Category::TAG_TV_DOCU; |
217
|
|
|
|
218
|
|
|
return true; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
return false; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @return bool |
226
|
|
|
*/ |
227
|
|
|
public function isWEBDL(): bool |
228
|
|
|
{ |
229
|
|
|
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
230
|
|
|
$this->tmpCat = Category::TV_WEBDL; |
231
|
|
|
$this->tmpTag = [Category::TAG_TV_WEBDL, Category::TAG_TV_HD]; |
232
|
|
|
|
233
|
|
|
return true; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
return false; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
/** |
240
|
|
|
* @return bool |
241
|
|
|
*/ |
242
|
|
|
public function isAnimeTV(): bool |
243
|
|
|
{ |
244
|
|
|
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)) { |
245
|
|
|
$this->tmpCat = Category::TV_ANIME; |
246
|
|
|
$this->tmpTag[] = Category::TAG_TV_ANIME; |
247
|
|
|
|
248
|
|
|
return true; |
249
|
|
|
} |
250
|
|
|
if (preg_match('/(ANiHLS|HaiKU|ANiURL)/i', $this->releaseName)) { |
251
|
|
|
$this->tmpCat = Category::TV_ANIME; |
252
|
|
|
$this->tmpTag[] = Category::TAG_TV_ANIME; |
253
|
|
|
|
254
|
|
|
return true; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
return false; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* @return bool |
262
|
|
|
*/ |
263
|
|
|
public function isHDTV(): bool |
264
|
|
|
{ |
265
|
|
|
if (preg_match('/1080([ip])|720p|bluray/i', $this->releaseName)) { |
266
|
|
|
$this->tmpCat = Category::TV_HD; |
267
|
|
|
$this->tmpTag[] = Category::TAG_TV_HD; |
268
|
|
|
|
269
|
|
|
return true; |
270
|
|
|
} |
271
|
|
|
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
272
|
|
|
$this->tmpCat = Category::TV_HD; |
273
|
|
|
$this->tmpTag[] = Category::TAG_TV_HD; |
274
|
|
|
|
275
|
|
|
return true; |
276
|
|
|
} |
277
|
|
|
|
278
|
|
|
return false; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* @return bool |
283
|
|
|
*/ |
284
|
|
|
public function isUHDTV(): bool |
285
|
|
|
{ |
286
|
|
|
if (preg_match('/(S\d+).*(2160p).*(Netflix|Amazon|NF|AMZN).*(TrollUHD|NTb|VLAD|DEFLATE|POFUDUK)/i', $this->releaseName)) { |
287
|
|
|
$this->tmpCat = Category::TV_UHD; |
288
|
|
|
$this->tmpTag = [Category::TAG_TV_UHD, Category::TAG_TV_HD]; |
289
|
|
|
|
290
|
|
|
return true; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
return false; |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
/** |
297
|
|
|
* @return bool |
298
|
|
|
*/ |
299
|
|
|
public function isSDTV(): bool |
300
|
|
|
{ |
301
|
|
|
switch (true) { |
|
|
|
|
302
|
|
|
case preg_match('/(360|480|576)p|Complete[._ -]Season|dvdr(ip)?|dvd5|dvd9|\.pdtv|SD[._ -]TV|TVRip|NTSC|BDRip|hdtv|xvid/i', $this->releaseName): |
303
|
|
|
case preg_match('/(([HP])D[._ -]?TV|DSR|WebRip)[._ -]x264/i', $this->releaseName): |
304
|
|
|
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): |
305
|
|
|
$this->tmpCat = Category::TV_SD; |
306
|
|
|
$this->tmpTag[] = Category::TAG_TV_SD; |
307
|
|
|
|
308
|
|
|
return true; |
309
|
|
|
default: |
310
|
|
|
return false; |
311
|
|
|
} |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* @return bool |
316
|
|
|
*/ |
317
|
|
|
public function isOtherTV2(): bool |
318
|
|
|
{ |
319
|
|
|
if (preg_match('/[._ -]s\d{1,3}[._ -]?(e|d(isc)?)\d{1,3}([._ -]|$)/i', $this->releaseName)) { |
320
|
|
|
$this->tmpCat = Category::TV_OTHER; |
321
|
|
|
$this->tmpTag[] = Category::TAG_TV_OTHER; |
322
|
|
|
|
323
|
|
|
return true; |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
return false; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @return bool |
331
|
|
|
*/ |
332
|
|
|
public function isTVx265(): bool |
333
|
|
|
{ |
334
|
|
|
if (preg_match('/(S\d+).*(x265).*(rmteam|MeGusta|HETeam|PSA|ONLY|H4S5S|TrollHD|ImE)/i', $this->releaseName)) { |
335
|
|
|
$this->tmpCat = Category::TV_X265; |
336
|
|
|
$this->tmpTag = [Category::TAG_TV_X265, Category::TAG_TV_HD]; |
337
|
|
|
|
338
|
|
|
return true; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
return false; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
// Movies. |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* @return bool |
348
|
|
|
*/ |
349
|
|
|
public function isMovie(): bool |
350
|
|
|
{ |
351
|
|
|
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)) { |
352
|
|
|
switch (true) { |
353
|
|
|
case $this->categorizeForeign && $this->isMovieForeign(): |
354
|
|
|
case $this->isMovieDVD(): |
355
|
|
|
case $this->isMovieX265(): |
356
|
|
|
case $this->isMovieUHD(): |
357
|
|
|
case $this->catWebDL && $this->isMovieWEBDL(): |
358
|
|
|
case $this->isMovieSD(): |
359
|
|
|
case $this->isMovie3D(): |
360
|
|
|
case $this->isMovieBluRay(): |
361
|
|
|
case $this->isMovieHD(): |
362
|
|
|
case $this->isMovieOther(): |
363
|
|
|
return true; |
364
|
|
|
default: |
365
|
|
|
return false; |
366
|
|
|
} |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
return false; |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
/** |
373
|
|
|
* @return bool |
374
|
|
|
*/ |
375
|
|
|
public function isMovieForeign(): bool |
376
|
|
|
{ |
377
|
|
|
switch (true) { |
|
|
|
|
378
|
|
|
case $this->isConsole(): |
379
|
|
|
return true; |
380
|
|
|
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): |
381
|
|
|
case stripos($this->releaseName, 'Castellano') !== false: |
382
|
|
|
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): |
383
|
|
|
$this->tmpCat = Category::MOVIE_FOREIGN; |
384
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_FOREIGN; |
385
|
|
|
|
386
|
|
|
return true; |
387
|
|
|
default: |
388
|
|
|
return false; |
389
|
|
|
} |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* @return bool |
394
|
|
|
*/ |
395
|
|
|
public function isMovieDVD(): bool |
396
|
|
|
{ |
397
|
|
|
if (preg_match('/(dvd\-?r|[._ -]dvd|dvd9|dvd5|[._ -]r5)[._ -]/i', $this->releaseName)) { |
398
|
|
|
$this->tmpCat = Category::MOVIE_DVD; |
399
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_DVD; |
400
|
|
|
|
401
|
|
|
return true; |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
return false; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @return bool |
409
|
|
|
*/ |
410
|
|
|
public function isMovieSD(): bool |
411
|
|
|
{ |
412
|
|
|
if (preg_match('/(divx|dvdscr|extrascene|dvdrip|\.CAM|HDTS(-LINE)?|vhsrip|xvid(vd)?)[._ -]/i', $this->releaseName)) { |
413
|
|
|
$this->tmpCat = Category::MOVIE_SD; |
414
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_SD; |
415
|
|
|
|
416
|
|
|
return true; |
417
|
|
|
} |
418
|
|
|
|
419
|
|
|
return false; |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
/** |
423
|
|
|
* @return bool |
424
|
|
|
*/ |
425
|
|
|
public function isMovie3D(): bool |
426
|
|
|
{ |
427
|
|
|
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)) { |
428
|
|
|
$this->tmpCat = Category::MOVIE_3D; |
429
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_3D; |
430
|
|
|
|
431
|
|
|
return true; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
return false; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* @return bool |
439
|
|
|
*/ |
440
|
|
|
public function isMovieBluRay(): bool |
441
|
|
|
{ |
442
|
|
|
if (preg_match('/bluray\-|[._ -]bd?[._ -]?(25|50)|blu-ray|Bluray\s\-\sUntouched|[._ -]untouched[._ -]/i', $this->releaseName) |
443
|
|
|
&& ! preg_match('/SecretUsenet\.com/i', $this->releaseName)) { |
444
|
|
|
$this->tmpCat = Category::MOVIE_BLURAY; |
445
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_BLURAY; |
446
|
|
|
|
447
|
|
|
return true; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
return false; |
451
|
|
|
} |
452
|
|
|
|
453
|
|
|
/** |
454
|
|
|
* @return bool |
455
|
|
|
*/ |
456
|
|
|
public function isMovieHD(): bool |
457
|
|
|
{ |
458
|
|
|
if (preg_match('/720p|1080p|AVC|VC1|VC\-1|web\-dl|wmvhd|x264|XvidHD|bdrip/i', $this->releaseName)) { |
459
|
|
|
$this->tmpCat = Category::MOVIE_HD; |
460
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_HD; |
461
|
|
|
|
462
|
|
|
return true; |
463
|
|
|
} |
464
|
|
|
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
465
|
|
|
$this->tmpCat = Category::MOVIE_HD; |
466
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_HD; |
467
|
|
|
|
468
|
|
|
return true; |
469
|
|
|
} |
470
|
|
|
|
471
|
|
|
return false; |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
/** |
475
|
|
|
* @return bool |
476
|
|
|
*/ |
477
|
|
|
public function isMovieUHD(): bool |
478
|
|
|
{ |
479
|
|
|
if (! preg_match('/(S\d+).*(2160p).*(Netflix|Amazon).*(TrollUHD|NTb|VLAD)/i', $this->releaseName) && false !== stripos($this->releaseName, '2160p')) { |
480
|
|
|
$this->tmpCat = Category::MOVIE_UHD; |
481
|
|
|
$this->tmpTag = [Category::TAG_MOVIE_UHD, Category::TAG_MOVIE_HD]; |
482
|
|
|
|
483
|
|
|
return true; |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
return false; |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* @return bool |
491
|
|
|
*/ |
492
|
|
|
public function isMovieOther(): bool |
493
|
|
|
{ |
494
|
|
|
if (preg_match('/[._ -]cam[._ -]/i', $this->releaseName)) { |
495
|
|
|
$this->tmpCat = Category::MOVIE_OTHER; |
496
|
|
|
$this->tmpTag[] = Category::TAG_MOVIE_OTHER; |
497
|
|
|
|
498
|
|
|
return true; |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
return false; |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
/** |
505
|
|
|
* @return bool |
506
|
|
|
*/ |
507
|
|
|
public function isMovieWEBDL(): bool |
508
|
|
|
{ |
509
|
|
|
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
510
|
|
|
$this->tmpCat = Category::MOVIE_WEBDL; |
511
|
|
|
$this->tmpTag = [Category::TAG_MOVIE_WEBDL, Category::TAG_MOVIE_HD]; |
512
|
|
|
|
513
|
|
|
return true; |
514
|
|
|
} |
515
|
|
|
|
516
|
|
|
return false; |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/** |
520
|
|
|
* @return bool |
521
|
|
|
*/ |
522
|
|
|
public function isMovieX265(): bool |
523
|
|
|
{ |
524
|
|
|
if (preg_match('/(\w+[\.-_\s]+).*(x265).*(Tigole|SESKAPiLE|CHD|IAMABLE|THREESOME|OohLaLa|DEFLATE|NCmt)/i', $this->releaseName)) { |
525
|
|
|
$this->tmpCat = Category::MOVIE_X265; |
526
|
|
|
$this->tmpTag = [Category::TAG_MOVIE_X265, Category::TAG_MOVIE_HD]; |
527
|
|
|
|
528
|
|
|
return true; |
529
|
|
|
} |
530
|
|
|
|
531
|
|
|
return false; |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
// PC. |
535
|
|
|
|
536
|
|
|
/** |
537
|
|
|
* @return bool |
538
|
|
|
*/ |
539
|
|
|
public function isPC(): bool |
540
|
|
|
{ |
541
|
|
|
switch (true) { |
|
|
|
|
542
|
|
|
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): |
543
|
|
|
return false; |
544
|
|
|
case $this->isPhone(): |
545
|
|
|
case $this->isMac(): |
546
|
|
|
case $this->isPCGame(): |
547
|
|
|
case $this->isISO(): |
548
|
|
|
case $this->is0day(): |
549
|
|
|
return true; |
550
|
|
|
default: |
551
|
|
|
return false; |
552
|
|
|
} |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** |
556
|
|
|
* @return bool |
557
|
|
|
*/ |
558
|
|
|
public function isPhone(): bool |
559
|
|
|
{ |
560
|
|
|
switch (true) { |
|
|
|
|
561
|
|
|
case preg_match('/[^a-z0-9](IPHONE|ITOUCH|IPAD)[._ -]/i', $this->releaseName): |
562
|
|
|
$this->tmpCat = Category::PC_PHONE_IOS; |
563
|
|
|
$this->tmpTag[] = Category::TAG_PC_PHONE_IOS; |
564
|
|
|
break; |
565
|
|
|
case preg_match('/[._ -]?(ANDROID)[._ -]/i', $this->releaseName): |
566
|
|
|
$this->tmpCat = Category::PC_PHONE_ANDROID; |
567
|
|
|
$this->tmpTag[] = Category::TAG_PC_PHONE_ANDROID; |
568
|
|
|
break; |
569
|
|
|
case preg_match('/[^a-z0-9](symbian|xscale|wm5|wm6)[._ -]/i', $this->releaseName): |
570
|
|
|
$this->tmpCat = Category::PC_PHONE_OTHER; |
571
|
|
|
$this->tmpTag[] = Category::TAG_PC_PHONE_OTHER; |
572
|
|
|
break; |
573
|
|
|
default: |
574
|
|
|
return false; |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
return true; |
578
|
|
|
} |
579
|
|
|
|
580
|
|
|
/** |
581
|
|
|
* @return bool |
582
|
|
|
*/ |
583
|
|
|
public function isISO(): bool |
584
|
|
|
{ |
585
|
|
|
switch (true) { |
|
|
|
|
586
|
|
|
case preg_match('/[._ -]([a-zA-Z]{2,10})?iso[ _.-]|[\-. ]([a-z]{2,10})?iso$/i', $this->releaseName): |
587
|
|
|
case preg_match('/[._ -](DYNAMiCS|INFINITESKILLS|UDEMY|kEISO|PLURALSIGHT|DIGITALTUTORS|TUTSPLUS|OSTraining|PRODEV|CBT\.Nuggets|COMPRISED)/i', $this->releaseName): |
588
|
|
|
$this->tmpCat = Category::PC_ISO; |
589
|
|
|
$this->tmpTag[] = Category::TAG_PC_ISO; |
590
|
|
|
|
591
|
|
|
return true; |
592
|
|
|
default: |
593
|
|
|
return false; |
594
|
|
|
} |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
/** |
598
|
|
|
* @return bool |
599
|
|
|
*/ |
600
|
|
|
public function is0day(): bool |
601
|
|
|
{ |
602
|
|
|
switch (true) { |
|
|
|
|
603
|
|
|
case preg_match('/[._ -]exe$|[._ -](utorrent|Virtualbox)[._ -]|\b0DAY\b|incl.+crack| DRM$|>DRM</i', $this->releaseName): |
604
|
|
|
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): |
605
|
|
|
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): |
606
|
|
|
$this->tmpCat = Category::PC_0DAY; |
607
|
|
|
$this->tmpTag[] = Category::TAG_PC_0DAY; |
608
|
|
|
|
609
|
|
|
return true; |
610
|
|
|
default: |
611
|
|
|
return false; |
612
|
|
|
} |
613
|
|
|
} |
614
|
|
|
|
615
|
|
|
/** |
616
|
|
|
* @return bool |
617
|
|
|
*/ |
618
|
|
|
public function isMac(): bool |
619
|
|
|
{ |
620
|
|
|
if (preg_match('/(\b|[._ -])mac([\.\s])?osx(\b|[\-_. ])/i', $this->releaseName)) { |
621
|
|
|
$this->tmpCat = Category::PC_MAC; |
622
|
|
|
$this->tmpTag[] = Category::TAG_PC_MAC; |
623
|
|
|
|
624
|
|
|
return true; |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
return false; |
628
|
|
|
} |
629
|
|
|
|
630
|
|
|
/** |
631
|
|
|
* @return bool |
632
|
|
|
*/ |
633
|
|
|
public function isPCGame(): bool |
634
|
|
|
{ |
635
|
|
|
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)) { |
636
|
|
|
$this->tmpCat = Category::PC_GAMES; |
637
|
|
|
$this->tmpTag[] = Category::TAG_PC_GAMES; |
638
|
|
|
|
639
|
|
|
return true; |
640
|
|
|
} |
641
|
|
|
|
642
|
|
|
if ($this->checkPoster('/\<PC\@MASTER\.RACE\>/i', $this->poster, Category::PC_GAMES)) { |
643
|
|
|
return true; |
644
|
|
|
} |
645
|
|
|
|
646
|
|
|
return false; |
647
|
|
|
} |
648
|
|
|
|
649
|
|
|
// XXX. |
650
|
|
|
|
651
|
|
|
/** |
652
|
|
|
* @return bool |
653
|
|
|
*/ |
654
|
|
|
public function isXxx(): bool |
655
|
|
|
{ |
656
|
|
|
switch (true) { |
657
|
|
|
case ! preg_match('/\bXXX\b|(a\.b\.erotica|ClubSeventeen|Cum(ming|shot)|Err?oticax?|Porn(o|lation)?|Imageset|PICTURESET|JAV Uncensored|lesb(ians?|os?)|mastur(bation|e?bate)|My_Stepfather_Made_Me|nympho?|OLDER ANGELS|pictures\.erotica\.anime|sexontv|slut|Squirt|SWE6RUS|Transsexual|whore)/i', $this->releaseName): |
658
|
|
|
return false; |
659
|
|
|
case $this->isXxxPack(): |
660
|
|
|
case $this->isXxxClipSD(): |
661
|
|
|
case $this->isXxxSD(): |
662
|
|
|
case $this->isXxxUHD(): |
663
|
|
|
case $this->isXxxClipHD(): |
664
|
|
|
case $this->catWebDL && $this->isXxxWEBDL(): |
665
|
|
|
case $this->isXxx264(): |
666
|
|
|
case $this->isXxxXvid(): |
667
|
|
|
case $this->isXxxImageset(): |
668
|
|
|
case $this->isXxxWMV(): |
669
|
|
|
case $this->isXxxDVD(): |
670
|
|
|
case $this->isXxxOther(): |
671
|
|
|
|
672
|
|
|
return true; |
673
|
|
|
default: |
674
|
|
|
$this->tmpCat = Category::XXX_OTHER; |
675
|
|
|
$this->tmpTag[] = Category::TAG_XXX_OTHER; |
676
|
|
|
|
677
|
|
|
return true; |
678
|
|
|
} |
679
|
|
|
} |
680
|
|
|
|
681
|
|
|
/** |
682
|
|
|
* @return bool |
683
|
|
|
*/ |
684
|
|
|
public function isXxx264(): bool |
685
|
|
|
{ |
686
|
|
|
if (preg_match('/720p|1080(hd|[ip])|[xh][^a-z0-9]?264/i', $this->releaseName) && ! preg_match('/\bwmv\b/i', $this->releaseName) && stripos($this->releaseName, 'SDX264XXX') === false) { |
687
|
|
|
$this->tmpCat = Category::XXX_X264; |
688
|
|
|
$this->tmpTag[] = Category::TAG_XXX_X264; |
689
|
|
|
|
690
|
|
|
return true; |
691
|
|
|
} |
692
|
|
|
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
693
|
|
|
$this->tmpCat = Category::XXX_X264; |
694
|
|
|
$this->tmpTag[] = Category::TAG_XXX_X264; |
695
|
|
|
|
696
|
|
|
return true; |
697
|
|
|
} |
698
|
|
|
|
699
|
|
|
return false; |
700
|
|
|
} |
701
|
|
|
|
702
|
|
|
/** |
703
|
|
|
* @return bool |
704
|
|
|
*/ |
705
|
|
|
public function isXxxUHD(): bool |
706
|
|
|
{ |
707
|
|
|
if (preg_match('/XXX.+(2160p)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG))/i', $this->releaseName)) { |
708
|
|
|
$this->tmpCat = Category::XXX_UHD; |
709
|
|
|
$this->tmpTag[] = Category::TAG_XXX_UHD; |
710
|
|
|
|
711
|
|
|
return true; |
712
|
|
|
} |
713
|
|
|
|
714
|
|
|
return false; |
715
|
|
|
} |
716
|
|
|
|
717
|
|
|
/** |
718
|
|
|
* @return bool |
719
|
|
|
*/ |
720
|
|
|
public function isXxxClipHD(): bool |
721
|
|
|
{ |
722
|
|
|
if (preg_match('/^[\w\-.]+(\d{2}\.\d{2}\.\d{2}).+(720|1080)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG))/i', $this->releaseName)) { |
723
|
|
|
$this->tmpCat = Category::XXX_CLIPHD; |
724
|
|
|
$this->tmpTag[] = Category::TAG_XXX_CLIPHD; |
725
|
|
|
|
726
|
|
|
return true; |
727
|
|
|
} |
728
|
|
|
|
729
|
|
|
return false; |
730
|
|
|
} |
731
|
|
|
|
732
|
|
|
/** |
733
|
|
|
* @return bool |
734
|
|
|
*/ |
735
|
|
|
public function isXxxWMV(): bool |
736
|
|
|
{ |
737
|
|
|
if (preg_match('/(\d{2}\.\d{2}\.\d{2})|([ex]\d{2,})|[^a-z0-9](f4v|flv|isom|(issue\.\d{2,})|mov|mp(4|eg)|multiformat|pack-|realmedia|uhq|wmv)[^a-z0-9]/i', $this->releaseName) && stripos($this->releaseName, 'SDX264XXX') === false) { |
738
|
|
|
$this->tmpCat = Category::XXX_WMV; |
739
|
|
|
$this->tmpTag[] = Category::TAG_XXX_WMV; |
740
|
|
|
|
741
|
|
|
return true; |
742
|
|
|
} |
743
|
|
|
|
744
|
|
|
return false; |
745
|
|
|
} |
746
|
|
|
|
747
|
|
|
/** |
748
|
|
|
* @return bool |
749
|
|
|
*/ |
750
|
|
|
public function isXxxXvid(): bool |
751
|
|
|
{ |
752
|
|
|
if (preg_match('/(b[dr]|dvd)rip|detoxication|divx|nympho|pornolation|swe6|tesoro|xvid/i', $this->releaseName)) { |
753
|
|
|
$this->tmpCat = Category::XXX_XVID; |
754
|
|
|
$this->tmpTag[] = Category::TAG_XXX_XVID; |
755
|
|
|
|
756
|
|
|
return true; |
757
|
|
|
} |
758
|
|
|
|
759
|
|
|
return false; |
760
|
|
|
} |
761
|
|
|
|
762
|
|
|
/** |
763
|
|
|
* @return bool |
764
|
|
|
*/ |
765
|
|
|
public function isXxxDVD(): bool |
766
|
|
|
{ |
767
|
|
|
if (preg_match('/dvdr[^i]|dvd[59]/i', $this->releaseName)) { |
768
|
|
|
$this->tmpCat = Category::XXX_DVD; |
769
|
|
|
$this->tmpTag[] = Category::TAG_XXX_DVD; |
770
|
|
|
|
771
|
|
|
return true; |
772
|
|
|
} |
773
|
|
|
|
774
|
|
|
return false; |
775
|
|
|
} |
776
|
|
|
|
777
|
|
|
/** |
778
|
|
|
* @return bool |
779
|
|
|
*/ |
780
|
|
|
public function isXxxImageset(): bool |
781
|
|
|
{ |
782
|
|
|
if (preg_match('/IMAGESET|PICTURESET|ABPEA/i', $this->releaseName)) { |
783
|
|
|
$this->tmpCat = Category::XXX_IMAGESET; |
784
|
|
|
$this->tmpTag[] = Category::TAG_XXX_IMAGESET; |
785
|
|
|
|
786
|
|
|
return true; |
787
|
|
|
} |
788
|
|
|
|
789
|
|
|
return false; |
790
|
|
|
} |
791
|
|
|
|
792
|
|
|
/** |
793
|
|
|
* @return bool |
794
|
|
|
*/ |
795
|
|
|
public function isXxxPack(): bool |
796
|
|
|
{ |
797
|
|
|
if (preg_match('/[ .]PACK[ .]/i', $this->releaseName)) { |
798
|
|
|
$this->tmpCat = Category::XXX_PACK; |
799
|
|
|
$this->tmpTag[] = Category::TAG_XXX_PACK; |
800
|
|
|
|
801
|
|
|
return true; |
802
|
|
|
} |
803
|
|
|
|
804
|
|
|
return false; |
805
|
|
|
} |
806
|
|
|
|
807
|
|
|
/** |
808
|
|
|
* @return bool |
809
|
|
|
*/ |
810
|
|
|
public function isXxxOther(): bool |
811
|
|
|
{ |
812
|
|
|
// If nothing else matches, then try these words. |
813
|
|
|
if (preg_match('/[._ -]Brazzers|Creampie|[._ -]JAV[._ -]|North\.Pole|^Nubiles|She[._ -]?Male|Transsexual|OLDER ANGELS/i', $this->releaseName)) { |
814
|
|
|
$this->tmpCat = Category::XXX_OTHER; |
815
|
|
|
$this->tmpTag[] = Category::TAG_XXX_OTHER; |
816
|
|
|
|
817
|
|
|
return true; |
818
|
|
|
} |
819
|
|
|
|
820
|
|
|
return false; |
821
|
|
|
} |
822
|
|
|
|
823
|
|
|
/** |
824
|
|
|
* @return bool |
825
|
|
|
*/ |
826
|
|
|
public function isXxxClipSD(): bool |
827
|
|
|
{ |
828
|
|
|
switch (true) { |
|
|
|
|
829
|
|
|
case $this->checkPoster('/oz@lot[.]com/i', $this->poster, Category::XXX_CLIPSD): |
830
|
|
|
return true; |
831
|
|
|
case $this->checkPoster('/anon@y[.]com/i', $this->poster, Category::XXX_CLIPSD): |
832
|
|
|
return true; |
833
|
|
|
case $this->checkPoster('/@md-hobbys[.]com/i', $this->poster, Category::XXX_CLIPSD): |
834
|
|
|
return true; |
835
|
|
|
case stripos($this->releaseName, 'SDPORN') !== false: |
836
|
|
|
$this->tmpCat = Category::XXX_CLIPSD; |
837
|
|
|
$this->tmpTag[] = Category::TAG_XXX_CLIPSD; |
838
|
|
|
|
839
|
|
|
return true; |
840
|
|
|
case preg_match('/(iPT\sTeam|KLEENEX)/i', $this->releaseName): |
841
|
|
|
$this->tmpCat = Category::XXX_CLIPSD; |
842
|
|
|
$this->tmpTag[] = Category::TAG_XXX_CLIPSD; |
843
|
|
|
|
844
|
|
|
return true; |
845
|
|
|
default: |
846
|
|
|
return false; |
847
|
|
|
} |
848
|
|
|
} |
849
|
|
|
|
850
|
|
|
/** |
851
|
|
|
* @return bool |
852
|
|
|
*/ |
853
|
|
|
public function isXxxSD(): bool |
854
|
|
|
{ |
855
|
|
|
if (preg_match('/SDX264XXX|XXX\.HR\./i', $this->releaseName)) { |
856
|
|
|
$this->tmpCat = Category::XXX_SD; |
857
|
|
|
$this->tmpTag[] = Category::TAG_XXX_SD; |
858
|
|
|
|
859
|
|
|
return true; |
860
|
|
|
} |
861
|
|
|
|
862
|
|
|
return false; |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
/** |
866
|
|
|
* @return bool |
867
|
|
|
*/ |
868
|
|
|
public function isXxxWEBDL(): bool |
869
|
|
|
{ |
870
|
|
|
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
871
|
|
|
$this->tmpCat = Category::XXX_WEBDL; |
872
|
|
|
$this->tmpTag[] = Category::TAG_XXX_WEBDL; |
873
|
|
|
|
874
|
|
|
return true; |
875
|
|
|
} |
876
|
|
|
|
877
|
|
|
return false; |
878
|
|
|
} |
879
|
|
|
|
880
|
|
|
// Console. |
881
|
|
|
|
882
|
|
|
/** |
883
|
|
|
* @return bool |
884
|
|
|
*/ |
885
|
|
|
public function isConsole(): bool |
886
|
|
|
{ |
887
|
|
|
switch (true) { |
888
|
|
|
case $this->isGameNDS(): |
889
|
|
|
case $this->isGame3DS(): |
890
|
|
|
case $this->isGamePS3(): |
891
|
|
|
case $this->isGamePS4(): |
892
|
|
|
case $this->isGamePSP(): |
893
|
|
|
case $this->isGamePSVita(): |
894
|
|
|
case $this->isGameWiiWare(): |
895
|
|
|
case $this->isGameWiiU(): |
896
|
|
|
case $this->isGameWii(): |
897
|
|
|
case $this->isGameNGC(): |
898
|
|
|
case $this->isGameXBOX360DLC(): |
899
|
|
|
case $this->isGameXBOX360(): |
900
|
|
|
case $this->isGameXBOXONE(): |
901
|
|
|
case $this->isGameXBOX(): |
902
|
|
|
case $this->isGameOther(): |
903
|
|
|
return true; |
904
|
|
|
default: |
905
|
|
|
return false; |
906
|
|
|
} |
907
|
|
|
} |
908
|
|
|
|
909
|
|
|
/** |
910
|
|
|
* @return bool |
911
|
|
|
*/ |
912
|
|
|
public function isGameNDS(): bool |
913
|
|
|
{ |
914
|
|
|
if (preg_match('/^NDS|[^a-zA-Z0-9]NDS|[\._-](nds|NDS)|nintendo.+[^3]n?dsi?/', $this->releaseName)) { |
915
|
|
|
if (preg_match('/\((DE|DSi(\sEnhanched)?|_NDS-|EUR?|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA?)\)/i', $this->releaseName)) { |
916
|
|
|
$this->tmpCat = Category::GAME_NDS; |
917
|
|
|
$this->tmpTag[] = Category::TAG_GAME_NDS; |
918
|
|
|
|
919
|
|
|
return true; |
920
|
|
|
} |
921
|
|
|
if (preg_match('/EUR|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA|\bROMS?(et)?\b/i', $this->releaseName)) { |
922
|
|
|
$this->tmpCat = Category::GAME_NDS; |
923
|
|
|
$this->tmpTag[] = Category::TAG_GAME_NDS; |
924
|
|
|
|
925
|
|
|
return true; |
926
|
|
|
} |
927
|
|
|
} |
928
|
|
|
|
929
|
|
|
return false; |
930
|
|
|
} |
931
|
|
|
|
932
|
|
|
/** |
933
|
|
|
* @return bool |
934
|
|
|
*/ |
935
|
|
|
public function isGame3DS(): bool |
936
|
|
|
{ |
937
|
|
|
if (preg_match('/\b3DS\b[^max]|[\._-]3ds|nintendo.+3ds|[_\.]3DS-/i', $this->releaseName) && ! preg_match('/3ds max/i', $this->releaseName) && preg_match('/(EUR|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA|ASIA)/i', $this->releaseName)) { |
938
|
|
|
$this->tmpCat = Category::GAME_3DS; |
939
|
|
|
$this->tmpTag[] = Category::TAG_GAME_3DS; |
940
|
|
|
|
941
|
|
|
return true; |
942
|
|
|
} |
943
|
|
|
|
944
|
|
|
return false; |
945
|
|
|
} |
946
|
|
|
|
947
|
|
|
/** |
948
|
|
|
* @return bool |
949
|
|
|
*/ |
950
|
|
|
public function isGameNGC(): bool |
951
|
|
|
{ |
952
|
|
|
if (preg_match('/[\._-]N?G(AME)?C(UBE)?-/i', $this->releaseName)) { |
953
|
|
|
if (preg_match('/_(EUR?|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA?)_/i', $this->releaseName)) { |
954
|
|
|
$this->tmpCat = Category::GAME_OTHER; |
955
|
|
|
$this->tmpTag[] = Category::TAG_GAME_OTHER; |
956
|
|
|
|
957
|
|
|
return true; |
958
|
|
|
} |
959
|
|
|
if (preg_match('/-(((STAR|DEATH|STINKY|MOON|HOLY|G)?CUBE(SOFT)?)|(DARKFORCE|DNL|GP|ICP|iNSOMNIA|JAY|LaKiTu|METHS|NOMIS|QUBiSM|PANDORA|REACT0R|SUNSHiNE|SAVEPOiNT|SYNDiCATE|WAR3X|WRG))/i', $this->releaseName)) { |
960
|
|
|
$this->tmpCat = Category::GAME_OTHER; |
961
|
|
|
$this->tmpTag[] = Category::TAG_GAME_OTHER; |
962
|
|
|
|
963
|
|
|
return true; |
964
|
|
|
} |
965
|
|
|
} |
966
|
|
|
|
967
|
|
|
return false; |
968
|
|
|
} |
969
|
|
|
|
970
|
|
|
/** |
971
|
|
|
* @return bool |
972
|
|
|
*/ |
973
|
|
|
public function isGamePS3(): bool |
974
|
|
|
{ |
975
|
|
|
if (preg_match('/[^e]PS3/i', $this->releaseName)) { |
976
|
|
|
if (preg_match('/ANTiDOTE|DLC|DUPLEX|EUR?|Googlecus|GOTY|\-HR|iNSOMNi|JAP|JPN|KONDIOS|\[PS3\]|PSN/i', $this->releaseName)) { |
977
|
|
|
$this->tmpCat = Category::GAME_PS3; |
978
|
|
|
$this->tmpTag[] = Category::TAG_GAME_PS3; |
979
|
|
|
|
980
|
|
|
return true; |
981
|
|
|
} |
982
|
|
|
if (preg_match('/AGENCY|APATHY|Caravan|MULTi|NRP|NTSC|PAL|SPLiT|STRiKE|USA?|ZRY/i', $this->releaseName)) { |
983
|
|
|
$this->tmpCat = Category::GAME_PS3; |
984
|
|
|
$this->tmpTag[] = Category::TAG_GAME_PS3; |
985
|
|
|
|
986
|
|
|
return true; |
987
|
|
|
} |
988
|
|
|
} |
989
|
|
|
|
990
|
|
|
return false; |
991
|
|
|
} |
992
|
|
|
|
993
|
|
|
/** |
994
|
|
|
* @return bool |
995
|
|
|
*/ |
996
|
|
|
public function isGamePS4(): bool |
997
|
|
|
{ |
998
|
|
|
if (preg_match('/[ \(_.-]PS4[ \)_.-]/i', $this->releaseName)) { |
999
|
|
|
if (preg_match('/ANTiDOTE|DLC|DUPLEX|EUR?|Googlecus|GOTY|\-HR|iNSOMNi|JAP|JPN|KONDIOS|\[PS4\]/i', $this->releaseName)) { |
1000
|
|
|
$this->tmpCat = Category::GAME_PS4; |
1001
|
|
|
$this->tmpTag[] = Category::TAG_GAME_PS4; |
1002
|
|
|
|
1003
|
|
|
return true; |
1004
|
|
|
} |
1005
|
|
|
if (preg_match('/AGENCY|APATHY|Caravan|MULTi|NRP|NTSC|PAL|SPLiT|STRiKE|USA?|WaYsTeD|ZRY/i', $this->releaseName)) { |
1006
|
|
|
$this->tmpCat = Category::GAME_PS4; |
1007
|
|
|
$this->tmpTag[] = Category::TAG_GAME_PS4; |
1008
|
|
|
|
1009
|
|
|
return true; |
1010
|
|
|
} |
1011
|
|
|
} |
1012
|
|
|
|
1013
|
|
|
return false; |
1014
|
|
|
} |
1015
|
|
|
|
1016
|
|
|
/** |
1017
|
|
|
* @return bool |
1018
|
|
|
*/ |
1019
|
|
|
public function isGamePSP(): bool |
1020
|
|
|
{ |
1021
|
|
|
if (stripos($this->releaseName, 'PSP') !== false) { |
1022
|
|
|
if (preg_match('/[._ -](BAHAMUT|Caravan|EBOOT|EMiNENT|EUR?|EvoX|GAME|GHS|Googlecus|HandHeld|\-HR|JAP|JPN|KLOTEKLAPPERS|KOR|NTSC|PAL)/i', $this->releaseName)) { |
1023
|
|
|
$this->tmpCat = Category::GAME_PSP; |
1024
|
|
|
$this->tmpTag[] = Category::TAG_GAME_PSP; |
1025
|
|
|
|
1026
|
|
|
return true; |
1027
|
|
|
} |
1028
|
|
|
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)) { |
1029
|
|
|
$this->tmpCat = Category::GAME_PSP; |
1030
|
|
|
$this->tmpTag[] = Category::TAG_GAME_PSP; |
1031
|
|
|
|
1032
|
|
|
return true; |
1033
|
|
|
} |
1034
|
|
|
} |
1035
|
|
|
|
1036
|
|
|
return false; |
1037
|
|
|
} |
1038
|
|
|
|
1039
|
|
|
/** |
1040
|
|
|
* @return bool |
1041
|
|
|
*/ |
1042
|
|
|
public function isGamePSVita(): bool |
1043
|
|
|
{ |
1044
|
|
|
if (preg_match('/PS ?Vita/i', $this->releaseName)) { |
1045
|
|
|
$this->tmpCat = Category::GAME_PSVITA; |
1046
|
|
|
$this->tmpTag[] = Category::TAG_GAME_PSVITA; |
1047
|
|
|
|
1048
|
|
|
return true; |
1049
|
|
|
} |
1050
|
|
|
|
1051
|
|
|
return false; |
1052
|
|
|
} |
1053
|
|
|
|
1054
|
|
|
/** |
1055
|
|
|
* @return bool |
1056
|
|
|
*/ |
1057
|
|
|
public function isGameWiiWare(): bool |
1058
|
|
|
{ |
1059
|
|
|
if (preg_match('/(Console|DLC|VC).+[._ -]WII|(Console|DLC|VC)[._ -]WII|WII[._ -].+(Console|DLC|VC)|WII[._ -](Console|DLC|VC)|WIIWARE/i', $this->releaseName)) { |
1060
|
|
|
$this->tmpCat = Category::GAME_WIIWARE; |
1061
|
|
|
$this->tmpTag[] = Category::TAG_GAME_WIIWARE; |
1062
|
|
|
|
1063
|
|
|
return true; |
1064
|
|
|
} |
1065
|
|
|
|
1066
|
|
|
return false; |
1067
|
|
|
} |
1068
|
|
|
|
1069
|
|
|
/** |
1070
|
|
|
* @return bool |
1071
|
|
|
*/ |
1072
|
|
|
public function isGameWiiU(): bool |
1073
|
|
|
{ |
1074
|
|
|
switch (true) { |
|
|
|
|
1075
|
|
|
case ! preg_match('/WII-?U/i', $this->releaseName): |
1076
|
|
|
return false; |
1077
|
|
|
case preg_match('/[._ -](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)/i', $this->releaseName): |
1078
|
|
|
case preg_match('/[._ -](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)/i', $this->releaseName): |
1079
|
|
|
case preg_match('/[._ -](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)/i', $this->releaseName): |
1080
|
|
|
$this->tmpCat = Category::GAME_WIIU; |
1081
|
|
|
$this->tmpTag[] = Category::TAG_GAME_WIIU; |
1082
|
|
|
|
1083
|
|
|
return true; |
1084
|
|
|
default: |
1085
|
|
|
return false; |
1086
|
|
|
} |
1087
|
|
|
} |
1088
|
|
|
|
1089
|
|
|
/** |
1090
|
|
|
* @return bool |
1091
|
|
|
*/ |
1092
|
|
|
public function isGameWii(): bool |
1093
|
|
|
{ |
1094
|
|
|
switch (true) { |
|
|
|
|
1095
|
|
|
case stripos($this->releaseName, 'WII') === false: |
1096
|
|
|
return false; |
1097
|
|
|
case preg_match('/[._ -](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)/i', $this->releaseName): |
1098
|
|
|
case preg_match('/[._ -](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)/i', $this->releaseName): |
1099
|
|
|
case preg_match('/[._ -](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)/i', $this->releaseName): |
1100
|
|
|
$this->tmpCat = Category::GAME_WII; |
1101
|
|
|
$this->tmpTag[] = Category::TAG_GAME_WII; |
1102
|
|
|
|
1103
|
|
|
return true; |
1104
|
|
|
default: |
1105
|
|
|
return false; |
1106
|
|
|
} |
1107
|
|
|
} |
1108
|
|
|
|
1109
|
|
|
/** |
1110
|
|
|
* @return bool |
1111
|
|
|
*/ |
1112
|
|
|
public function isGameXBOX360DLC(): bool |
1113
|
|
|
{ |
1114
|
|
|
if (preg_match('/DLC.+xbox360|xbox360.+DLC|XBLA.+xbox360|xbox360.+XBLA/i', $this->releaseName)) { |
1115
|
|
|
$this->tmpCat = Category::GAME_XBOX360DLC; |
1116
|
|
|
$this->tmpTag[] = Category::TAG_GAME_XBOX360DLC; |
1117
|
|
|
|
1118
|
|
|
return true; |
1119
|
|
|
} |
1120
|
|
|
|
1121
|
|
|
return false; |
1122
|
|
|
} |
1123
|
|
|
|
1124
|
|
|
/** |
1125
|
|
|
* @return bool |
1126
|
|
|
*/ |
1127
|
|
|
public function isGameXBOX360(): bool |
1128
|
|
|
{ |
1129
|
|
|
if (stripos($this->releaseName, '/XBOX360/i') !== false) { |
1130
|
|
|
$this->tmpCat = Category::GAME_XBOX360; |
1131
|
|
|
$this->tmpTag[] = Category::TAG_GAME_XBOX360; |
1132
|
|
|
|
1133
|
|
|
return true; |
1134
|
|
|
} |
1135
|
|
|
if (stripos($this->releaseName, 'x360') !== false) { |
1136
|
|
|
if (preg_match('/Allstars|ASiA|CCCLX|COMPLEX|DAGGER|GLoBAL|iMARS|JAP|JPN|MULTi|NTSC|PAL|REPACK|RRoD|RF|SWAG|USA?/i', $this->releaseName)) { |
1137
|
|
|
$this->tmpCat = Category::GAME_XBOX360; |
1138
|
|
|
$this->tmpTag[] = Category::TAG_GAME_XBOX360; |
1139
|
|
|
|
1140
|
|
|
return true; |
1141
|
|
|
} |
1142
|
|
|
if (preg_match('/DAMNATION|GERMAN|GOTY|iNT|iTA|JTAG|KINECT|MARVEL|MUX360|RANT|SPARE|SPANISH|VATOS|XGD/i', $this->releaseName)) { |
1143
|
|
|
$this->tmpCat = Category::GAME_XBOX360; |
1144
|
|
|
$this->tmpTag[] = Category::TAG_GAME_XBOX360; |
1145
|
|
|
|
1146
|
|
|
return true; |
1147
|
|
|
} |
1148
|
|
|
} |
1149
|
|
|
|
1150
|
|
|
return false; |
1151
|
|
|
} |
1152
|
|
|
|
1153
|
|
|
/** |
1154
|
|
|
* @return bool |
1155
|
|
|
*/ |
1156
|
|
|
public function isGameXBOXONE(): bool |
1157
|
|
|
{ |
1158
|
|
|
if (preg_match('/XBOXONE|XBOX\.ONE/i', $this->releaseName)) { |
1159
|
|
|
$this->tmpCat = Category::GAME_XBOXONE; |
1160
|
|
|
$this->tmpTag[] = Category::TAG_GAME_XBOXONE; |
1161
|
|
|
|
1162
|
|
|
return true; |
1163
|
|
|
} |
1164
|
|
|
|
1165
|
|
|
return false; |
1166
|
|
|
} |
1167
|
|
|
|
1168
|
|
|
/** |
1169
|
|
|
* @return bool |
1170
|
|
|
*/ |
1171
|
|
|
public function isGameXBOX(): bool |
1172
|
|
|
{ |
1173
|
|
|
if (stripos($this->releaseName, 'XBOX') !== false) { |
1174
|
|
|
$this->tmpCat = Category::GAME_XBOX; |
1175
|
|
|
$this->tmpTag[] = Category::TAG_GAME_XBOX; |
1176
|
|
|
|
1177
|
|
|
return true; |
1178
|
|
|
} |
1179
|
|
|
|
1180
|
|
|
return false; |
1181
|
|
|
} |
1182
|
|
|
|
1183
|
|
|
/** |
1184
|
|
|
* @return bool |
1185
|
|
|
*/ |
1186
|
|
|
public function isGameOther(): bool |
1187
|
|
|
{ |
1188
|
|
|
if (preg_match('/\b(PS(1)X|PS2|SNES|NES|SEGA\s(GENESIS|CD)|GB([AC])|Dreamcast|SEGA\sSaturn|Atari\s(Jaguar)?|3DO)\b/i', $this->releaseName) && preg_match('/EUR|FR|GAME|HOL|\bISO\b|JP|JPN|NL|NTSC|PAL|KS|USA|ROMS?(et)?/i', $this->releaseName)) { |
1189
|
|
|
$this->tmpCat = Category::GAME_OTHER; |
1190
|
|
|
$this->tmpTag[] = Category::TAG_GAME_OTHER; |
1191
|
|
|
|
1192
|
|
|
return true; |
1193
|
|
|
} |
1194
|
|
|
|
1195
|
|
|
return false; |
1196
|
|
|
} |
1197
|
|
|
|
1198
|
|
|
// Music. |
1199
|
|
|
|
1200
|
|
|
/** |
1201
|
|
|
* @return bool |
1202
|
|
|
*/ |
1203
|
|
|
public function isMusic(): bool |
1204
|
|
|
{ |
1205
|
|
|
switch (true) { |
|
|
|
|
1206
|
|
|
//They Knew What They Wanted (1940).480p.DVDRIP.MP3-NoGroup -- prevents movies matches with MP3 audio codec in the title |
1207
|
|
|
case preg_match('/\d{3,4}([pi])\.DVD(RIP)?\.MP3[\-\.].*|WEB(-DL|-?RIP)/i', $this->releaseName): |
1208
|
|
|
return false; |
1209
|
|
|
case $this->isMusicVideo(): |
1210
|
|
|
case $this->isAudiobook(): |
1211
|
|
|
case $this->isMusicLossless(): |
1212
|
|
|
case $this->isMusicMP3(): |
1213
|
|
|
case $this->isMusicOther(): |
1214
|
|
|
return true; |
1215
|
|
|
default: |
1216
|
|
|
return false; |
1217
|
|
|
} |
1218
|
|
|
} |
1219
|
|
|
|
1220
|
|
|
/** |
1221
|
|
|
* @return bool |
1222
|
|
|
*/ |
1223
|
|
|
public function isMusicForeign(): bool |
1224
|
|
|
{ |
1225
|
|
|
if ($this->categorizeForeign && 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|bl|cz|de|es|fr|ger|heb|hu|hun|it(a| 19|20\d\d)|jap|ko|kor|nl|pl|se)[ \-\._]/i', $this->releaseName)) { |
1226
|
|
|
$this->tmpCat = Category::MUSIC_FOREIGN; |
1227
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_FOREIGN; |
1228
|
|
|
|
1229
|
|
|
return true; |
1230
|
|
|
} |
1231
|
|
|
|
1232
|
|
|
return false; |
1233
|
|
|
} |
1234
|
|
|
|
1235
|
|
|
/** |
1236
|
|
|
* @return bool |
1237
|
|
|
*/ |
1238
|
|
|
public function isAudiobook(): bool |
1239
|
|
|
{ |
1240
|
|
|
if ($this->categorizeForeign && stripos($this->releaseName, 'Audiobook') !== false) { |
1241
|
|
|
$this->tmpCat = Category::MUSIC_FOREIGN; |
1242
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_FOREIGN; |
1243
|
|
|
|
1244
|
|
|
return true; |
1245
|
|
|
} |
1246
|
|
|
|
1247
|
|
|
return false; |
1248
|
|
|
} |
1249
|
|
|
|
1250
|
|
|
/** |
1251
|
|
|
* @return bool |
1252
|
|
|
*/ |
1253
|
|
|
public function isMusicVideo(): bool |
1254
|
|
|
{ |
1255
|
|
|
if (preg_match('/(720P|x264)\-(19|20)\d\d\-[a-z0-9]{1,12}/i', $this->releaseName)) { |
1256
|
|
|
if ($this->isMusicForeign()) { |
1257
|
|
|
return true; |
1258
|
|
|
} |
1259
|
|
|
$this->tmpCat = Category::MUSIC_VIDEO; |
1260
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_VIDEO; |
1261
|
|
|
|
1262
|
|
|
return true; |
1263
|
|
|
} |
1264
|
|
|
if (preg_match('/[a-z0-9]{1,12}\-(19|20)\d\d\-(720P|x264)/i', $this->releaseName)) { |
1265
|
|
|
if ($this->isMusicForeign()) { |
1266
|
|
|
return true; |
1267
|
|
|
} |
1268
|
|
|
$this->tmpCat = Category::MUSIC_VIDEO; |
1269
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_VIDEO; |
1270
|
|
|
|
1271
|
|
|
return true; |
1272
|
|
|
} |
1273
|
|
|
|
1274
|
|
|
return false; |
1275
|
|
|
} |
1276
|
|
|
|
1277
|
|
|
/** |
1278
|
|
|
* @return bool |
1279
|
|
|
*/ |
1280
|
|
|
public function isMusicLossless(): bool |
1281
|
|
|
{ |
1282
|
|
|
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)) { |
1283
|
|
|
if ($this->isMusicForeign()) { |
1284
|
|
|
return true; |
1285
|
|
|
} |
1286
|
|
|
$this->tmpCat = Category::MUSIC_LOSSLESS; |
1287
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_LOSSLESS; |
1288
|
|
|
|
1289
|
|
|
return true; |
1290
|
|
|
} |
1291
|
|
|
|
1292
|
|
|
return false; |
1293
|
|
|
} |
1294
|
|
|
|
1295
|
|
|
/** |
1296
|
|
|
* @return bool |
1297
|
|
|
*/ |
1298
|
|
|
public function isMusicMP3(): bool |
1299
|
|
|
{ |
1300
|
|
|
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)) { |
1301
|
|
|
if ($this->isMusicForeign()) { |
1302
|
|
|
return true; |
1303
|
|
|
} |
1304
|
|
|
$this->tmpCat = Category::MUSIC_MP3; |
1305
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_MP3; |
1306
|
|
|
|
1307
|
|
|
return true; |
1308
|
|
|
} |
1309
|
|
|
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)) { |
1310
|
|
|
if ($this->isMusicForeign()) { |
1311
|
|
|
return true; |
1312
|
|
|
} |
1313
|
|
|
$this->tmpCat = Category::MUSIC_MP3; |
1314
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_MP3; |
1315
|
|
|
|
1316
|
|
|
return true; |
1317
|
|
|
} |
1318
|
|
|
|
1319
|
|
|
return false; |
1320
|
|
|
} |
1321
|
|
|
|
1322
|
|
|
/** |
1323
|
|
|
* @return bool |
1324
|
|
|
*/ |
1325
|
|
|
public function isMusicOther(): bool |
1326
|
|
|
{ |
1327
|
|
|
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)) { |
1328
|
|
|
if (true !== $this->isMusicForeign()) { |
1329
|
|
|
$this->tmpCat = Category::MUSIC_OTHER; |
1330
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_OTHER; |
1331
|
|
|
} |
1332
|
|
|
|
1333
|
|
|
return true; |
1334
|
|
|
} |
1335
|
|
|
if (preg_match('/\(pure_fm\)|-+\(?(2lp|cd[ms]([\-_ .][a-z]{2})?|cover|ep|ltd_ed|mix|original|ost|.*?(edit(ion)?|remix(es)?|vinyl)|web)\)?-+((19|20)\d\d|you$)/i', $this->releaseName)) { |
1336
|
|
|
$this->tmpCat = Category::MUSIC_OTHER; |
1337
|
|
|
$this->tmpTag[] = Category::TAG_MUSIC_OTHER; |
1338
|
|
|
|
1339
|
|
|
return true; |
1340
|
|
|
} |
1341
|
|
|
|
1342
|
|
|
return false; |
1343
|
|
|
} |
1344
|
|
|
|
1345
|
|
|
// Books. |
1346
|
|
|
|
1347
|
|
|
/** |
1348
|
|
|
* @return bool |
1349
|
|
|
*/ |
1350
|
|
|
public function isBook(): bool |
1351
|
|
|
{ |
1352
|
|
|
switch (true) { |
|
|
|
|
1353
|
|
|
case preg_match('/AVI[._ -]PDF|\.exe|Full[._ -]Video/i', $this->releaseName): |
1354
|
|
|
return false; |
1355
|
|
|
case $this->isComic(): |
1356
|
|
|
case $this->isTechnicalBook(): |
1357
|
|
|
case $this->isMagazine(): |
1358
|
|
|
case $this->isBookOther(): |
1359
|
|
|
case $this->isEBook(): |
1360
|
|
|
return true; |
1361
|
|
|
default: |
1362
|
|
|
return false; |
1363
|
|
|
} |
1364
|
|
|
} |
1365
|
|
|
|
1366
|
|
|
/** |
1367
|
|
|
* @return bool |
1368
|
|
|
*/ |
1369
|
|
|
public function isBookForeign(): bool |
1370
|
|
|
{ |
1371
|
|
|
switch (true) { |
|
|
|
|
1372
|
|
|
case $this->categorizeForeign === false: |
1373
|
|
|
return false; |
1374
|
|
|
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): |
1375
|
|
|
$this->tmpCat = Category::BOOKS_FOREIGN; |
1376
|
|
|
$this->tmpTag[] = Category::TAG_BOOKS_FOREIGN; |
1377
|
|
|
|
1378
|
|
|
return true; |
1379
|
|
|
default: |
1380
|
|
|
return false; |
1381
|
|
|
} |
1382
|
|
|
} |
1383
|
|
|
|
1384
|
|
|
/** |
1385
|
|
|
* @return bool |
1386
|
|
|
*/ |
1387
|
|
|
public function isComic(): bool |
1388
|
|
|
{ |
1389
|
|
|
switch (true) { |
1390
|
|
|
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): |
1391
|
|
|
return false; |
1392
|
|
|
case $this->isBookForeign(): |
1393
|
|
|
break; |
1394
|
|
|
default: |
1395
|
|
|
$this->tmpCat = Category::BOOKS_COMICS; |
1396
|
|
|
$this->tmpTag[] = Category::TAG_BOOKS_COMICS; |
1397
|
|
|
break; |
1398
|
|
|
} |
1399
|
|
|
|
1400
|
|
|
return true; |
1401
|
|
|
} |
1402
|
|
|
|
1403
|
|
|
/** |
1404
|
|
|
* @return bool |
1405
|
|
|
*/ |
1406
|
|
|
public function isTechnicalBook(): bool |
1407
|
|
|
{ |
1408
|
|
|
switch (true) { |
1409
|
|
|
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): |
1410
|
|
|
return false; |
1411
|
|
|
case $this->isBookForeign(): |
1412
|
|
|
break; |
1413
|
|
|
default: |
1414
|
|
|
$this->tmpCat = Category::BOOKS_TECHNICAL; |
1415
|
|
|
$this->tmpTag[] = Category::TAG_BOOKS_TECHNICAL; |
1416
|
|
|
break; |
1417
|
|
|
} |
1418
|
|
|
|
1419
|
|
|
return true; |
1420
|
|
|
} |
1421
|
|
|
|
1422
|
|
|
/** |
1423
|
|
|
* @return bool |
1424
|
|
|
*/ |
1425
|
|
|
public function isMagazine(): bool |
1426
|
|
|
{ |
1427
|
|
|
switch (true) { |
1428
|
|
|
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): |
1429
|
|
|
return false; |
1430
|
|
|
case $this->isBookForeign(): |
1431
|
|
|
break; |
1432
|
|
|
default: |
1433
|
|
|
$this->tmpCat = Category::BOOKS_MAGAZINES; |
1434
|
|
|
$this->tmpTag[] = Category::TAG_BOOKS_MAGAZINES; |
1435
|
|
|
break; |
1436
|
|
|
} |
1437
|
|
|
|
1438
|
|
|
return true; |
1439
|
|
|
} |
1440
|
|
|
|
1441
|
|
|
/** |
1442
|
|
|
* @return bool |
1443
|
|
|
*/ |
1444
|
|
|
public function isBookOther(): bool |
1445
|
|
|
{ |
1446
|
|
|
if (preg_match('/"\d\d-\d\d-20\d\d\./', $this->releaseName)) { |
1447
|
|
|
$this->tmpCat = Category::BOOKS_UNKNOWN; |
1448
|
|
|
$this->tmpTag[] = Category::TAG_BOOKS_UNKNOWN; |
1449
|
|
|
|
1450
|
|
|
return true; |
1451
|
|
|
} |
1452
|
|
|
|
1453
|
|
|
return false; |
1454
|
|
|
} |
1455
|
|
|
|
1456
|
|
|
/** |
1457
|
|
|
* @return bool |
1458
|
|
|
*/ |
1459
|
|
|
public function isEBook(): bool |
1460
|
|
|
{ |
1461
|
|
|
switch (true) { |
1462
|
|
|
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): |
1463
|
|
|
return false; |
1464
|
|
|
case $this->isBookForeign(): |
1465
|
|
|
break; |
1466
|
|
|
default: |
1467
|
|
|
$this->tmpCat = Category::BOOKS_EBOOK; |
1468
|
|
|
$this->tmpTag[] = Category::TAG_BOOKS_EBOOK; |
1469
|
|
|
break; |
1470
|
|
|
} |
1471
|
|
|
|
1472
|
|
|
return true; |
1473
|
|
|
} |
1474
|
|
|
|
1475
|
|
|
// Misc, all hash/misc go in other misc. |
1476
|
|
|
|
1477
|
|
|
/** |
1478
|
|
|
* @return bool |
1479
|
|
|
*/ |
1480
|
|
|
public function isMisc(): bool |
1481
|
|
|
{ |
1482
|
|
|
switch (true) { |
|
|
|
|
1483
|
|
|
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): |
1484
|
|
|
return false; |
1485
|
|
|
case preg_match('/[a-f0-9]{32,64}/i', $this->releaseName): |
1486
|
|
|
$this->tmpCat = Category::OTHER_HASHED; |
1487
|
|
|
$this->tmpTag[] = Category::TAG_OTHER_HASHED; |
1488
|
|
|
break; |
1489
|
|
|
case preg_match('/[a-z0-9]{20,}/i', $this->releaseName): |
1490
|
|
|
case preg_match('/^[A-Z0-9]{1,}$/i', $this->releaseName): |
1491
|
|
|
$this->tmpCat = Category::OTHER_MISC; |
1492
|
|
|
$this->tmpTag[] = Category::TAG_OTHER_MISC; |
1493
|
|
|
break; |
1494
|
|
|
default: |
1495
|
|
|
return false; |
1496
|
|
|
} |
1497
|
|
|
|
1498
|
|
|
return true; |
1499
|
|
|
} |
1500
|
|
|
|
1501
|
|
|
/** |
1502
|
|
|
* @param string $regex Regex to use for match |
1503
|
|
|
* @param string $fromName Poster that needs to be matched by regex |
1504
|
|
|
* @param string $category Category to set if there is a match |
1505
|
|
|
* |
1506
|
|
|
* @return bool |
1507
|
|
|
*/ |
1508
|
|
|
public function checkPoster($regex, $fromName, $category): bool |
1509
|
|
|
{ |
1510
|
|
|
if (preg_match($regex, $fromName)) { |
1511
|
|
|
$this->tmpCat = $category; |
|
|
|
|
1512
|
|
|
$this->tmpTag[] = $category; |
1513
|
|
|
|
1514
|
|
|
return true; |
1515
|
|
|
} |
1516
|
|
|
|
1517
|
|
|
return false; |
1518
|
|
|
} |
1519
|
|
|
} |
1520
|
|
|
|