|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Blacklight; |
|
4
|
|
|
|
|
5
|
|
|
use App\Models\Category; |
|
6
|
|
|
use App\Models\Settings; |
|
7
|
|
|
use App\Models\UsenetGroup; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Categorizing of releases by name/group. |
|
11
|
|
|
* |
|
12
|
|
|
* |
|
13
|
|
|
* Class Categorize |
|
14
|
|
|
*/ |
|
15
|
|
|
class Categorize |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* Temporary category while we sort through the name. |
|
19
|
|
|
*/ |
|
20
|
|
|
protected int $tmpCat = Category::OTHER_MISC; |
|
21
|
|
|
|
|
22
|
|
|
protected bool $categorizeForeign; |
|
23
|
|
|
|
|
24
|
|
|
protected bool $catWebDL; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Release name to sort through. |
|
28
|
|
|
*/ |
|
29
|
|
|
public string $releaseName; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Release poster to sort through. |
|
33
|
|
|
*/ |
|
34
|
|
|
public string $poster; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Group id of the releasename we are sorting through. |
|
38
|
|
|
*/ |
|
39
|
|
|
public string|int $groupId; |
|
40
|
|
|
|
|
41
|
|
|
public string $groupName; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Categorize constructor. |
|
45
|
|
|
* |
|
46
|
|
|
* @throws \Exception |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->categorizeForeign = (bool) Settings::settingValue('indexer.categorise.categorizeforeign'); |
|
51
|
|
|
$this->catWebDL = (bool) Settings::settingValue('indexer.categorise.catwebdl'); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Look up the site to see which language of categorizing to use. |
|
56
|
|
|
* Then work out which category is applicable for either a group or a binary. |
|
57
|
|
|
* Returns Category::OTHER_MISC if no category is appropriate. |
|
58
|
|
|
* |
|
59
|
|
|
* |
|
60
|
|
|
* @throws \Exception |
|
61
|
|
|
*/ |
|
62
|
|
|
public function determineCategory($groupId, string $releaseName = '', string $poster = ''): array |
|
63
|
|
|
{ |
|
64
|
|
|
$this->releaseName = $releaseName; |
|
65
|
|
|
$this->groupId = $groupId; |
|
66
|
|
|
$this->poster = $poster; |
|
67
|
|
|
$this->groupName = UsenetGroup::whereId($this->groupId)->value('name') ?? ''; |
|
68
|
|
|
$this->tmpCat = Category::OTHER_MISC; |
|
69
|
|
|
|
|
70
|
|
|
return match (true) { |
|
71
|
|
|
$this->isMisc(), $this->byGroupName($this->groupName), $this->isPC(), $this->isXxx(), $this->isTV(), $this->isMovie(), $this->isConsole(), $this->isBook(), $this->isMusic() => [ |
|
72
|
|
|
'categories_id' => $this->tmpCat, |
|
73
|
|
|
], |
|
74
|
|
|
default => ['categories_id' => $this->tmpCat], |
|
75
|
|
|
}; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function byGroupName($groupName): bool |
|
79
|
|
|
{ |
|
80
|
|
|
switch (true) { |
|
|
|
|
|
|
81
|
|
|
case preg_match('/alt\.binaries\.erotica([.]\w+)?/i', $groupName): |
|
82
|
|
|
if ($this->isXxx()) { |
|
83
|
|
|
return true; |
|
84
|
|
|
} |
|
85
|
|
|
$this->tmpCat = Category::XXX_OTHER; |
|
86
|
|
|
|
|
87
|
|
|
return true; |
|
88
|
|
|
case preg_match('/alt\.binaries\.podcast$/i', $groupName): |
|
89
|
|
|
$this->tmpCat = Category::MUSIC_PODCAST; |
|
90
|
|
|
|
|
91
|
|
|
return true; |
|
92
|
|
|
default: |
|
93
|
|
|
return false; |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
// |
|
98
|
|
|
// Beginning of functions to determine category by release name. |
|
99
|
|
|
// |
|
100
|
|
|
|
|
101
|
|
|
public function isTV(): bool |
|
102
|
|
|
{ |
|
103
|
|
|
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,4}[._ -]?[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) |
|
104
|
|
|
&& ! preg_match('/[._ -](flac|imageset|mp3|xxx)[._ -]|[ .]exe$/i', $this->releaseName)) { |
|
105
|
|
|
switch (true) { |
|
106
|
|
|
case $this->isOtherTV(): |
|
107
|
|
|
case $this->categorizeForeign && $this->isForeignTV(): |
|
108
|
|
|
case $this->isSportTV(): |
|
109
|
|
|
case $this->isDocumentaryTV(): |
|
110
|
|
|
case $this->isTVx265(): |
|
111
|
|
|
case $this->isUHDTV(): |
|
112
|
|
|
case $this->catWebDL && $this->isWEBDL(): |
|
113
|
|
|
case $this->isAnimeTV(): |
|
114
|
|
|
case $this->isHDTV(): |
|
115
|
|
|
case $this->isSDTV(): |
|
116
|
|
|
case $this->isOtherTV2(): |
|
117
|
|
|
return true; |
|
118
|
|
|
default: |
|
119
|
|
|
$this->tmpCat = Category::TV_OTHER; |
|
120
|
|
|
|
|
121
|
|
|
return true; |
|
122
|
|
|
} |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
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)) { |
|
126
|
|
|
if ($this->isSportTV()) { |
|
127
|
|
|
return true; |
|
128
|
|
|
} |
|
129
|
|
|
$this->tmpCat = Category::TV_OTHER; |
|
130
|
|
|
|
|
131
|
|
|
return true; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
return false; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
public function isOtherTV(): bool |
|
138
|
|
|
{ |
|
139
|
|
|
if (preg_match('/[._ -]S\d{1,3}.+(EP\d{1,3}|Extras|SUBPACK)[._ -]|News/i', $this->releaseName) |
|
140
|
|
|
//special case for "Have.I.Got.News.For.You" tv show |
|
141
|
|
|
&& ! preg_match('/[._ -]Got[._ -]News[._ -]For[._ -]You/i', $this->releaseName) |
|
142
|
|
|
) { |
|
143
|
|
|
$this->tmpCat = Category::TV_OTHER; |
|
144
|
|
|
|
|
145
|
|
|
return true; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
return false; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
public function isForeignTV(): bool |
|
152
|
|
|
{ |
|
153
|
|
|
switch (true) { |
|
|
|
|
|
|
154
|
|
|
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): |
|
155
|
|
|
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): |
|
156
|
|
|
case preg_match('/[._ -](720p|1080p|Divx|DOKU|DUB(BED)?|DLMUX|NOVARIP|RealCo|Sub(bed|s)?|WEB(-DL|-?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): |
|
157
|
|
|
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|WEB(-DL|-?RIP))[._ -]/i', $this->releaseName): |
|
158
|
|
|
case preg_match('/[._ -]FastSUB|NL|nlvlaams|patrfa|RealCO|Seizoen|slosinh|Videomann|Vostfr|xslidian[._ -]|x264\-iZU/i', $this->releaseName): |
|
159
|
|
|
$this->tmpCat = Category::TV_FOREIGN; |
|
160
|
|
|
|
|
161
|
|
|
return true; |
|
162
|
|
|
default: |
|
163
|
|
|
return false; |
|
164
|
|
|
} |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
public function isSportTV(): bool |
|
168
|
|
|
{ |
|
169
|
|
|
switch (true) { |
|
|
|
|
|
|
170
|
|
|
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): |
|
171
|
|
|
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): |
|
172
|
|
|
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): |
|
173
|
|
|
case preg_match('/[._ -]?(Horse)[._ -]Racing[._ -]/i', $this->releaseName): |
|
174
|
|
|
case preg_match('/[._ -](VERUM|GRiP|Ebi|OVERTAKE|LEViTATE|WiNNiNG|ADMIT)/i', $this->releaseName): |
|
175
|
|
|
$this->tmpCat = Category::TV_SPORT; |
|
176
|
|
|
|
|
177
|
|
|
return true; |
|
178
|
|
|
default: |
|
179
|
|
|
return false; |
|
180
|
|
|
} |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
public function isDocumentaryTV(): bool |
|
184
|
|
|
{ |
|
185
|
|
|
if (preg_match('/[._ -](Docu|Documentary)[._ -]/i', $this->releaseName)) { |
|
186
|
|
|
$this->tmpCat = Category::TV_DOCU; |
|
187
|
|
|
|
|
188
|
|
|
return true; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
return false; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
public function isWEBDL(): bool |
|
195
|
|
|
{ |
|
196
|
|
|
if (preg_match('/(S\d+).*.web[._-]?(dl|rip).*/i', $this->releaseName)) { |
|
197
|
|
|
$this->tmpCat = Category::TV_WEBDL; |
|
198
|
|
|
|
|
199
|
|
|
return true; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
return false; |
|
203
|
|
|
} |
|
204
|
|
|
|
|
205
|
|
|
public function isAnimeTV(): bool |
|
206
|
|
|
{ |
|
207
|
|
|
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)) { |
|
208
|
|
|
$this->tmpCat = Category::TV_ANIME; |
|
209
|
|
|
|
|
210
|
|
|
return true; |
|
211
|
|
|
} |
|
212
|
|
|
if (preg_match('/(ANiHLS|HaiKU|ANiURL)/i', $this->releaseName)) { |
|
213
|
|
|
$this->tmpCat = Category::TV_ANIME; |
|
214
|
|
|
|
|
215
|
|
|
return true; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
return false; |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
public function isHDTV(): bool |
|
222
|
|
|
{ |
|
223
|
|
|
if (preg_match('/1080([ip])|720p|bluray/i', $this->releaseName)) { |
|
224
|
|
|
$this->tmpCat = Category::TV_HD; |
|
225
|
|
|
|
|
226
|
|
|
return true; |
|
227
|
|
|
} |
|
228
|
|
|
if (! $this->catWebDL && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
|
229
|
|
|
$this->tmpCat = Category::TV_HD; |
|
230
|
|
|
|
|
231
|
|
|
return true; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
return false; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
public function isUHDTV(): bool |
|
238
|
|
|
{ |
|
239
|
|
|
if (preg_match('/(S\d+).*(2160p).*(Netflix|Amazon|NF|AMZN).*(TrollUHD|NTb|VLAD|DEFLATE|POFUDUK|CMRG)/i', $this->releaseName)) { |
|
240
|
|
|
$this->tmpCat = Category::TV_UHD; |
|
241
|
|
|
|
|
242
|
|
|
return true; |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
return false; |
|
246
|
|
|
} |
|
247
|
|
|
|
|
248
|
|
|
public function isSDTV(): bool |
|
249
|
|
|
{ |
|
250
|
|
|
switch (true) { |
|
|
|
|
|
|
251
|
|
|
case preg_match('/(360|480|576)p|Complete[._ -]Season|dvdr(ip)?|dvd5|dvd9|\.pdtv|SD[._ -]TV|TVRip|NTSC|BDRip|hdtv|xvid/i', $this->releaseName): |
|
252
|
|
|
case preg_match('/(([HP])D[._ -]?TV|DSR|WebRip)[._ -]x264/i', $this->releaseName): |
|
253
|
|
|
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): |
|
254
|
|
|
$this->tmpCat = Category::TV_SD; |
|
255
|
|
|
|
|
256
|
|
|
return true; |
|
257
|
|
|
default: |
|
258
|
|
|
return false; |
|
259
|
|
|
} |
|
260
|
|
|
} |
|
261
|
|
|
|
|
262
|
|
|
public function isOtherTV2(): bool |
|
263
|
|
|
{ |
|
264
|
|
|
if (preg_match('/[._ -]s\d{1,3}[._ -]?(e|d(isc)?)\d{1,3}([._ -]|$)/i', $this->releaseName)) { |
|
265
|
|
|
$this->tmpCat = Category::TV_OTHER; |
|
266
|
|
|
|
|
267
|
|
|
return true; |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
return false; |
|
271
|
|
|
} |
|
272
|
|
|
|
|
273
|
|
|
public function isTVx265(): bool |
|
274
|
|
|
{ |
|
275
|
|
|
if (preg_match('/(S\d+).*(x265).*(rmteam|MeGusta|HETeam|PSA|ONLY|H4S5S|TrollHD|ImE)/i', $this->releaseName)) { |
|
276
|
|
|
$this->tmpCat = Category::TV_X265; |
|
277
|
|
|
|
|
278
|
|
|
return true; |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
return false; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
// Movies. |
|
285
|
|
|
|
|
286
|
|
|
public function isMovie(): bool |
|
287
|
|
|
{ |
|
288
|
|
|
if (preg_match('/[._ -]AVC|[BH][DR]RIP|(Bluray|Blu-Ray)|BD[._ -]?(25|50)?|\bBR\b|Camrip|[._ -]\d{4}[._ -].+(720p|1080p|Cam|HDTS|2160p)|DIVX|[._ -]DVD[._ -]|DVD-?(5|9|R|Rip)|Untouched|VHSRip|XVID|[._ -](DTS|TVrip|webrip|WEBDL|WEB-DL)[._ -]|\b(2160)p\b.*\b(Netflix|Amazon|NF|AMZN|Disney)\b/i', $this->releaseName) && ! preg_match('/s\d{1,3}[._ -]?[ed]\d{1,3}|auto(cad|desk)|divx[._ -]plus|[._ -]exe$|[._ -](jav|XXX)[._ -]|SWE6RUS|\wXXX(1080p|720p|DVD)|Xilisoft|\.S[0-9]\d{1,3}\./i', $this->releaseName)) { |
|
289
|
|
|
return match (true) { |
|
290
|
|
|
$this->categorizeForeign && $this->isMovieForeign(), $this->isMovieDVD(), $this->isMovieX265(), $this->isMovieUHD(), $this->catWebDL && $this->isMovieWEBDL(), $this->isMovieSD(), $this->isMovie3D(), $this->isMovieBluRay(), $this->isMovieHD(), $this->isMovieOther() => true, |
|
291
|
|
|
default => false, |
|
292
|
|
|
}; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
return false; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
public function isMovieForeign(): bool |
|
299
|
|
|
{ |
|
300
|
|
|
switch (true) { |
|
|
|
|
|
|
301
|
|
|
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): |
|
302
|
|
|
case stripos($this->releaseName, 'Castellano') !== false: |
|
303
|
|
|
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)|WEB(-DL|-?RIP)|HD[._ -]|XVID)/i', $this->releaseName): |
|
304
|
|
|
$this->tmpCat = Category::MOVIE_FOREIGN; |
|
305
|
|
|
|
|
306
|
|
|
return true; |
|
307
|
|
|
default: |
|
308
|
|
|
return false; |
|
309
|
|
|
} |
|
310
|
|
|
} |
|
311
|
|
|
|
|
312
|
|
|
public function isMovieDVD(): bool |
|
313
|
|
|
{ |
|
314
|
|
|
if (preg_match('/(dvd\-?r|[._ -]dvd|dvd9|dvd5|[._ -]r5)[._ -]/i', $this->releaseName)) { |
|
315
|
|
|
$this->tmpCat = Category::MOVIE_DVD; |
|
316
|
|
|
|
|
317
|
|
|
return true; |
|
318
|
|
|
} |
|
319
|
|
|
|
|
320
|
|
|
return false; |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
public function isMovieSD(): bool |
|
324
|
|
|
{ |
|
325
|
|
|
if (preg_match('/(divx|dvdscr|extrascene|dvdrip|\.CAM|HDTS(-LINE)?|vhsrip|xvid(vd)?)[._ -]/i', $this->releaseName)) { |
|
326
|
|
|
$this->tmpCat = Category::MOVIE_SD; |
|
327
|
|
|
|
|
328
|
|
|
return true; |
|
329
|
|
|
} |
|
330
|
|
|
|
|
331
|
|
|
return false; |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
public function isMovie3D(): bool |
|
335
|
|
|
{ |
|
336
|
|
|
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)) { |
|
337
|
|
|
$this->tmpCat = Category::MOVIE_3D; |
|
338
|
|
|
|
|
339
|
|
|
return true; |
|
340
|
|
|
} |
|
341
|
|
|
|
|
342
|
|
|
return false; |
|
343
|
|
|
} |
|
344
|
|
|
|
|
345
|
|
|
public function isMovieBluRay(): bool |
|
346
|
|
|
{ |
|
347
|
|
|
if (preg_match('/bluray-|[._ -]bd?[._ -]?(25|50)|blu-ray|Bluray\s-\sUntouched|[._ -]untouched[._ -]/i', $this->releaseName) |
|
348
|
|
|
&& ! preg_match('/SecretUsenet\.com$/i', $this->releaseName)) { |
|
349
|
|
|
$this->tmpCat = Category::MOVIE_BLURAY; |
|
350
|
|
|
|
|
351
|
|
|
return true; |
|
352
|
|
|
} |
|
353
|
|
|
|
|
354
|
|
|
return false; |
|
355
|
|
|
} |
|
356
|
|
|
|
|
357
|
|
|
public function isMovieHD(): bool |
|
358
|
|
|
{ |
|
359
|
|
|
if (preg_match('/720p|1080p|AVC|VC1|VC-1|web-dl|wmvhd|x264|XvidHD|bdrip/i', $this->releaseName)) { |
|
360
|
|
|
$this->tmpCat = Category::MOVIE_HD; |
|
361
|
|
|
|
|
362
|
|
|
return true; |
|
363
|
|
|
} |
|
364
|
|
|
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
|
365
|
|
|
$this->tmpCat = Category::MOVIE_HD; |
|
366
|
|
|
|
|
367
|
|
|
return true; |
|
368
|
|
|
} |
|
369
|
|
|
|
|
370
|
|
|
return false; |
|
371
|
|
|
} |
|
372
|
|
|
|
|
373
|
|
|
public function isMovieUHD(): bool |
|
374
|
|
|
{ |
|
375
|
|
|
if (! preg_match('/(S\d+).*(2160p).*(Netflix|Amazon).*(TrollUHD|NTb|VLAD)/i', $this->releaseName) && stripos($this->releaseName, '2160p') !== false) { |
|
376
|
|
|
$this->tmpCat = Category::MOVIE_UHD; |
|
377
|
|
|
|
|
378
|
|
|
return true; |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
return false; |
|
382
|
|
|
} |
|
383
|
|
|
|
|
384
|
|
|
public function isMovieOther(): bool |
|
385
|
|
|
{ |
|
386
|
|
|
if (preg_match('/[._ -]cam[._ -]/i', $this->releaseName)) { |
|
387
|
|
|
$this->tmpCat = Category::MOVIE_OTHER; |
|
388
|
|
|
|
|
389
|
|
|
return true; |
|
390
|
|
|
} |
|
391
|
|
|
|
|
392
|
|
|
return false; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
public function isMovieWEBDL(): bool |
|
396
|
|
|
{ |
|
397
|
|
|
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
|
398
|
|
|
$this->tmpCat = Category::MOVIE_WEBDL; |
|
399
|
|
|
|
|
400
|
|
|
return true; |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
return false; |
|
404
|
|
|
} |
|
405
|
|
|
|
|
406
|
|
|
public function isMovieX265(): bool |
|
407
|
|
|
{ |
|
408
|
|
|
if (preg_match('/(\w+[\.-_\s]+).*(x265).*(Tigole|SESKAPiLE|CHD|IAMABLE|THREESOME|OohLaLa|DEFLATE|NCmt)/i', $this->releaseName)) { |
|
409
|
|
|
$this->tmpCat = Category::MOVIE_X265; |
|
410
|
|
|
|
|
411
|
|
|
return true; |
|
412
|
|
|
} |
|
413
|
|
|
|
|
414
|
|
|
return false; |
|
415
|
|
|
} |
|
416
|
|
|
|
|
417
|
|
|
// PC. |
|
418
|
|
|
|
|
419
|
|
|
public function isPC(): bool |
|
420
|
|
|
{ |
|
421
|
|
|
return match (true) { |
|
422
|
|
|
$this->isPhone(), $this->isMac(), $this->isPCGame(), $this->isISO(), $this->is0day() => true, |
|
423
|
|
|
default => false, |
|
424
|
|
|
}; |
|
425
|
|
|
} |
|
426
|
|
|
|
|
427
|
|
|
public function isPhone(): bool |
|
428
|
|
|
{ |
|
429
|
|
|
switch (true) { |
|
|
|
|
|
|
430
|
|
|
case preg_match('/[^a-z0-9](IPHONE|ITOUCH|IPAD)[._ -]/i', $this->releaseName): |
|
431
|
|
|
$this->tmpCat = Category::PC_PHONE_IOS; |
|
432
|
|
|
break; |
|
433
|
|
|
case preg_match('/[._ -]?(ANDROID)[._ -]/i', $this->releaseName): |
|
434
|
|
|
$this->tmpCat = Category::PC_PHONE_ANDROID; |
|
435
|
|
|
break; |
|
436
|
|
|
case preg_match('/[^a-z0-9](symbian|xscale|wm5|wm6)[._ -]/i', $this->releaseName): |
|
437
|
|
|
$this->tmpCat = Category::PC_PHONE_OTHER; |
|
438
|
|
|
break; |
|
439
|
|
|
default: |
|
440
|
|
|
return false; |
|
441
|
|
|
} |
|
442
|
|
|
|
|
443
|
|
|
return true; |
|
444
|
|
|
} |
|
445
|
|
|
|
|
446
|
|
|
public function isISO(): bool |
|
447
|
|
|
{ |
|
448
|
|
|
switch (true) { |
|
|
|
|
|
|
449
|
|
|
case preg_match('/[._ -]([a-zA-Z]{2,10})?iso[ _.-]|[\-. ]([a-z]{2,10})?iso$/i', $this->releaseName): |
|
450
|
|
|
case preg_match('/[._ -](DYNAMiCS|INFINITESKILLS|UDEMY|kEISO|PLURALSIGHT|DIGITALTUTORS|TUTSPLUS|OSTraining|PRODEV|CBT\.Nuggets|COMPRISED)/i', $this->releaseName): |
|
451
|
|
|
$this->tmpCat = Category::PC_ISO; |
|
452
|
|
|
|
|
453
|
|
|
return true; |
|
454
|
|
|
default: |
|
455
|
|
|
return false; |
|
456
|
|
|
} |
|
457
|
|
|
} |
|
458
|
|
|
|
|
459
|
|
|
public function is0day(): bool |
|
460
|
|
|
{ |
|
461
|
|
|
switch (true) { |
|
|
|
|
|
|
462
|
|
|
case preg_match('/[._ -]exe$|[._ -](utorrent|Virtualbox)[._ -]|\b0DAY\b|incl.+crack| DRM$|>DRM</i', $this->releaseName): |
|
463
|
|
|
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): |
|
464
|
|
|
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): |
|
465
|
|
|
$this->tmpCat = Category::PC_0DAY; |
|
466
|
|
|
|
|
467
|
|
|
return true; |
|
468
|
|
|
default: |
|
469
|
|
|
return false; |
|
470
|
|
|
} |
|
471
|
|
|
} |
|
472
|
|
|
|
|
473
|
|
|
public function isMac(): bool |
|
474
|
|
|
{ |
|
475
|
|
|
if (preg_match('/(\b|[._ -])mac([\.\s])?osx(\b|[\-_. ])/i', $this->releaseName)) { |
|
476
|
|
|
$this->tmpCat = Category::PC_MAC; |
|
477
|
|
|
|
|
478
|
|
|
return true; |
|
479
|
|
|
} |
|
480
|
|
|
|
|
481
|
|
|
return false; |
|
482
|
|
|
} |
|
483
|
|
|
|
|
484
|
|
|
public function isPCGame(): bool |
|
485
|
|
|
{ |
|
486
|
|
|
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)) { |
|
487
|
|
|
$this->tmpCat = Category::PC_GAMES; |
|
488
|
|
|
|
|
489
|
|
|
return true; |
|
490
|
|
|
} |
|
491
|
|
|
|
|
492
|
|
|
if ($this->checkPoster('/<PC@MASTER\.RACE>/i', $this->poster, Category::PC_GAMES)) { |
|
493
|
|
|
return true; |
|
494
|
|
|
} |
|
495
|
|
|
|
|
496
|
|
|
return false; |
|
497
|
|
|
} |
|
498
|
|
|
|
|
499
|
|
|
// XXX. |
|
500
|
|
|
|
|
501
|
|
|
public function isXxx(): bool |
|
502
|
|
|
{ |
|
503
|
|
|
switch (true) { |
|
504
|
|
|
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): |
|
505
|
|
|
return false; |
|
506
|
|
|
case $this->isXxxPack(): |
|
507
|
|
|
case $this->isXxxClipSD(): |
|
508
|
|
|
case $this->isXxxSD(): |
|
509
|
|
|
case $this->isXxxUHD(): |
|
510
|
|
|
case $this->isXxxClipHD(): |
|
511
|
|
|
case $this->isXxxVr(): |
|
512
|
|
|
case $this->catWebDL && $this->isXxxWEBDL(): |
|
513
|
|
|
case $this->isXxx264(): |
|
514
|
|
|
case $this->isXxxXvid(): |
|
515
|
|
|
case $this->isXxxImageset(): |
|
516
|
|
|
case $this->isXxxWMV(): |
|
517
|
|
|
case $this->isXxxDVD(): |
|
518
|
|
|
case $this->isXxxOther(): |
|
519
|
|
|
|
|
520
|
|
|
return true; |
|
521
|
|
|
default: |
|
522
|
|
|
$this->tmpCat = Category::XXX_OTHER; |
|
523
|
|
|
|
|
524
|
|
|
return true; |
|
525
|
|
|
} |
|
526
|
|
|
} |
|
527
|
|
|
|
|
528
|
|
|
public function isXxx264(): bool |
|
529
|
|
|
{ |
|
530
|
|
|
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) { |
|
531
|
|
|
$this->tmpCat = Category::XXX_X264; |
|
532
|
|
|
|
|
533
|
|
|
return true; |
|
534
|
|
|
} |
|
535
|
|
|
if ($this->catWebDL === false && preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
|
536
|
|
|
$this->tmpCat = Category::XXX_X264; |
|
537
|
|
|
|
|
538
|
|
|
return true; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
return false; |
|
542
|
|
|
} |
|
543
|
|
|
|
|
544
|
|
|
public function isXxxUHD(): bool |
|
545
|
|
|
{ |
|
546
|
|
|
if (preg_match('/XXX.+(2160p)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG|WRB|NBQ|FETiSH))/i', $this->releaseName)) { |
|
547
|
|
|
$this->tmpCat = Category::XXX_UHD; |
|
548
|
|
|
|
|
549
|
|
|
return true; |
|
550
|
|
|
} |
|
551
|
|
|
|
|
552
|
|
|
return false; |
|
553
|
|
|
} |
|
554
|
|
|
|
|
555
|
|
|
public function isXxxClipHD(): bool |
|
556
|
|
|
{ |
|
557
|
|
|
if (preg_match('/^[\w\-.]+(\d{2}\.\d{2}\.\d{2}).+(720|1080)+[\w\-.]+(M[PO][V4]-(KTR|GUSH|FaiLED|SEXORS|hUSHhUSH|YAPG|TRASHBIN|WRB|NBQ|FETiSH))/i', $this->releaseName)) { |
|
558
|
|
|
$this->tmpCat = Category::XXX_CLIPHD; |
|
559
|
|
|
|
|
560
|
|
|
return true; |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
return false; |
|
564
|
|
|
} |
|
565
|
|
|
|
|
566
|
|
|
public function isXxxWMV(): bool |
|
567
|
|
|
{ |
|
568
|
|
|
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) { |
|
569
|
|
|
$this->tmpCat = Category::XXX_WMV; |
|
570
|
|
|
|
|
571
|
|
|
return true; |
|
572
|
|
|
} |
|
573
|
|
|
|
|
574
|
|
|
return false; |
|
575
|
|
|
} |
|
576
|
|
|
|
|
577
|
|
|
public function isXxxXvid(): bool |
|
578
|
|
|
{ |
|
579
|
|
|
if (preg_match('/(b[dr]|dvd)rip|detoxication|divx|nympho|pornolation|swe6|tesoro|xvid/i', $this->releaseName)) { |
|
580
|
|
|
$this->tmpCat = Category::XXX_XVID; |
|
581
|
|
|
|
|
582
|
|
|
return true; |
|
583
|
|
|
} |
|
584
|
|
|
|
|
585
|
|
|
return false; |
|
586
|
|
|
} |
|
587
|
|
|
|
|
588
|
|
|
public function isXxxDVD(): bool |
|
589
|
|
|
{ |
|
590
|
|
|
if (preg_match('/dvdr[^i]|dvd[59]/i', $this->releaseName)) { |
|
591
|
|
|
$this->tmpCat = Category::XXX_DVD; |
|
592
|
|
|
|
|
593
|
|
|
return true; |
|
594
|
|
|
} |
|
595
|
|
|
|
|
596
|
|
|
return false; |
|
597
|
|
|
} |
|
598
|
|
|
|
|
599
|
|
|
public function isXxxVr(): bool |
|
600
|
|
|
{ |
|
601
|
|
|
switch (true) { |
|
|
|
|
|
|
602
|
|
|
case preg_match('/OnlyFans/i', $this->releaseName): |
|
603
|
|
|
return false; |
|
604
|
|
|
case preg_match('/^[\w\-.]+(\d{2}\.\d{2}\.\d{2}).+(VR(180|360))+.*/i', $this->releaseName): |
|
605
|
|
|
case preg_match('/^VR(Hush|\.?(Cosplay|Spy|Conk|Porn|Latina|Bangers|KM|Mansion|Intimacy|oomed))|^VirtualReal|iStripper|SLROriginals|VirtualPorn|XSinsVR|NaughtyAmericaVR|WetVR|VRStars|SexBabesVR|VR Porn|\[VR\][.\s]Pack|BIBIVR|VRCosplayX|CzechVRFetish|GearVR|Oculus|SexLikeReal|3584p|^.*VR[\. -_]+?/i', $this->releaseName): |
|
606
|
|
|
case preg_match('/.+\.VR(180|360)\.(3584|3840|3072)p/i', $this->releaseName): |
|
607
|
|
|
case preg_match('/^SLR.+(VR|LR_180|LR-180|3072p)/i', $this->releaseName): |
|
608
|
|
|
case preg_match('/^SLR_SLR|^REQUEST\.SLR/i', $this->releaseName): |
|
609
|
|
|
case preg_match('/180x180_3dh/i', $this->releaseName): |
|
610
|
|
|
$this->tmpCat = Category::XXX_VR; |
|
611
|
|
|
|
|
612
|
|
|
return true; |
|
613
|
|
|
default: |
|
614
|
|
|
return false; |
|
615
|
|
|
} |
|
616
|
|
|
} |
|
617
|
|
|
|
|
618
|
|
|
public function isXxxImageset(): bool |
|
619
|
|
|
{ |
|
620
|
|
|
if (preg_match('/IMAGESET|PICTURESET|ABPEA/i', $this->releaseName)) { |
|
621
|
|
|
$this->tmpCat = Category::XXX_IMAGESET; |
|
622
|
|
|
|
|
623
|
|
|
return true; |
|
624
|
|
|
} |
|
625
|
|
|
|
|
626
|
|
|
return false; |
|
627
|
|
|
} |
|
628
|
|
|
|
|
629
|
|
|
public function isXxxPack(): bool |
|
630
|
|
|
{ |
|
631
|
|
|
if (preg_match('/[ .]PACK[ .]/i', $this->releaseName)) { |
|
632
|
|
|
$this->tmpCat = Category::XXX_PACK; |
|
633
|
|
|
|
|
634
|
|
|
return true; |
|
635
|
|
|
} |
|
636
|
|
|
|
|
637
|
|
|
return false; |
|
638
|
|
|
} |
|
639
|
|
|
|
|
640
|
|
|
public function isXxxOther(): bool |
|
641
|
|
|
{ |
|
642
|
|
|
// If nothing else matches, then try these words. |
|
643
|
|
|
if (preg_match('/[._ -]Brazzers|Creampie|[._ -]JAV[._ -]|North\.Pole|^Nubiles|She[._ -]?Male|Transsexual|OLDER ANGELS/i', $this->releaseName)) { |
|
644
|
|
|
$this->tmpCat = Category::XXX_OTHER; |
|
645
|
|
|
|
|
646
|
|
|
return true; |
|
647
|
|
|
} |
|
648
|
|
|
|
|
649
|
|
|
return false; |
|
650
|
|
|
} |
|
651
|
|
|
|
|
652
|
|
|
public function isXxxClipSD(): bool |
|
653
|
|
|
{ |
|
654
|
|
|
switch (true) { |
|
|
|
|
|
|
655
|
|
|
case $this->checkPoster('/anon@y[.]com/i', $this->poster, Category::XXX_CLIPSD): |
|
656
|
|
|
case $this->checkPoster('/@md-hobbys[.]com/i', $this->poster, Category::XXX_CLIPSD): |
|
657
|
|
|
case $this->checkPoster('/oz@lot[.]com/i', $this->poster, Category::XXX_CLIPSD): |
|
658
|
|
|
return true; |
|
659
|
|
|
case preg_match('/(iPT\sTeam|KLEENEX)/i', $this->releaseName): |
|
660
|
|
|
case stripos($this->releaseName, 'SDPORN') !== false: |
|
661
|
|
|
$this->tmpCat = Category::XXX_CLIPSD; |
|
662
|
|
|
|
|
663
|
|
|
return true; |
|
664
|
|
|
default: |
|
665
|
|
|
return false; |
|
666
|
|
|
} |
|
667
|
|
|
} |
|
668
|
|
|
|
|
669
|
|
|
public function isXxxSD(): bool |
|
670
|
|
|
{ |
|
671
|
|
|
if (preg_match('/SDX264XXX|XXX\.HR\./i', $this->releaseName)) { |
|
672
|
|
|
$this->tmpCat = Category::XXX_SD; |
|
673
|
|
|
|
|
674
|
|
|
return true; |
|
675
|
|
|
} |
|
676
|
|
|
|
|
677
|
|
|
return false; |
|
678
|
|
|
} |
|
679
|
|
|
|
|
680
|
|
|
public function isXxxWEBDL(): bool |
|
681
|
|
|
{ |
|
682
|
|
|
if (preg_match('/web[._ -]dl|web-?rip/i', $this->releaseName)) { |
|
683
|
|
|
$this->tmpCat = Category::XXX_WEBDL; |
|
684
|
|
|
|
|
685
|
|
|
return true; |
|
686
|
|
|
} |
|
687
|
|
|
|
|
688
|
|
|
return false; |
|
689
|
|
|
} |
|
690
|
|
|
|
|
691
|
|
|
// Console. |
|
692
|
|
|
|
|
693
|
|
|
public function isConsole(): bool |
|
694
|
|
|
{ |
|
695
|
|
|
return match (true) { |
|
696
|
|
|
$this->isGameNDS(), $this->isGame3DS(), $this->isGamePS3(), $this->isGamePS4(), $this->isGamePSP(), $this->isGamePSVita(), $this->isGameWiiWare(), $this->isGameWiiU(), $this->isGameWii(), $this->isGameNGC(), $this->isGameXBOX360DLC(), $this->isGameXBOX360(), $this->isGameXBOXONE(), $this->isGameXBOX(), $this->isGameOther() => true, |
|
697
|
|
|
default => false, |
|
698
|
|
|
}; |
|
699
|
|
|
} |
|
700
|
|
|
|
|
701
|
|
|
public function isGameNDS(): bool |
|
702
|
|
|
{ |
|
703
|
|
|
if (preg_match('/^NDS|[^a-zA-Z0-9]NDS|[\._-](nds|NDS)|nintendo.+[^3]n?dsi?/', $this->releaseName)) { |
|
704
|
|
|
if (preg_match('/\((DE|DSi(\sEnhanched)?|_NDS-|EUR?|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA?)\)/i', $this->releaseName)) { |
|
705
|
|
|
$this->tmpCat = Category::GAME_NDS; |
|
706
|
|
|
|
|
707
|
|
|
return true; |
|
708
|
|
|
} |
|
709
|
|
|
if (preg_match('/EUR|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA|\bROMS?(et)?\b/i', $this->releaseName)) { |
|
710
|
|
|
$this->tmpCat = Category::GAME_NDS; |
|
711
|
|
|
|
|
712
|
|
|
return true; |
|
713
|
|
|
} |
|
714
|
|
|
} |
|
715
|
|
|
|
|
716
|
|
|
return false; |
|
717
|
|
|
} |
|
718
|
|
|
|
|
719
|
|
|
public function isGame3DS(): bool |
|
720
|
|
|
{ |
|
721
|
|
|
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)) { |
|
722
|
|
|
$this->tmpCat = Category::GAME_3DS; |
|
723
|
|
|
|
|
724
|
|
|
return true; |
|
725
|
|
|
} |
|
726
|
|
|
|
|
727
|
|
|
return false; |
|
728
|
|
|
} |
|
729
|
|
|
|
|
730
|
|
|
public function isGameNGC(): bool |
|
731
|
|
|
{ |
|
732
|
|
|
if (preg_match('/[\._-]N?G(AME)?C(UBE)?-/i', $this->releaseName)) { |
|
733
|
|
|
if (preg_match('/_(EUR?|FR|GAME|HOL|JP|JPN|NL|NTSC|PAL|KS|USA?)_/i', $this->releaseName)) { |
|
734
|
|
|
$this->tmpCat = Category::GAME_OTHER; |
|
735
|
|
|
|
|
736
|
|
|
return true; |
|
737
|
|
|
} |
|
738
|
|
|
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)) { |
|
739
|
|
|
$this->tmpCat = Category::GAME_OTHER; |
|
740
|
|
|
|
|
741
|
|
|
return true; |
|
742
|
|
|
} |
|
743
|
|
|
} |
|
744
|
|
|
|
|
745
|
|
|
return false; |
|
746
|
|
|
} |
|
747
|
|
|
|
|
748
|
|
|
public function isGamePS3(): bool |
|
749
|
|
|
{ |
|
750
|
|
|
if (preg_match('/[^e]PS3/i', $this->releaseName)) { |
|
751
|
|
|
if (preg_match('/ANTiDOTE|DLC|DUPLEX|EUR?|Googlecus|GOTY|\-HR|iNSOMNi|JAP|JPN|KONDIOS|\[PS3\]|PSN/i', $this->releaseName)) { |
|
752
|
|
|
$this->tmpCat = Category::GAME_PS3; |
|
753
|
|
|
|
|
754
|
|
|
return true; |
|
755
|
|
|
} |
|
756
|
|
|
if (preg_match('/AGENCY|APATHY|Caravan|MULTi|NRP|NTSC|PAL|SPLiT|STRiKE|USA?|ZRY/i', $this->releaseName)) { |
|
757
|
|
|
$this->tmpCat = Category::GAME_PS3; |
|
758
|
|
|
|
|
759
|
|
|
return true; |
|
760
|
|
|
} |
|
761
|
|
|
} |
|
762
|
|
|
|
|
763
|
|
|
return false; |
|
764
|
|
|
} |
|
765
|
|
|
|
|
766
|
|
|
public function isGamePS4(): bool |
|
767
|
|
|
{ |
|
768
|
|
|
if (preg_match('/[ \(_.-]PS4[ \)_.-]/i', $this->releaseName)) { |
|
769
|
|
|
if (preg_match('/ANTiDOTE|DLC|DUPLEX|EUR?|Googlecus|GOTY|\-HR|iNSOMNi|JAP|JPN|KONDIOS|\[PS4\]/i', $this->releaseName)) { |
|
770
|
|
|
$this->tmpCat = Category::GAME_PS4; |
|
771
|
|
|
|
|
772
|
|
|
return true; |
|
773
|
|
|
} |
|
774
|
|
|
if (preg_match('/AGENCY|APATHY|Caravan|MULTi|NRP|NTSC|PAL|SPLiT|STRiKE|USA?|WaYsTeD|ZRY/i', $this->releaseName)) { |
|
775
|
|
|
$this->tmpCat = Category::GAME_PS4; |
|
776
|
|
|
|
|
777
|
|
|
return true; |
|
778
|
|
|
} |
|
779
|
|
|
} |
|
780
|
|
|
|
|
781
|
|
|
return false; |
|
782
|
|
|
} |
|
783
|
|
|
|
|
784
|
|
|
public function isGamePSP(): bool |
|
785
|
|
|
{ |
|
786
|
|
|
if (stripos($this->releaseName, 'PSP') !== false) { |
|
787
|
|
|
if (preg_match('/[._ -](BAHAMUT|Caravan|EBOOT|EMiNENT|EUR?|EvoX|GAME|GHS|Googlecus|HandHeld|\-HR|JAP|JPN|KLOTEKLAPPERS|KOR|NTSC|PAL)/i', $this->releaseName)) { |
|
788
|
|
|
$this->tmpCat = Category::GAME_PSP; |
|
789
|
|
|
|
|
790
|
|
|
return true; |
|
791
|
|
|
} |
|
792
|
|
|
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)) { |
|
793
|
|
|
$this->tmpCat = Category::GAME_PSP; |
|
794
|
|
|
|
|
795
|
|
|
return true; |
|
796
|
|
|
} |
|
797
|
|
|
} |
|
798
|
|
|
|
|
799
|
|
|
return false; |
|
800
|
|
|
} |
|
801
|
|
|
|
|
802
|
|
|
public function isGamePSVita(): bool |
|
803
|
|
|
{ |
|
804
|
|
|
if (preg_match('/PS ?Vita/i', $this->releaseName)) { |
|
805
|
|
|
$this->tmpCat = Category::GAME_PSVITA; |
|
806
|
|
|
|
|
807
|
|
|
return true; |
|
808
|
|
|
} |
|
809
|
|
|
|
|
810
|
|
|
return false; |
|
811
|
|
|
} |
|
812
|
|
|
|
|
813
|
|
|
public function isGameWiiWare(): bool |
|
814
|
|
|
{ |
|
815
|
|
|
if (preg_match('/(Console|DLC|VC).+[._ -]WII|(Console|DLC|VC)[._ -]WII|WII[._ -].+(Console|DLC|VC)|WII[._ -](Console|DLC|VC)|WIIWARE/i', $this->releaseName)) { |
|
816
|
|
|
$this->tmpCat = Category::GAME_WIIWARE; |
|
817
|
|
|
|
|
818
|
|
|
return true; |
|
819
|
|
|
} |
|
820
|
|
|
|
|
821
|
|
|
return false; |
|
822
|
|
|
} |
|
823
|
|
|
|
|
824
|
|
|
public function isGameWiiU(): bool |
|
825
|
|
|
{ |
|
826
|
|
|
switch (true) { |
|
|
|
|
|
|
827
|
|
|
case preg_match('/[._ -](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)$/i', $this->releaseName): |
|
828
|
|
|
case preg_match('/[._ -](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)$/i', $this->releaseName): |
|
829
|
|
|
case preg_match('/[._ -](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)$/i', $this->releaseName): |
|
830
|
|
|
$this->tmpCat = Category::GAME_WIIU; |
|
831
|
|
|
|
|
832
|
|
|
return true; |
|
833
|
|
|
default: |
|
834
|
|
|
return false; |
|
835
|
|
|
} |
|
836
|
|
|
} |
|
837
|
|
|
|
|
838
|
|
|
public function isGameWii(): bool |
|
839
|
|
|
{ |
|
840
|
|
|
switch (true) { |
|
|
|
|
|
|
841
|
|
|
case preg_match('/[._ -](Allstars|BiOSHOCK|dumpTruck|DNi|iCON|JAP|NTSC|PAL|ProCiSiON|PROPER|RANT|REV0|SUNSHiNE|SUSHi|TMD|USA?)/i', $this->releaseName): |
|
842
|
|
|
case preg_match('/[._ -](APATHY|BAHAMUT|DMZ|ERD|GAME|JPN|LoCAL|MULTi|NAGGERS|OneUp|PLAYME|PONS|Scrubbed|VORTEX|ZARD|ZER0)/i', $this->releaseName): |
|
843
|
|
|
case preg_match('/[._ -](ALMoST|AMBITION|Caravan|CLiiCHE|DRYB|HaZMaT|KOR|LOADER|MARVEL|PROMiNENT|LaKiTu|LOCAL|QwiiF|RANT)/i', $this->releaseName): |
|
844
|
|
|
$this->tmpCat = Category::GAME_WII; |
|
845
|
|
|
|
|
846
|
|
|
return true; |
|
847
|
|
|
default: |
|
848
|
|
|
return false; |
|
849
|
|
|
} |
|
850
|
|
|
} |
|
851
|
|
|
|
|
852
|
|
|
public function isGameXBOX360DLC(): bool |
|
853
|
|
|
{ |
|
854
|
|
|
if (preg_match('/DLC.+xbox360|xbox360.+DLC|XBLA.+xbox360|xbox360.+XBLA/i', $this->releaseName)) { |
|
855
|
|
|
$this->tmpCat = Category::GAME_XBOX360DLC; |
|
856
|
|
|
|
|
857
|
|
|
return true; |
|
858
|
|
|
} |
|
859
|
|
|
|
|
860
|
|
|
return false; |
|
861
|
|
|
} |
|
862
|
|
|
|
|
863
|
|
|
public function isGameXBOX360(): bool |
|
864
|
|
|
{ |
|
865
|
|
|
if (stripos($this->releaseName, '/XBOX360/i') !== false) { |
|
866
|
|
|
$this->tmpCat = Category::GAME_XBOX360; |
|
867
|
|
|
|
|
868
|
|
|
return true; |
|
869
|
|
|
} |
|
870
|
|
|
if (stripos($this->releaseName, 'x360') !== false) { |
|
871
|
|
|
if (preg_match('/Allstars|ASiA|CCCLX|COMPLEX|DAGGER|GLoBAL|iMARS|JAP|JPN|MULTi|NTSC|PAL|REPACK|RRoD|RF|SWAG|USA?/i', $this->releaseName)) { |
|
872
|
|
|
$this->tmpCat = Category::GAME_XBOX360; |
|
873
|
|
|
|
|
874
|
|
|
return true; |
|
875
|
|
|
} |
|
876
|
|
|
if (preg_match('/DAMNATION|GERMAN|GOTY|iNT|iTA|JTAG|KINECT|MARVEL|MUX360|RANT|SPARE|SPANISH|VATOS|XGD/i', $this->releaseName)) { |
|
877
|
|
|
$this->tmpCat = Category::GAME_XBOX360; |
|
878
|
|
|
|
|
879
|
|
|
return true; |
|
880
|
|
|
} |
|
881
|
|
|
} |
|
882
|
|
|
|
|
883
|
|
|
return false; |
|
884
|
|
|
} |
|
885
|
|
|
|
|
886
|
|
|
public function isGameXBOXONE(): bool |
|
887
|
|
|
{ |
|
888
|
|
|
if (preg_match('/XBOXONE|XBOX\.ONE/i', $this->releaseName)) { |
|
889
|
|
|
$this->tmpCat = Category::GAME_XBOXONE; |
|
890
|
|
|
|
|
891
|
|
|
return true; |
|
892
|
|
|
} |
|
893
|
|
|
|
|
894
|
|
|
return false; |
|
895
|
|
|
} |
|
896
|
|
|
|
|
897
|
|
|
public function isGameXBOX(): bool |
|
898
|
|
|
{ |
|
899
|
|
|
if (stripos($this->releaseName, 'XBOX') !== false) { |
|
900
|
|
|
$this->tmpCat = Category::GAME_XBOX; |
|
901
|
|
|
|
|
902
|
|
|
return true; |
|
903
|
|
|
} |
|
904
|
|
|
|
|
905
|
|
|
return false; |
|
906
|
|
|
} |
|
907
|
|
|
|
|
908
|
|
|
public function isGameOther(): bool |
|
909
|
|
|
{ |
|
910
|
|
|
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)) { |
|
911
|
|
|
$this->tmpCat = Category::GAME_OTHER; |
|
912
|
|
|
|
|
913
|
|
|
return true; |
|
914
|
|
|
} |
|
915
|
|
|
|
|
916
|
|
|
return false; |
|
917
|
|
|
} |
|
918
|
|
|
|
|
919
|
|
|
// Music. |
|
920
|
|
|
|
|
921
|
|
|
public function isMusic(): bool |
|
922
|
|
|
{ |
|
923
|
|
|
return match (true) { |
|
924
|
|
|
$this->isMusicVideo(), $this->isAudiobook(), $this->isMusicLossless(), $this->isMusicMP3(), $this->isMusicPodcast(),$this->isMusicOther() => true, |
|
925
|
|
|
default => false, |
|
926
|
|
|
}; |
|
927
|
|
|
} |
|
928
|
|
|
|
|
929
|
|
|
public function isMusicForeign(): bool |
|
930
|
|
|
{ |
|
931
|
|
|
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)) { |
|
932
|
|
|
$this->tmpCat = Category::MUSIC_FOREIGN; |
|
933
|
|
|
|
|
934
|
|
|
return true; |
|
935
|
|
|
} |
|
936
|
|
|
|
|
937
|
|
|
return false; |
|
938
|
|
|
} |
|
939
|
|
|
|
|
940
|
|
|
public function isAudiobook(): bool |
|
941
|
|
|
{ |
|
942
|
|
|
if (preg_match('/(Audiobook|Audio.?Book)/i', $this->releaseName)) { |
|
943
|
|
|
$this->tmpCat = Category::MUSIC_AUDIOBOOK; |
|
944
|
|
|
|
|
945
|
|
|
return true; |
|
946
|
|
|
} |
|
947
|
|
|
|
|
948
|
|
|
return false; |
|
949
|
|
|
} |
|
950
|
|
|
|
|
951
|
|
|
public function isMusicVideo(): bool |
|
952
|
|
|
{ |
|
953
|
|
|
if (preg_match('/(720P|x264)\-(19|20)\d\d\-[a-z0-9]{1,12}/i', $this->releaseName)) { |
|
954
|
|
|
if ($this->isMusicForeign()) { |
|
955
|
|
|
return true; |
|
956
|
|
|
} |
|
957
|
|
|
$this->tmpCat = Category::MUSIC_VIDEO; |
|
958
|
|
|
|
|
959
|
|
|
return true; |
|
960
|
|
|
} |
|
961
|
|
|
if (preg_match('/[a-z0-9]{1,12}-(19|20)\d\d-(720P|x264)/i', $this->releaseName)) { |
|
962
|
|
|
if ($this->isMusicForeign()) { |
|
963
|
|
|
return true; |
|
964
|
|
|
} |
|
965
|
|
|
$this->tmpCat = Category::MUSIC_VIDEO; |
|
966
|
|
|
|
|
967
|
|
|
return true; |
|
968
|
|
|
} |
|
969
|
|
|
|
|
970
|
|
|
return false; |
|
971
|
|
|
} |
|
972
|
|
|
|
|
973
|
|
|
public function isMusicLossless(): bool |
|
974
|
|
|
{ |
|
975
|
|
|
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)) { |
|
976
|
|
|
if ($this->isMusicForeign()) { |
|
977
|
|
|
return true; |
|
978
|
|
|
} |
|
979
|
|
|
$this->tmpCat = Category::MUSIC_LOSSLESS; |
|
980
|
|
|
|
|
981
|
|
|
return true; |
|
982
|
|
|
} |
|
983
|
|
|
|
|
984
|
|
|
return false; |
|
985
|
|
|
} |
|
986
|
|
|
|
|
987
|
|
|
public function isMusicMP3(): bool |
|
988
|
|
|
{ |
|
989
|
|
|
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)) { |
|
990
|
|
|
if ($this->isMusicForeign()) { |
|
991
|
|
|
return true; |
|
992
|
|
|
} |
|
993
|
|
|
$this->tmpCat = Category::MUSIC_MP3; |
|
994
|
|
|
|
|
995
|
|
|
return true; |
|
996
|
|
|
} |
|
997
|
|
|
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)) { |
|
998
|
|
|
if ($this->isMusicForeign()) { |
|
999
|
|
|
return true; |
|
1000
|
|
|
} |
|
1001
|
|
|
$this->tmpCat = Category::MUSIC_MP3; |
|
1002
|
|
|
|
|
1003
|
|
|
return true; |
|
1004
|
|
|
} |
|
1005
|
|
|
|
|
1006
|
|
|
return false; |
|
1007
|
|
|
} |
|
1008
|
|
|
|
|
1009
|
|
|
public function isMusicOther(): bool |
|
1010
|
|
|
{ |
|
1011
|
|
|
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)) { |
|
1012
|
|
|
if (! $this->isMusicForeign()) { |
|
1013
|
|
|
$this->tmpCat = Category::MUSIC_OTHER; |
|
1014
|
|
|
} |
|
1015
|
|
|
|
|
1016
|
|
|
return true; |
|
1017
|
|
|
} |
|
1018
|
|
|
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)) { |
|
1019
|
|
|
$this->tmpCat = Category::MUSIC_OTHER; |
|
1020
|
|
|
|
|
1021
|
|
|
return true; |
|
1022
|
|
|
} |
|
1023
|
|
|
|
|
1024
|
|
|
return false; |
|
1025
|
|
|
} |
|
1026
|
|
|
|
|
1027
|
|
|
public function isMusicPodcast(): bool |
|
1028
|
|
|
{ |
|
1029
|
|
|
if (preg_match('/podcast/i', $this->releaseName)) { |
|
1030
|
|
|
$this->tmpCat = Category::MUSIC_PODCAST; |
|
1031
|
|
|
|
|
1032
|
|
|
return true; |
|
1033
|
|
|
} |
|
1034
|
|
|
|
|
1035
|
|
|
return false; |
|
1036
|
|
|
} |
|
1037
|
|
|
|
|
1038
|
|
|
// Books. |
|
1039
|
|
|
|
|
1040
|
|
|
public function isBook(): bool |
|
1041
|
|
|
{ |
|
1042
|
|
|
return match (true) { |
|
1043
|
|
|
$this->isComic(), $this->isTechnicalBook(), $this->isMagazine(), $this->isBookOther(), $this->isEBook() => true, |
|
1044
|
|
|
default => false, |
|
1045
|
|
|
}; |
|
1046
|
|
|
} |
|
1047
|
|
|
|
|
1048
|
|
|
public function isBookForeign(): bool |
|
1049
|
|
|
{ |
|
1050
|
|
|
switch (true) { |
|
|
|
|
|
|
1051
|
|
|
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): |
|
1052
|
|
|
$this->tmpCat = Category::BOOKS_FOREIGN; |
|
1053
|
|
|
|
|
1054
|
|
|
return true; |
|
1055
|
|
|
default: |
|
1056
|
|
|
return false; |
|
1057
|
|
|
} |
|
1058
|
|
|
} |
|
1059
|
|
|
|
|
1060
|
|
|
public function isComic(): bool |
|
1061
|
|
|
{ |
|
1062
|
|
|
switch (true) { |
|
1063
|
|
|
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): |
|
1064
|
|
|
return false; |
|
1065
|
|
|
case $this->isBookForeign(): |
|
1066
|
|
|
break; |
|
1067
|
|
|
default: |
|
1068
|
|
|
$this->tmpCat = Category::BOOKS_COMICS; |
|
1069
|
|
|
break; |
|
1070
|
|
|
} |
|
1071
|
|
|
|
|
1072
|
|
|
return true; |
|
1073
|
|
|
} |
|
1074
|
|
|
|
|
1075
|
|
|
public function isTechnicalBook(): bool |
|
1076
|
|
|
{ |
|
1077
|
|
|
switch (true) { |
|
1078
|
|
|
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): |
|
1079
|
|
|
return false; |
|
1080
|
|
|
case $this->isBookForeign(): |
|
1081
|
|
|
break; |
|
1082
|
|
|
default: |
|
1083
|
|
|
$this->tmpCat = Category::BOOKS_TECHNICAL; |
|
1084
|
|
|
break; |
|
1085
|
|
|
} |
|
1086
|
|
|
|
|
1087
|
|
|
return true; |
|
1088
|
|
|
} |
|
1089
|
|
|
|
|
1090
|
|
|
public function isMagazine(): bool |
|
1091
|
|
|
{ |
|
1092
|
|
|
switch (true) { |
|
1093
|
|
|
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): |
|
1094
|
|
|
return false; |
|
1095
|
|
|
case $this->isBookForeign(): |
|
1096
|
|
|
break; |
|
1097
|
|
|
default: |
|
1098
|
|
|
$this->tmpCat = Category::BOOKS_MAGAZINES; |
|
1099
|
|
|
break; |
|
1100
|
|
|
} |
|
1101
|
|
|
|
|
1102
|
|
|
return true; |
|
1103
|
|
|
} |
|
1104
|
|
|
|
|
1105
|
|
|
public function isBookOther(): bool |
|
1106
|
|
|
{ |
|
1107
|
|
|
if (preg_match('/"\d\d-\d\d-20\d\d\./', $this->releaseName)) { |
|
1108
|
|
|
$this->tmpCat = Category::BOOKS_UNKNOWN; |
|
1109
|
|
|
|
|
1110
|
|
|
return true; |
|
1111
|
|
|
} |
|
1112
|
|
|
|
|
1113
|
|
|
return false; |
|
1114
|
|
|
} |
|
1115
|
|
|
|
|
1116
|
|
|
public function isEBook(): bool |
|
1117
|
|
|
{ |
|
1118
|
|
|
switch (true) { |
|
1119
|
|
|
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): |
|
1120
|
|
|
return false; |
|
1121
|
|
|
case $this->isBookForeign(): |
|
1122
|
|
|
break; |
|
1123
|
|
|
default: |
|
1124
|
|
|
$this->tmpCat = Category::BOOKS_EBOOK; |
|
1125
|
|
|
break; |
|
1126
|
|
|
} |
|
1127
|
|
|
|
|
1128
|
|
|
return true; |
|
1129
|
|
|
} |
|
1130
|
|
|
|
|
1131
|
|
|
// Misc, all hash/misc go in other misc. |
|
1132
|
|
|
|
|
1133
|
|
|
public function isMisc(): bool |
|
1134
|
|
|
{ |
|
1135
|
|
|
switch (true) { |
|
|
|
|
|
|
1136
|
|
|
case preg_match('/[a-f0-9]{32,64}/i', $this->releaseName): |
|
1137
|
|
|
$this->tmpCat = Category::OTHER_HASHED; |
|
1138
|
|
|
break; |
|
1139
|
|
|
case preg_match('/[a-z0-9]{20,}/i', $this->releaseName): |
|
1140
|
|
|
case preg_match('/^[A-Z0-9]{1,}$/i', $this->releaseName): |
|
1141
|
|
|
$this->tmpCat = Category::OTHER_MISC; |
|
1142
|
|
|
break; |
|
1143
|
|
|
default: |
|
1144
|
|
|
return false; |
|
1145
|
|
|
} |
|
1146
|
|
|
|
|
1147
|
|
|
return true; |
|
1148
|
|
|
} |
|
1149
|
|
|
|
|
1150
|
|
|
/** |
|
1151
|
|
|
* @param string $regex Regex to use for match |
|
1152
|
|
|
* @param string $fromName Poster that needs to be matched by regex |
|
1153
|
|
|
* @param string $category Category to set if there is a match |
|
1154
|
|
|
*/ |
|
1155
|
|
|
public function checkPoster(string $regex, string $fromName, string $category): bool |
|
1156
|
|
|
{ |
|
1157
|
|
|
if (preg_match($regex, $fromName)) { |
|
1158
|
|
|
$this->tmpCat = $category; |
|
1159
|
|
|
|
|
1160
|
|
|
return true; |
|
1161
|
|
|
} |
|
1162
|
|
|
|
|
1163
|
|
|
return false; |
|
1164
|
|
|
} |
|
1165
|
|
|
} |
|
1166
|
|
|
|