|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Blacklight; |
|
4
|
|
|
|
|
5
|
|
|
use App\Models\Group; |
|
6
|
|
|
use App\Models\Predb; |
|
7
|
|
|
use App\Models\Release; |
|
8
|
|
|
use App\Models\Category; |
|
9
|
|
|
use Blacklight\utility\Utility; |
|
10
|
|
|
use Blacklight\processing\PostProcess; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Class NameFixer. |
|
14
|
|
|
*/ |
|
15
|
|
|
class NameFixer |
|
16
|
|
|
{ |
|
17
|
|
|
public const PREDB_REGEX = '/([\w\(\)]+[\s\._-]([\w\(\)]+[\s\._-])+[\w\(\)]+-\w+)/'; |
|
18
|
|
|
|
|
19
|
|
|
// Constants for name fixing status |
|
20
|
|
|
public const PROC_NFO_NONE = 0; |
|
21
|
|
|
public const PROC_NFO_DONE = 1; |
|
22
|
|
|
public const PROC_FILES_NONE = 0; |
|
23
|
|
|
public const PROC_FILES_DONE = 1; |
|
24
|
|
|
public const PROC_PAR2_NONE = 0; |
|
25
|
|
|
public const PROC_PAR2_DONE = 1; |
|
26
|
|
|
public const PROC_UID_NONE = 0; |
|
27
|
|
|
public const PROC_UID_DONE = 1; |
|
28
|
|
|
public const PROC_HASH16K_NONE = 0; |
|
29
|
|
|
public const PROC_HASH16K_DONE = 1; |
|
30
|
|
|
public const PROC_SRR_NONE = 0; |
|
31
|
|
|
public const PROC_SRR_DONE = 1; |
|
32
|
|
|
public const PROC_CRC_NONE = 0; |
|
33
|
|
|
public const PROC_CRC_DONE = 1; |
|
34
|
|
|
|
|
35
|
|
|
// Constants for overall rename status |
|
36
|
|
|
public const IS_RENAMED_NONE = 0; |
|
37
|
|
|
public const IS_RENAMED_DONE = 1; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Has the current release found a new name? |
|
41
|
|
|
* |
|
42
|
|
|
* @var bool |
|
43
|
|
|
*/ |
|
44
|
|
|
public $matched; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* How many releases have got a new name? |
|
48
|
|
|
* |
|
49
|
|
|
* @var int |
|
50
|
|
|
*/ |
|
51
|
|
|
public $fixed; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* How many releases were checked. |
|
55
|
|
|
* |
|
56
|
|
|
* @var int |
|
57
|
|
|
*/ |
|
58
|
|
|
public $checked; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Whether or not the check has completed. |
|
62
|
|
|
* |
|
63
|
|
|
* @var bool |
|
64
|
|
|
*/ |
|
65
|
|
|
public $done; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Whether or not to echo info to CLI. |
|
69
|
|
|
* |
|
70
|
|
|
* @var bool |
|
71
|
|
|
*/ |
|
72
|
|
|
public $echooutput; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Total releases we are working on. |
|
76
|
|
|
* |
|
77
|
|
|
* @var int |
|
78
|
|
|
*/ |
|
79
|
|
|
protected $_totalReleases; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* The cleaned filename we want to match. |
|
83
|
|
|
* |
|
84
|
|
|
* @var string |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $_fileName; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* The release ID we are trying to rename. |
|
90
|
|
|
* |
|
91
|
|
|
* @var int |
|
92
|
|
|
*/ |
|
93
|
|
|
protected $relid; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @var string |
|
97
|
|
|
*/ |
|
98
|
|
|
protected $othercats; |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @var string |
|
102
|
|
|
*/ |
|
103
|
|
|
protected $timeother; |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @var string |
|
107
|
|
|
*/ |
|
108
|
|
|
protected $timeall; |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @var string |
|
112
|
|
|
*/ |
|
113
|
|
|
protected $fullother; |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @var string |
|
117
|
|
|
*/ |
|
118
|
|
|
protected $fullall; |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @var \Blacklight\ConsoleTools |
|
122
|
|
|
*/ |
|
123
|
|
|
public $consoletools; |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* @var \Blacklight\Categorize |
|
127
|
|
|
*/ |
|
128
|
|
|
public $category; |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* @var \Blacklight\utility\Utility |
|
132
|
|
|
*/ |
|
133
|
|
|
public $text; |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* @var \Blacklight\SphinxSearch |
|
137
|
|
|
*/ |
|
138
|
|
|
public $sphinx; |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @var \Blacklight\ColorCLI |
|
142
|
|
|
*/ |
|
143
|
|
|
protected $colorCli; |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @param array $options Class instances / Echo to cli. |
|
147
|
|
|
* @throws \Exception |
|
148
|
|
|
*/ |
|
149
|
|
|
public function __construct(array $options = []) |
|
150
|
|
|
{ |
|
151
|
|
|
$defaults = [ |
|
152
|
|
|
'Echo' => true, |
|
153
|
|
|
'Categorize' => null, |
|
154
|
|
|
'ConsoleTools' => null, |
|
155
|
|
|
'Groups' => null, |
|
156
|
|
|
'Misc' => null, |
|
157
|
|
|
'Settings' => null, |
|
158
|
|
|
'SphinxSearch' => null, |
|
159
|
|
|
]; |
|
160
|
|
|
$options += $defaults; |
|
161
|
|
|
|
|
162
|
|
|
$this->echooutput = ($options['Echo'] && config('nntmux.echocli')); |
|
163
|
|
|
$this->relid = $this->fixed = $this->checked = 0; |
|
164
|
|
|
$this->othercats = implode(',', Category::OTHERS_GROUP); |
|
165
|
|
|
$this->timeother = sprintf(' AND rel.adddate > (NOW() - INTERVAL 6 HOUR) AND rel.categories_id IN (%s) GROUP BY rel.id ORDER BY postdate DESC', $this->othercats); |
|
166
|
|
|
$this->timeall = ' AND rel.adddate > (NOW() - INTERVAL 6 HOUR) GROUP BY rel.id ORDER BY postdate DESC'; |
|
167
|
|
|
$this->fullother = sprintf(' AND rel.categories_id IN (%s) GROUP BY rel.id', $this->othercats); |
|
168
|
|
|
$this->fullall = ''; |
|
169
|
|
|
$this->_fileName = ''; |
|
170
|
|
|
$this->done = $this->matched = false; |
|
171
|
|
|
$this->consoletools = ($options['ConsoleTools'] instanceof ConsoleTools ? $options['ConsoleTools'] : new ConsoleTools()); |
|
172
|
|
|
$this->category = ($options['Categorize'] instanceof Categorize ? $options['Categorize'] : new Categorize(['Settings' => null])); |
|
|
|
|
|
|
173
|
|
|
$this->text = ($options['Misc'] instanceof Utility ? $options['Misc'] : new Utility()); |
|
174
|
|
|
$this->sphinx = ($options['SphinxSearch'] instanceof SphinxSearch ? $options['SphinxSearch'] : new SphinxSearch()); |
|
175
|
|
|
$this->colorCli = new ColorCLI(); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Attempts to fix release names using the NFO. |
|
180
|
|
|
* |
|
181
|
|
|
* |
|
182
|
|
|
* @param $time |
|
183
|
|
|
* @param $echo |
|
184
|
|
|
* @param $cats |
|
185
|
|
|
* @param $nameStatus |
|
186
|
|
|
* @param $show |
|
187
|
|
|
* @throws \Exception |
|
188
|
|
|
*/ |
|
189
|
|
|
public function fixNamesWithNfo($time, $echo, $cats, $nameStatus, $show): void |
|
190
|
|
|
{ |
|
191
|
|
|
$this->_echoStartMessage($time, '.nfo files'); |
|
192
|
|
|
$type = 'NFO, '; |
|
193
|
|
|
|
|
194
|
|
|
// Only select releases we haven't checked here before |
|
195
|
|
|
$preId = false; |
|
196
|
|
|
if ($cats === 3) { |
|
197
|
|
|
$query = sprintf( |
|
198
|
|
|
' |
|
199
|
|
|
SELECT rel.id AS releases_id, rel.fromname |
|
200
|
|
|
FROM releases rel |
|
201
|
|
|
INNER JOIN release_nfos nfo ON (nfo.releases_id = rel.id) |
|
202
|
|
|
WHERE rel.nzbstatus = %d |
|
203
|
|
|
AND rel.predb_id = 0', |
|
204
|
|
|
NZB::NZB_ADDED |
|
205
|
|
|
); |
|
206
|
|
|
$cats = 2; |
|
207
|
|
|
$preId = true; |
|
208
|
|
|
} else { |
|
209
|
|
|
$query = sprintf( |
|
210
|
|
|
' |
|
211
|
|
|
SELECT rel.id AS releases_id, rel.fromname |
|
212
|
|
|
FROM releases rel |
|
213
|
|
|
INNER JOIN release_nfos nfo ON (nfo.releases_id = rel.id) |
|
214
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
215
|
|
|
AND rel.predb_id = 0 |
|
216
|
|
|
AND rel.proc_nfo = %d', |
|
217
|
|
|
self::IS_RENAMED_NONE, |
|
218
|
|
|
Category::OTHER_MISC, |
|
219
|
|
|
Category::OTHER_HASHED, |
|
220
|
|
|
self::PROC_NFO_NONE |
|
221
|
|
|
); |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
225
|
|
|
|
|
226
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
227
|
|
|
|
|
228
|
|
|
if ($total > 0) { |
|
229
|
|
|
$this->_totalReleases = $total; |
|
230
|
|
|
$this->colorCli->primary(number_format($total).' releases to process.'); |
|
231
|
|
|
|
|
232
|
|
|
foreach ($releases as $rel) { |
|
|
|
|
|
|
233
|
|
|
$releaseRow = Release::fromQuery( |
|
234
|
|
|
sprintf( |
|
235
|
|
|
' |
|
236
|
|
|
SELECT nfo.releases_id AS nfoid, rel.groups_id, rel.fromname, rel.categories_id, rel.name, rel.searchname, |
|
237
|
|
|
UNCOMPRESS(nfo) AS textstring, rel.id AS releases_id |
|
238
|
|
|
FROM releases rel |
|
239
|
|
|
INNER JOIN release_nfos nfo ON (nfo.releases_id = rel.id) |
|
240
|
|
|
WHERE rel.id = %d LIMIT 1', |
|
241
|
|
|
$rel->releases_id |
|
242
|
|
|
) |
|
243
|
|
|
); |
|
244
|
|
|
|
|
245
|
|
|
$this->checked++; |
|
246
|
|
|
|
|
247
|
|
|
// Ignore encrypted NFOs. |
|
248
|
|
|
if (preg_match('/^=newz\[NZB\]=\w+/', $releaseRow[0]->textstring)) { |
|
249
|
|
|
$this->_updateSingleColumn('proc_nfo', self::PROC_NFO_DONE, $rel->releases_id); |
|
250
|
|
|
continue; |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
|
|
$this->reset(); |
|
254
|
|
|
$this->checkName($releaseRow[0], $echo, $type, $nameStatus, $show, $preId); |
|
255
|
|
|
$this->_echoRenamed($show); |
|
256
|
|
|
} |
|
257
|
|
|
$this->_echoFoundCount($echo, ' NFO\'s'); |
|
258
|
|
|
} else { |
|
259
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
260
|
|
|
} |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
/** |
|
264
|
|
|
* Attempts to fix release names using the File name. |
|
265
|
|
|
* |
|
266
|
|
|
* |
|
267
|
|
|
* @param $time |
|
268
|
|
|
* @param $echo |
|
269
|
|
|
* @param $cats |
|
270
|
|
|
* @param $nameStatus |
|
271
|
|
|
* @param $show |
|
272
|
|
|
* @throws \Exception |
|
273
|
|
|
*/ |
|
274
|
|
|
public function fixNamesWithFiles($time, $echo, $cats, $nameStatus, $show): void |
|
275
|
|
|
{ |
|
276
|
|
|
$this->_echoStartMessage($time, 'file names'); |
|
277
|
|
|
$type = 'Filenames, '; |
|
278
|
|
|
|
|
279
|
|
|
$preId = false; |
|
280
|
|
|
if ($cats === 3) { |
|
281
|
|
|
$query = sprintf( |
|
282
|
|
|
' |
|
283
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
284
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
285
|
|
|
FROM releases rel |
|
286
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
287
|
|
|
WHERE nzbstatus = %d |
|
288
|
|
|
AND predb_id = 0', |
|
289
|
|
|
NZB::NZB_ADDED |
|
290
|
|
|
); |
|
291
|
|
|
$cats = 2; |
|
292
|
|
|
$preId = true; |
|
293
|
|
|
} else { |
|
294
|
|
|
$query = sprintf( |
|
295
|
|
|
' |
|
296
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
297
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
298
|
|
|
FROM releases rel |
|
299
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
300
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
301
|
|
|
AND rel.predb_id = 0 |
|
302
|
|
|
AND proc_files = %d', |
|
303
|
|
|
self::IS_RENAMED_NONE, |
|
304
|
|
|
Category::OTHER_MISC, |
|
305
|
|
|
Category::OTHER_HASHED, |
|
306
|
|
|
self::PROC_FILES_NONE |
|
307
|
|
|
); |
|
308
|
|
|
} |
|
309
|
|
|
|
|
310
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
311
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
312
|
|
|
if ($total > 0) { |
|
313
|
|
|
$this->_totalReleases = $total; |
|
314
|
|
|
$this->colorCli->primary(number_format($total).' file names to process.'); |
|
315
|
|
|
|
|
316
|
|
|
foreach ($releases as $release) { |
|
|
|
|
|
|
317
|
|
|
$this->reset(); |
|
318
|
|
|
$this->checkName($release, $echo, $type, $nameStatus, $show, $preId); |
|
319
|
|
|
$this->checked++; |
|
320
|
|
|
$this->_echoRenamed($show); |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
$this->_echoFoundCount($echo, ' files'); |
|
324
|
|
|
} else { |
|
325
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
326
|
|
|
} |
|
327
|
|
|
} |
|
328
|
|
|
|
|
329
|
|
|
/** |
|
330
|
|
|
* Attempts to fix release names using the rar file crc32 hash. |
|
331
|
|
|
* |
|
332
|
|
|
* |
|
333
|
|
|
* @param $time |
|
334
|
|
|
* @param $echo |
|
335
|
|
|
* @param $cats |
|
336
|
|
|
* @param $nameStatus |
|
337
|
|
|
* @param $show |
|
338
|
|
|
* @throws \Exception |
|
339
|
|
|
*/ |
|
340
|
|
|
public function fixNamesWithCrc($time, $echo, $cats, $nameStatus, $show): void |
|
341
|
|
|
{ |
|
342
|
|
|
$this->_echoStartMessage($time, 'CRC32'); |
|
343
|
|
|
$type = 'CRC32, '; |
|
344
|
|
|
|
|
345
|
|
|
$preId = false; |
|
346
|
|
|
if ($cats === 3) { |
|
347
|
|
|
$query = sprintf( |
|
348
|
|
|
' |
|
349
|
|
|
SELECT rf.crc32 AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, rel.size as relsize, |
|
350
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
351
|
|
|
FROM releases rel |
|
352
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
353
|
|
|
WHERE nzbstatus = %d |
|
354
|
|
|
AND predb_id = 0', |
|
355
|
|
|
NZB::NZB_ADDED |
|
356
|
|
|
); |
|
357
|
|
|
$cats = 2; |
|
358
|
|
|
$preId = true; |
|
359
|
|
|
} else { |
|
360
|
|
|
$query = sprintf( |
|
361
|
|
|
' |
|
362
|
|
|
SELECT rf.crc32 AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, rel.size as relsize, |
|
363
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
364
|
|
|
FROM releases rel |
|
365
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
366
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
367
|
|
|
AND rel.predb_id = 0 |
|
368
|
|
|
AND rel.proc_crc32 = %d', |
|
369
|
|
|
self::IS_RENAMED_NONE, |
|
370
|
|
|
Category::OTHER_MISC, |
|
371
|
|
|
Category::OTHER_HASHED, |
|
372
|
|
|
self::PROC_CRC_NONE |
|
373
|
|
|
); |
|
374
|
|
|
} |
|
375
|
|
|
|
|
376
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
377
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
378
|
|
|
if ($total > 0) { |
|
379
|
|
|
$this->_totalReleases = $total; |
|
380
|
|
|
$this->colorCli->primary(number_format($total).' CRC32\'s to process.'); |
|
381
|
|
|
|
|
382
|
|
|
foreach ($releases as $release) { |
|
|
|
|
|
|
383
|
|
|
$this->reset(); |
|
384
|
|
|
$this->checkName($release, $echo, $type, $nameStatus, $show, $preId); |
|
385
|
|
|
$this->checked++; |
|
386
|
|
|
$this->_echoRenamed($show); |
|
387
|
|
|
} |
|
388
|
|
|
|
|
389
|
|
|
$this->_echoFoundCount($echo, ' crc32\'s'); |
|
390
|
|
|
} else { |
|
391
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
392
|
|
|
} |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
/** |
|
396
|
|
|
* Attempts to fix XXX release names using the File name. |
|
397
|
|
|
* |
|
398
|
|
|
* |
|
399
|
|
|
* @param $time |
|
400
|
|
|
* @param $echo |
|
401
|
|
|
* @param $cats |
|
402
|
|
|
* @param $nameStatus |
|
403
|
|
|
* @param $show |
|
404
|
|
|
* @throws \Exception |
|
405
|
|
|
*/ |
|
406
|
|
|
public function fixXXXNamesWithFiles($time, $echo, $cats, $nameStatus, $show): void |
|
407
|
|
|
{ |
|
408
|
|
|
$this->_echoStartMessage($time, 'file names'); |
|
409
|
|
|
$type = 'Filenames, '; |
|
410
|
|
|
|
|
411
|
|
|
if ($cats === 3) { |
|
412
|
|
|
$query = sprintf( |
|
413
|
|
|
' |
|
414
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
415
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
416
|
|
|
FROM releases rel |
|
417
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
418
|
|
|
WHERE nzbstatus = %d |
|
419
|
|
|
AND predb_id = 0', |
|
420
|
|
|
NZB::NZB_ADDED |
|
421
|
|
|
); |
|
422
|
|
|
$cats = 2; |
|
423
|
|
|
} else { |
|
424
|
|
|
$query = sprintf( |
|
425
|
|
|
' |
|
426
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
427
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
428
|
|
|
FROM releases rel |
|
429
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
430
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
431
|
|
|
AND rel.predb_id = 0 |
|
432
|
|
|
AND rf.name LIKE %s', |
|
433
|
|
|
self::IS_RENAMED_NONE, |
|
434
|
|
|
Category::OTHER_MISC, |
|
435
|
|
|
Category::OTHER_HASHED, |
|
436
|
|
|
escapeString('%SDPORN%') |
|
437
|
|
|
); |
|
438
|
|
|
} |
|
439
|
|
|
|
|
440
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
441
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
442
|
|
|
if ($total > 0) { |
|
443
|
|
|
$this->_totalReleases = $total; |
|
444
|
|
|
$this->colorCli->primary(number_format($total).' xxx file names to process.'); |
|
445
|
|
|
|
|
446
|
|
|
foreach ($releases as $release) { |
|
|
|
|
|
|
447
|
|
|
$this->reset(); |
|
448
|
|
|
$this->xxxNameCheck($release, $echo, $type, $nameStatus, $show); |
|
449
|
|
|
$this->checked++; |
|
450
|
|
|
$this->_echoRenamed($show); |
|
451
|
|
|
} |
|
452
|
|
|
$this->_echoFoundCount($echo, ' files'); |
|
453
|
|
|
} else { |
|
454
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
455
|
|
|
} |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
/** |
|
459
|
|
|
* Attempts to fix release names using the SRR filename. |
|
460
|
|
|
* |
|
461
|
|
|
* |
|
462
|
|
|
* @param $time |
|
463
|
|
|
* @param $echo |
|
464
|
|
|
* @param $cats |
|
465
|
|
|
* @param $nameStatus |
|
466
|
|
|
* @param $show |
|
467
|
|
|
* @throws \Exception |
|
468
|
|
|
*/ |
|
469
|
|
|
public function fixNamesWithSrr($time, $echo, $cats, $nameStatus, $show): void |
|
470
|
|
|
{ |
|
471
|
|
|
$this->_echoStartMessage($time, 'SRR file names'); |
|
472
|
|
|
$type = 'SRR, '; |
|
473
|
|
|
|
|
474
|
|
|
if ($cats === 3) { |
|
475
|
|
|
$query = sprintf( |
|
476
|
|
|
' |
|
477
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
478
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
479
|
|
|
FROM releases rel |
|
480
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
481
|
|
|
WHERE nzbstatus = %d |
|
482
|
|
|
AND predb_id = 0', |
|
483
|
|
|
NZB::NZB_ADDED |
|
484
|
|
|
); |
|
485
|
|
|
$cats = 2; |
|
486
|
|
|
} else { |
|
487
|
|
|
$query = sprintf( |
|
488
|
|
|
' |
|
489
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
490
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
491
|
|
|
FROM releases rel |
|
492
|
|
|
INNER JOIN release_files rf ON rf.releases_id = rel.id |
|
493
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
494
|
|
|
AND rel.predb_id = 0 |
|
495
|
|
|
AND rf.name LIKE %s |
|
496
|
|
|
AND rel.proc_srr = %d', |
|
497
|
|
|
self::IS_RENAMED_NONE, |
|
498
|
|
|
Category::OTHER_MISC, |
|
499
|
|
|
Category::OTHER_HASHED, |
|
500
|
|
|
escapeString('%.srr'), |
|
501
|
|
|
self::PROC_SRR_NONE |
|
502
|
|
|
); |
|
503
|
|
|
} |
|
504
|
|
|
|
|
505
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
506
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
507
|
|
|
if ($total > 0) { |
|
508
|
|
|
$this->_totalReleases = $total; |
|
509
|
|
|
$this->colorCli->primary(number_format($total).' srr file extensions to process.'); |
|
510
|
|
|
|
|
511
|
|
|
foreach ($releases as $release) { |
|
|
|
|
|
|
512
|
|
|
$this->reset(); |
|
513
|
|
|
$this->srrNameCheck($release, $echo, $type, $nameStatus, $show); |
|
514
|
|
|
$this->checked++; |
|
515
|
|
|
$this->_echoRenamed($show); |
|
516
|
|
|
} |
|
517
|
|
|
$this->_echoFoundCount($echo, ' files'); |
|
518
|
|
|
} else { |
|
519
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
520
|
|
|
} |
|
521
|
|
|
} |
|
522
|
|
|
|
|
523
|
|
|
/** |
|
524
|
|
|
* Attempts to fix release names using the Par2 File. |
|
525
|
|
|
* |
|
526
|
|
|
* @param int $time 1: 24 hours, 2: no time limit |
|
527
|
|
|
* @param int $echo 1: change the name, anything else: preview of what could have been changed. |
|
528
|
|
|
* @param int $cats 1: other categories, 2: all categories |
|
529
|
|
|
* @param $nameStatus |
|
530
|
|
|
* @param $show |
|
531
|
|
|
* @param NNTP $nntp |
|
532
|
|
|
* @throws \Exception |
|
533
|
|
|
*/ |
|
534
|
|
|
public function fixNamesWithPar2($time, $echo, $cats, $nameStatus, $show, $nntp): void |
|
535
|
|
|
{ |
|
536
|
|
|
$this->_echoStartMessage($time, 'par2 files'); |
|
537
|
|
|
|
|
538
|
|
|
if ($cats === 3) { |
|
539
|
|
|
$query = sprintf( |
|
540
|
|
|
' |
|
541
|
|
|
SELECT rel.id AS releases_id, rel.guid, rel.groups_id, rel.fromname |
|
542
|
|
|
FROM releases rel |
|
543
|
|
|
WHERE rel.nzbstatus = %d |
|
544
|
|
|
AND rel.predb_id = 0', |
|
545
|
|
|
NZB::NZB_ADDED |
|
546
|
|
|
); |
|
547
|
|
|
$cats = 2; |
|
548
|
|
|
} else { |
|
549
|
|
|
$query = sprintf( |
|
550
|
|
|
' |
|
551
|
|
|
SELECT rel.id AS releases_id, rel.guid, rel.groups_id, rel.fromname |
|
552
|
|
|
FROM releases rel |
|
553
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
554
|
|
|
AND rel.predb_id = 0 |
|
555
|
|
|
AND rel.proc_par2 = %d', |
|
556
|
|
|
self::IS_RENAMED_NONE, |
|
557
|
|
|
Category::OTHER_MISC, |
|
558
|
|
|
Category::OTHER_HASHED, |
|
559
|
|
|
self::PROC_PAR2_NONE |
|
560
|
|
|
); |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
564
|
|
|
|
|
565
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
566
|
|
|
if ($total > 0) { |
|
567
|
|
|
$this->_totalReleases = $total; |
|
568
|
|
|
|
|
569
|
|
|
$this->colorCli->primary(number_format($total).' releases to process.'); |
|
570
|
|
|
$Nfo = new Nfo(); |
|
571
|
|
|
$nzbContents = new NZBContents( |
|
572
|
|
|
[ |
|
573
|
|
|
'Echo' => $this->echooutput, |
|
574
|
|
|
'NNTP' => $nntp, |
|
575
|
|
|
'Nfo' => $Nfo, |
|
576
|
|
|
'PostProcess' => new PostProcess(['Nfo' => $Nfo]), |
|
577
|
|
|
] |
|
578
|
|
|
); |
|
579
|
|
|
|
|
580
|
|
|
foreach ($releases as $release) { |
|
|
|
|
|
|
581
|
|
|
if ($nzbContents->checkPAR2($release->guid, $release->releases_id, $release->groups_id, $nameStatus, $show) === true) { |
|
582
|
|
|
$this->fixed++; |
|
583
|
|
|
} |
|
584
|
|
|
|
|
585
|
|
|
$this->checked++; |
|
586
|
|
|
$this->_echoRenamed($show); |
|
587
|
|
|
} |
|
588
|
|
|
$this->_echoFoundCount($echo, ' files'); |
|
589
|
|
|
} else { |
|
590
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
591
|
|
|
} |
|
592
|
|
|
} |
|
593
|
|
|
|
|
594
|
|
|
/** |
|
595
|
|
|
* Attempts to fix release names using the mediainfo xml Unique_ID. |
|
596
|
|
|
* |
|
597
|
|
|
* |
|
598
|
|
|
* @param $time |
|
599
|
|
|
* @param $echo |
|
600
|
|
|
* @param $cats |
|
601
|
|
|
* @param $nameStatus |
|
602
|
|
|
* @param $show |
|
603
|
|
|
* @throws \Exception |
|
604
|
|
|
*/ |
|
605
|
|
|
public function fixNamesWithMedia($time, $echo, $cats, $nameStatus, $show): void |
|
606
|
|
|
{ |
|
607
|
|
|
$type = 'UID, '; |
|
608
|
|
|
|
|
609
|
|
|
$this->_echoStartMessage($time, 'mediainfo Unique_IDs'); |
|
610
|
|
|
|
|
611
|
|
|
// Re-check all releases we haven't matched to a PreDB |
|
612
|
|
|
if ($cats === 3) { |
|
613
|
|
|
$query = sprintf( |
|
614
|
|
|
' |
|
615
|
|
|
SELECT |
|
616
|
|
|
rel.id AS releases_id, rel.size AS relsize, rel.groups_id, rel.fromname, rel.categories_id, |
|
617
|
|
|
rel.name, rel.name AS textstring, rel.predb_id, rel.searchname, |
|
618
|
|
|
ru.uniqueid AS uid |
|
619
|
|
|
FROM releases rel |
|
620
|
|
|
LEFT JOIN release_unique ru ON ru.releases_id = rel.id |
|
621
|
|
|
WHERE ru.releases_id IS NOT NULL |
|
622
|
|
|
AND rel.nzbstatus = %d |
|
623
|
|
|
AND rel.predb_id = 0', |
|
624
|
|
|
NZB::NZB_ADDED |
|
625
|
|
|
); |
|
626
|
|
|
$cats = 2; |
|
627
|
|
|
// Otherwise check only releases we haven't renamed and checked uid before in Misc categories |
|
628
|
|
|
} else { |
|
629
|
|
|
$query = sprintf( |
|
630
|
|
|
' |
|
631
|
|
|
SELECT |
|
632
|
|
|
rel.id AS releases_id, rel.size AS relsize, rel.groups_id, rel.fromname, rel.categories_id, |
|
633
|
|
|
rel.name, rel.name AS textstring, rel.predb_id, rel.searchname, |
|
634
|
|
|
ru.uniqueid AS uid |
|
635
|
|
|
FROM releases rel |
|
636
|
|
|
LEFT JOIN release_unique ru ON ru.releases_id = rel.id |
|
637
|
|
|
WHERE ru.releases_id IS NOT NULL |
|
638
|
|
|
AND rel.nzbstatus = %d |
|
639
|
|
|
AND (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
640
|
|
|
AND rel.predb_id = 0 |
|
641
|
|
|
AND rel.proc_uid = %d', |
|
642
|
|
|
NZB::NZB_ADDED, |
|
643
|
|
|
self::IS_RENAMED_NONE, |
|
644
|
|
|
Category::OTHER_MISC, |
|
645
|
|
|
Category::OTHER_HASHED, |
|
646
|
|
|
self::PROC_UID_NONE |
|
647
|
|
|
); |
|
648
|
|
|
} |
|
649
|
|
|
|
|
650
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
651
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
652
|
|
|
if ($total > 0) { |
|
653
|
|
|
$this->_totalReleases = $total; |
|
654
|
|
|
$this->colorCli->primary(number_format($total).' unique ids to process.'); |
|
655
|
|
|
foreach ($releases as $rel) { |
|
|
|
|
|
|
656
|
|
|
$this->checked++; |
|
657
|
|
|
$this->reset(); |
|
658
|
|
|
$this->uidCheck($rel, $echo, $type, $nameStatus, $show); |
|
659
|
|
|
$this->_echoRenamed($show); |
|
660
|
|
|
} |
|
661
|
|
|
$this->_echoFoundCount($echo, ' UID\'s'); |
|
662
|
|
|
} else { |
|
663
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
664
|
|
|
} |
|
665
|
|
|
} |
|
666
|
|
|
|
|
667
|
|
|
/** |
|
668
|
|
|
* @param $time |
|
669
|
|
|
* @param $echo |
|
670
|
|
|
* @param $cats |
|
671
|
|
|
* @param $nameStatus |
|
672
|
|
|
* @param $show |
|
673
|
|
|
* @throws \Exception |
|
674
|
|
|
*/ |
|
675
|
|
|
public function fixNamesWithMediaMovieName($time, $echo, $cats, $nameStatus, $show): void |
|
676
|
|
|
{ |
|
677
|
|
|
$type = 'Mediainfo, '; |
|
678
|
|
|
|
|
679
|
|
|
$this->_echoStartMessage($time, 'Mediainfo movie_name'); |
|
680
|
|
|
|
|
681
|
|
|
// Re-check all releases we haven't matched to a PreDB |
|
682
|
|
|
if ($cats === 3) { |
|
683
|
|
|
$query = sprintf( |
|
684
|
|
|
" |
|
685
|
|
|
SELECT rel.id AS releases_id, rel.name, rel.name AS textstring, rel.predb_id, rel.searchname, rel.fromname, rel.groups_id, rel.categories_id, rel.id AS releases_id, rf.mediainfo AS mediainfo |
|
686
|
|
|
FROM releases rel |
|
687
|
|
|
INNER JOIN releaseextrafull rf ON rf.releases_id = rel.id |
|
688
|
|
|
WHERE rel.name REGEXP '[a-z0-9]{32,64}' |
|
689
|
|
|
AND rf.mediainfo REGEXP '\<Movie_name\>' |
|
690
|
|
|
AND rel.nzbstatus = %d |
|
691
|
|
|
AND rel.predb_id = 0", |
|
692
|
|
|
NZB::NZB_ADDED |
|
693
|
|
|
); |
|
694
|
|
|
$cats = 2; |
|
695
|
|
|
// Otherwise check only releases we haven't renamed and checked uid before in Misc categories |
|
696
|
|
|
} else { |
|
697
|
|
|
$query = sprintf( |
|
698
|
|
|
" |
|
699
|
|
|
SELECT rel.id AS releases_id, rel.name, rel.name AS textstring, rel.predb_id, rel.searchname, rel.fromname, rel.groups_id, rel.categories_id, rel.id AS releases_id, rf.mediainfo AS mediainfo |
|
700
|
|
|
FROM releases rel |
|
701
|
|
|
INNER JOIN releaseextrafull rf ON rf.releases_id = rel.id |
|
702
|
|
|
WHERE rel.name REGEXP '[a-z0-9]{32,64}' |
|
703
|
|
|
AND rf.mediainfo REGEXP '\<Movie_name\>' |
|
704
|
|
|
AND rel.nzbstatus = %d |
|
705
|
|
|
AND rel.isrenamed = %d |
|
706
|
|
|
AND rel.predb_id = 0 |
|
707
|
|
|
AND rel.categories_id IN (%d, %d)", |
|
708
|
|
|
NZB::NZB_ADDED, |
|
709
|
|
|
self::IS_RENAMED_NONE, |
|
710
|
|
|
Category::OTHER_MISC, |
|
711
|
|
|
Category::OTHER_HASHED |
|
712
|
|
|
); |
|
713
|
|
|
} |
|
714
|
|
|
|
|
715
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
716
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
717
|
|
|
if ($total > 0) { |
|
718
|
|
|
$this->_totalReleases = $total; |
|
719
|
|
|
$this->colorCli->primary(number_format($total).' mediainfo movie names to process.'); |
|
720
|
|
|
foreach ($releases as $rel) { |
|
|
|
|
|
|
721
|
|
|
$this->checked++; |
|
722
|
|
|
$this->reset(); |
|
723
|
|
|
$this->mediaMovieNameCheck($rel, $echo, $type, $nameStatus, $show); |
|
724
|
|
|
$this->_echoRenamed($show); |
|
725
|
|
|
} |
|
726
|
|
|
$this->_echoFoundCount($echo, ' MediaInfo\'s'); |
|
727
|
|
|
} else { |
|
728
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
729
|
|
|
} |
|
730
|
|
|
} |
|
731
|
|
|
|
|
732
|
|
|
/** |
|
733
|
|
|
* Attempts to fix release names using the par2 hash_16K block. |
|
734
|
|
|
* |
|
735
|
|
|
* |
|
736
|
|
|
* @param $time |
|
737
|
|
|
* @param $echo |
|
738
|
|
|
* @param $cats |
|
739
|
|
|
* @param $nameStatus |
|
740
|
|
|
* @param $show |
|
741
|
|
|
* @throws \Exception |
|
742
|
|
|
*/ |
|
743
|
|
|
public function fixNamesWithParHash($time, $echo, $cats, $nameStatus, $show): void |
|
744
|
|
|
{ |
|
745
|
|
|
$type = 'PAR2 hash, '; |
|
746
|
|
|
|
|
747
|
|
|
$this->_echoStartMessage($time, 'PAR2 hash_16K'); |
|
748
|
|
|
|
|
749
|
|
|
// Re-check all releases we haven't matched to a PreDB |
|
750
|
|
|
if ($cats === 3) { |
|
751
|
|
|
$query = sprintf( |
|
752
|
|
|
' |
|
753
|
|
|
SELECT |
|
754
|
|
|
rel.id AS releases_id, rel.size AS relsize, rel.groups_id, rel.fromname, rel.categories_id, |
|
755
|
|
|
rel.name, rel.name AS textstring, rel.predb_id, rel.searchname, |
|
756
|
|
|
IFNULL(ph.hash, "") AS hash |
|
757
|
|
|
FROM releases rel |
|
758
|
|
|
LEFT JOIN par_hashes ph ON ph.releases_id = rel.id |
|
759
|
|
|
WHERE ph.hash != "" |
|
760
|
|
|
AND rel.nzbstatus = %d |
|
761
|
|
|
AND rel.predb_id = 0', |
|
762
|
|
|
NZB::NZB_ADDED |
|
763
|
|
|
); |
|
764
|
|
|
$cats = 2; |
|
765
|
|
|
// Otherwise check only releases we haven't renamed and checked their par2 hash_16K before in Misc categories |
|
766
|
|
|
} else { |
|
767
|
|
|
$query = sprintf( |
|
768
|
|
|
' |
|
769
|
|
|
SELECT |
|
770
|
|
|
rel.id AS releases_id, rel.size AS relsize, rel.groups_id, rel.fromname, rel.categories_id, |
|
771
|
|
|
rel.name, rel.name AS textstring, rel.predb_id, rel.searchname, |
|
772
|
|
|
IFNULL(ph.hash, "") AS hash |
|
773
|
|
|
FROM releases rel |
|
774
|
|
|
LEFT JOIN par_hashes ph ON ph.releases_id = rel.id |
|
775
|
|
|
WHERE rel.nzbstatus = %d |
|
776
|
|
|
AND (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
777
|
|
|
AND rel.predb_id = 0 |
|
778
|
|
|
AND ph.hash != "" |
|
779
|
|
|
AND rel.proc_hash16k = %d', |
|
780
|
|
|
NZB::NZB_ADDED, |
|
781
|
|
|
self::IS_RENAMED_NONE, |
|
782
|
|
|
Category::OTHER_MISC, |
|
783
|
|
|
Category::OTHER_HASHED, |
|
784
|
|
|
self::PROC_HASH16K_NONE |
|
785
|
|
|
); |
|
786
|
|
|
} |
|
787
|
|
|
|
|
788
|
|
|
$releases = $this->_getReleases($time, $cats, $query); |
|
789
|
|
|
|
|
790
|
|
|
$total = \count($releases); |
|
|
|
|
|
|
791
|
|
|
if ($total > 0) { |
|
792
|
|
|
$this->_totalReleases = $total; |
|
793
|
|
|
$this->colorCli->primary(number_format($total).' hash_16K to process.'); |
|
794
|
|
|
foreach ($releases as $rel) { |
|
|
|
|
|
|
795
|
|
|
$this->checked++; |
|
796
|
|
|
$this->reset(); |
|
797
|
|
|
$this->hashCheck($rel, $echo, $type, $nameStatus, $show); |
|
798
|
|
|
$this->_echoRenamed($show); |
|
799
|
|
|
} |
|
800
|
|
|
$this->_echoFoundCount($echo, ' hashes'); |
|
801
|
|
|
} else { |
|
802
|
|
|
$this->colorCli->info('Nothing to fix.'); |
|
803
|
|
|
} |
|
804
|
|
|
} |
|
805
|
|
|
|
|
806
|
|
|
/** |
|
807
|
|
|
* @param $time |
|
808
|
|
|
* @param $cats |
|
809
|
|
|
* @param $query |
|
810
|
|
|
* @param string $limit |
|
811
|
|
|
* |
|
812
|
|
|
* @return array|false |
|
813
|
|
|
*/ |
|
814
|
|
|
protected function _getReleases($time, $cats, $query, $limit = '') |
|
815
|
|
|
{ |
|
816
|
|
|
$releases = false; |
|
817
|
|
|
$queryLimit = ($limit === '') ? '' : ' LIMIT '.$limit; |
|
818
|
|
|
// 24 hours, other cats |
|
819
|
|
|
if ($time === 1 && $cats === 1) { |
|
820
|
|
|
$releases = Release::fromQuery($query.$this->timeother.$queryLimit); |
|
821
|
|
|
} // 24 hours, all cats |
|
822
|
|
|
if ($time === 1 && $cats === 2) { |
|
823
|
|
|
$releases = Release::fromQuery($query.$this->timeall.$queryLimit); |
|
824
|
|
|
} //other cats |
|
825
|
|
|
if ($time === 2 && $cats === 1) { |
|
826
|
|
|
$releases = Release::fromQuery($query.$this->fullother.$queryLimit); |
|
827
|
|
|
} // all cats |
|
828
|
|
|
if ($time === 2 && $cats === 2) { |
|
829
|
|
|
$releases = Release::fromQuery($query.$this->fullall.$queryLimit); |
|
830
|
|
|
} |
|
831
|
|
|
|
|
832
|
|
|
return $releases; |
|
|
|
|
|
|
833
|
|
|
} |
|
834
|
|
|
|
|
835
|
|
|
/** |
|
836
|
|
|
* Echo the amount of releases that found a new name. |
|
837
|
|
|
* |
|
838
|
|
|
* @param int|bool $echo 1: change the name, anything else: preview of what could have been changed. |
|
839
|
|
|
* @param string $type The function type that found the name. |
|
840
|
|
|
*/ |
|
841
|
|
|
protected function _echoFoundCount($echo, $type): void |
|
842
|
|
|
{ |
|
843
|
|
|
if ($echo === true) { |
|
844
|
|
|
$this->colorCli->header( |
|
845
|
|
|
PHP_EOL. |
|
846
|
|
|
number_format($this->fixed). |
|
847
|
|
|
' releases have had their names changed out of: '. |
|
848
|
|
|
number_format($this->checked). |
|
849
|
|
|
$type.'.' |
|
850
|
|
|
); |
|
851
|
|
|
} else { |
|
852
|
|
|
$this->colorCli->header( |
|
853
|
|
|
PHP_EOL. |
|
854
|
|
|
number_format($this->fixed). |
|
855
|
|
|
' releases could have their names changed. '. |
|
856
|
|
|
number_format($this->checked). |
|
857
|
|
|
$type.' were checked.' |
|
858
|
|
|
); |
|
859
|
|
|
} |
|
860
|
|
|
} |
|
861
|
|
|
|
|
862
|
|
|
/** |
|
863
|
|
|
* @param int $time 1: 24 hours, 2: no time limit |
|
864
|
|
|
* @param string $type The function type. |
|
865
|
|
|
*/ |
|
866
|
|
|
protected function _echoStartMessage($time, $type): void |
|
867
|
|
|
{ |
|
868
|
|
|
$this->colorCli->header( |
|
869
|
|
|
sprintf( |
|
870
|
|
|
'Fixing search names %s using %s.', |
|
871
|
|
|
($time === 1 ? 'in the past 6 hours' : 'since the beginning'), |
|
872
|
|
|
$type |
|
873
|
|
|
) |
|
874
|
|
|
); |
|
875
|
|
|
} |
|
876
|
|
|
|
|
877
|
|
|
/** |
|
878
|
|
|
* @param int $show |
|
879
|
|
|
*/ |
|
880
|
|
|
protected function _echoRenamed($show): void |
|
881
|
|
|
{ |
|
882
|
|
|
if ($this->checked % 500 === 0 && $show === 1) { |
|
883
|
|
|
$this->colorCli->alternate(PHP_EOL.number_format($this->checked).' files processed.'.PHP_EOL); |
|
884
|
|
|
} |
|
885
|
|
|
|
|
886
|
|
|
if ($show === 2) { |
|
887
|
|
|
$this->consoletools->overWritePrimary( |
|
888
|
|
|
'Renamed Releases: ['. |
|
889
|
|
|
number_format($this->fixed). |
|
890
|
|
|
'] '. |
|
891
|
|
|
$this->consoletools->percentString($this->checked, $this->_totalReleases) |
|
892
|
|
|
); |
|
893
|
|
|
} |
|
894
|
|
|
} |
|
895
|
|
|
|
|
896
|
|
|
/** |
|
897
|
|
|
* Update the release with the new information. |
|
898
|
|
|
* |
|
899
|
|
|
* |
|
900
|
|
|
* @param $release |
|
901
|
|
|
* @param $name |
|
902
|
|
|
* @param $method |
|
903
|
|
|
* @param $echo |
|
904
|
|
|
* @param $type |
|
905
|
|
|
* @param int $nameStatus |
|
906
|
|
|
* @param bool $show |
|
907
|
|
|
* @param int $preId |
|
908
|
|
|
* |
|
909
|
|
|
* @throws \Exception |
|
910
|
|
|
*/ |
|
911
|
|
|
public function updateRelease($release, $name, $method, $echo, $type, int $nameStatus, bool $show, int $preId = 0): void |
|
912
|
|
|
{ |
|
913
|
|
|
if (\is_array($release)) { |
|
914
|
|
|
$release = (object) $release; |
|
915
|
|
|
} |
|
916
|
|
|
if ($this->relid !== $release->releases_id) { |
|
917
|
|
|
$newName = (new ReleaseCleaning())->fixerCleaner($name); |
|
918
|
|
|
if (strtolower($newName) !== strtolower($release->searchname)) { |
|
919
|
|
|
$this->matched = true; |
|
920
|
|
|
$this->relid = (int) $release->releases_id; |
|
921
|
|
|
|
|
922
|
|
|
$determinedCategory = $this->category->determineCategory($release->groups_id, $newName, ! empty($release->fromname) ? $release->fromname : ''); |
|
923
|
|
|
|
|
924
|
|
|
if ($type === 'PAR2, ') { |
|
925
|
|
|
$newName = ucwords($newName); |
|
926
|
|
|
if (preg_match('/(.+?)\.[a-z0-9]{2,3}(PAR2)?$/i', $name, $match)) { |
|
927
|
|
|
$newName = $match[1]; |
|
928
|
|
|
} |
|
929
|
|
|
} |
|
930
|
|
|
|
|
931
|
|
|
$this->fixed++; |
|
932
|
|
|
|
|
933
|
|
|
$newName = explode('\\', $newName); |
|
934
|
|
|
$newName = preg_replace(['/^[-=_\.:\s]+/', '/[-=_\.:\s]+$/'], '', $newName[0]); |
|
935
|
|
|
|
|
936
|
|
|
if ($this->echooutput === true && $show === true) { |
|
937
|
|
|
$groupName = Group::getNameByID($release->groups_id); |
|
938
|
|
|
$oldCatName = Category::getNameByID($release->categories_id); |
|
939
|
|
|
$newCatName = Category::getNameByID($determinedCategory['categories_id']); |
|
940
|
|
|
|
|
941
|
|
|
if ($type === 'PAR2, ') { |
|
942
|
|
|
echo PHP_EOL; |
|
943
|
|
|
} |
|
944
|
|
|
|
|
945
|
|
|
echo PHP_EOL; |
|
946
|
|
|
|
|
947
|
|
|
$this->colorCli->headerOver('New name: '). |
|
|
|
|
|
|
948
|
|
|
$this->colorCli->primary(substr($newName, 0, 299)). |
|
|
|
|
|
|
949
|
|
|
$this->colorCli->headerOver('Old name: '). |
|
|
|
|
|
|
950
|
|
|
$this->colorCli->primary($release->searchname). |
|
|
|
|
|
|
951
|
|
|
$this->colorCli->headerOver('Use name: '). |
|
|
|
|
|
|
952
|
|
|
$this->colorCli->primary($release->name). |
|
|
|
|
|
|
953
|
|
|
$this->colorCli->headerOver('New cat: '). |
|
|
|
|
|
|
954
|
|
|
$this->colorCli->primary($newCatName). |
|
|
|
|
|
|
955
|
|
|
$this->colorCli->headerOver('Old cat: '). |
|
|
|
|
|
|
956
|
|
|
$this->colorCli->primary($oldCatName). |
|
|
|
|
|
|
957
|
|
|
$this->colorCli->headerOver('Group: '). |
|
|
|
|
|
|
958
|
|
|
$this->colorCli->primary($groupName). |
|
|
|
|
|
|
959
|
|
|
$this->colorCli->headerOver('Method: '). |
|
|
|
|
|
|
960
|
|
|
$this->colorCli->primary($type.$method). |
|
|
|
|
|
|
961
|
|
|
$this->colorCli->headerOver('Releases ID: '). |
|
|
|
|
|
|
962
|
|
|
$this->colorCli->primary($release->releases_id); |
|
|
|
|
|
|
963
|
|
|
if (! empty($release->filename)) { |
|
964
|
|
|
$this->colorCli->headerOver('Filename: '). |
|
|
|
|
|
|
965
|
|
|
$this->colorCli->primary($release->filename); |
|
|
|
|
|
|
966
|
|
|
} |
|
967
|
|
|
|
|
968
|
|
|
if ($type !== 'PAR2, ') { |
|
969
|
|
|
echo PHP_EOL; |
|
970
|
|
|
} |
|
971
|
|
|
} |
|
972
|
|
|
|
|
973
|
|
|
$newTitle = substr($newName, 0, 299); |
|
974
|
|
|
$taggedRelease = Release::find($release->releases_id); |
|
975
|
|
|
|
|
976
|
|
|
if ($echo === true) { |
|
977
|
|
|
if ($nameStatus === 1) { |
|
978
|
|
|
$status = ''; |
|
979
|
|
|
switch ($type) { |
|
980
|
|
|
case 'NFO, ': |
|
981
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_nfo' => 1]; |
|
982
|
|
|
break; |
|
983
|
|
|
case 'PAR2, ': |
|
984
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_par2' => 1]; |
|
985
|
|
|
break; |
|
986
|
|
|
case 'Filenames, ': |
|
987
|
|
|
case 'file matched source: ': |
|
988
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_files' => 1]; |
|
989
|
|
|
break; |
|
990
|
|
|
case 'SHA1, ': |
|
991
|
|
|
case 'MD5, ': |
|
992
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'dehashstatus' => 1]; |
|
993
|
|
|
break; |
|
994
|
|
|
case 'PreDB FT Exact, ': |
|
995
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1]; |
|
996
|
|
|
break; |
|
997
|
|
|
case 'sorter, ': |
|
998
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_sorter' => 1]; |
|
999
|
|
|
break; |
|
1000
|
|
|
case 'UID, ': |
|
1001
|
|
|
case 'Mediainfo, ': |
|
1002
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_uid' => 1]; |
|
1003
|
|
|
break; |
|
1004
|
|
|
case 'PAR2 hash, ': |
|
1005
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_hash16k' => 1]; |
|
1006
|
|
|
break; |
|
1007
|
|
|
case 'SRR, ': |
|
1008
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_srr' => 1]; |
|
1009
|
|
|
break; |
|
1010
|
|
|
case 'CRC32, ': |
|
1011
|
|
|
$status = ['isrenamed' => 1, 'iscategorized' => 1, 'proc_crc32' => 1]; |
|
1012
|
|
|
break; |
|
1013
|
|
|
} |
|
1014
|
|
|
|
|
1015
|
|
|
$updateColumns = [ |
|
1016
|
|
|
'videos_id' => 0, |
|
1017
|
|
|
'tv_episodes_id' => 0, |
|
1018
|
|
|
'imdbid' => null, |
|
1019
|
|
|
'musicinfo_id' => null, |
|
1020
|
|
|
'consoleinfo_id' => null, |
|
1021
|
|
|
'bookinfo_id' => null, |
|
1022
|
|
|
'anidbid' => null, |
|
1023
|
|
|
'predb_id' => $preId, |
|
1024
|
|
|
'searchname' => $newTitle, |
|
1025
|
|
|
'categories_id' => $determinedCategory['categories_id'], |
|
1026
|
|
|
]; |
|
1027
|
|
|
|
|
1028
|
|
|
if ($status !== '') { |
|
1029
|
|
|
foreach ($status as $key => $stat) { |
|
1030
|
|
|
$updateColumns = array_add($updateColumns, $key, $stat); |
|
1031
|
|
|
} |
|
1032
|
|
|
} |
|
1033
|
|
|
|
|
1034
|
|
|
$taggedRelease->update($updateColumns); |
|
1035
|
|
|
$taggedRelease->retag($determinedCategory['tags']); |
|
1036
|
|
|
$this->sphinx->updateRelease($release->releases_id); |
|
1037
|
|
|
} else { |
|
1038
|
|
|
$newTitle = substr($newName, 0, 299); |
|
1039
|
|
|
|
|
1040
|
|
|
$release->update( |
|
1041
|
|
|
[ |
|
1042
|
|
|
'videos_id' => 0, |
|
1043
|
|
|
'tv_episodes_id' => 0, |
|
1044
|
|
|
'imdbid' => null, |
|
1045
|
|
|
'musicinfo_id' => null, |
|
1046
|
|
|
'consoleinfo_id' => null, |
|
1047
|
|
|
'bookinfo_id' => null, |
|
1048
|
|
|
'anidbid' => null, |
|
1049
|
|
|
'predb_id' => $preId, |
|
1050
|
|
|
'searchname' => $newTitle, |
|
1051
|
|
|
'categories_id' => $determinedCategory['categories_id'], |
|
1052
|
|
|
'iscategorized' => 1, |
|
1053
|
|
|
] |
|
1054
|
|
|
); |
|
1055
|
|
|
$taggedRelease->retag($determinedCategory['tags']); |
|
1056
|
|
|
$this->sphinx->updateRelease($release->releases_id); |
|
1057
|
|
|
} |
|
1058
|
|
|
} |
|
1059
|
|
|
} |
|
1060
|
|
|
} |
|
1061
|
|
|
$this->done = true; |
|
1062
|
|
|
} |
|
1063
|
|
|
|
|
1064
|
|
|
/** |
|
1065
|
|
|
* Echo a updated release name to CLI. |
|
1066
|
|
|
* |
|
1067
|
|
|
* @param array $data |
|
1068
|
|
|
* array( |
|
1069
|
|
|
* 'new_name' => (string) The new release search name. |
|
1070
|
|
|
* 'old_name' => (string) The old release search name. |
|
1071
|
|
|
* 'new_category' => (string) The new category name or ID for the release. |
|
1072
|
|
|
* 'old_category' => (string) The old category name or ID for the release. |
|
1073
|
|
|
* 'group' => (string) The group name or ID of the release. |
|
1074
|
|
|
* 'release_id' => (int) The ID of the release. |
|
1075
|
|
|
* 'method' => (string) The method used to rename the release. |
|
1076
|
|
|
* ) |
|
1077
|
|
|
* |
|
1078
|
|
|
* @static |
|
1079
|
|
|
* @void |
|
1080
|
|
|
*/ |
|
1081
|
|
|
public static function echoChangedReleaseName( |
|
1082
|
|
|
array $data = |
|
1083
|
|
|
[ |
|
1084
|
|
|
'new_name' => '', |
|
1085
|
|
|
'old_name' => '', |
|
1086
|
|
|
'new_category' => '', |
|
1087
|
|
|
'old_category' => '', |
|
1088
|
|
|
'group' => '', |
|
1089
|
|
|
'releases_id' => 0, |
|
1090
|
|
|
'method' => '', |
|
1091
|
|
|
] |
|
1092
|
|
|
): void { |
|
1093
|
|
|
$colorCLI = new ColorCLI(); |
|
1094
|
|
|
echo PHP_EOL; |
|
1095
|
|
|
|
|
1096
|
|
|
$colorCLI->headerOver('New name: ').$colorCLI->primaryOver($data['new_name']). |
|
|
|
|
|
|
1097
|
|
|
$colorCLI->headerOver('Old name: ').$colorCLI->primaryOver($data['old_name']). |
|
|
|
|
|
|
1098
|
|
|
$colorCLI->headerOver('New category: ').$colorCLI->primaryOver($data['new_category']). |
|
|
|
|
|
|
1099
|
|
|
$colorCLI->headerOver('Old category: ').$colorCLI->primaryOver($data['old_category']). |
|
|
|
|
|
|
1100
|
|
|
$colorCLI->headerOver('Group: ').$colorCLI->primaryOver($data['group']). |
|
|
|
|
|
|
1101
|
|
|
$colorCLI->headerOver('Releases ID: ').$colorCLI->primaryOver($data['releases_id']). |
|
|
|
|
|
|
1102
|
|
|
$colorCLI->headerOver('Method: ').$colorCLI->primaryOver($data['method']); |
|
|
|
|
|
|
1103
|
|
|
} |
|
1104
|
|
|
|
|
1105
|
|
|
/** |
|
1106
|
|
|
* Match a PreDB title to a release name or searchname using an exact full-text match. |
|
1107
|
|
|
* |
|
1108
|
|
|
* @param $pre |
|
1109
|
|
|
* @param $echo |
|
1110
|
|
|
* @param $nameStatus |
|
1111
|
|
|
* @param $show |
|
1112
|
|
|
* |
|
1113
|
|
|
* @return int |
|
1114
|
|
|
* @throws \Exception |
|
1115
|
|
|
*/ |
|
1116
|
|
|
public function matchPredbFT($pre, $echo, $nameStatus, $show): int |
|
1117
|
|
|
{ |
|
1118
|
|
|
$matching = $total = 0; |
|
1119
|
|
|
|
|
1120
|
|
|
$join = $this->_preFTsearchQuery($pre['title']); |
|
1121
|
|
|
|
|
1122
|
|
|
if ($join === '') { |
|
1123
|
|
|
return $matching; |
|
1124
|
|
|
} |
|
1125
|
|
|
|
|
1126
|
|
|
//Find release matches with fulltext and then identify exact matches with cleaned LIKE string |
|
1127
|
|
|
$res = Release::fromQuery( |
|
1128
|
|
|
sprintf( |
|
1129
|
|
|
' |
|
1130
|
|
|
SELECT r.id AS releases_id, r.name, r.searchname, |
|
1131
|
|
|
r.fromname, r.groups_id, r.categories_id |
|
1132
|
|
|
FROM releases r |
|
1133
|
|
|
%1$s |
|
1134
|
|
|
AND (r.name LIKE %2$s OR r.searchname LIKE %2$s) |
|
1135
|
|
|
AND r.predb_id = 0 |
|
1136
|
|
|
LIMIT 21', |
|
1137
|
|
|
$join, |
|
1138
|
|
|
escapeString('%'.$pre['title'].'%') |
|
1139
|
|
|
) |
|
1140
|
|
|
); |
|
1141
|
|
|
|
|
1142
|
|
|
if (! empty($res)) { |
|
1143
|
|
|
$total = \count($res); |
|
1144
|
|
|
} |
|
1145
|
|
|
|
|
1146
|
|
|
// Run if row count is positive, but do not run if row count exceeds 10 (as this is likely a failed title match) |
|
1147
|
|
|
if ($total > 0 && $total <= 15) { |
|
1148
|
|
|
foreach ($res as $row) { |
|
1149
|
|
|
if ($pre['title'] !== $row->searchname) { |
|
1150
|
|
|
$this->updateRelease($row, $pre['title'], 'Title Match source: '.$pre['source'], $echo, 'PreDB FT Exact, ', $nameStatus, $show, $pre['predb_id']); |
|
1151
|
|
|
$matching++; |
|
1152
|
|
|
} else { |
|
1153
|
|
|
$this->_updateSingleColumn('predb_id', $pre['predb_id'], $row->releases_id); |
|
|
|
|
|
|
1154
|
|
|
} |
|
1155
|
|
|
} |
|
1156
|
|
|
} elseif ($total >= 16) { |
|
1157
|
|
|
$matching = -1; |
|
1158
|
|
|
} |
|
1159
|
|
|
|
|
1160
|
|
|
return $matching; |
|
1161
|
|
|
} |
|
1162
|
|
|
|
|
1163
|
|
|
/** |
|
1164
|
|
|
* @param $preTitle |
|
1165
|
|
|
* |
|
1166
|
|
|
* @return string |
|
1167
|
|
|
*/ |
|
1168
|
|
|
protected function _preFTsearchQuery($preTitle): string |
|
1169
|
|
|
{ |
|
1170
|
|
|
$join = ''; |
|
1171
|
|
|
|
|
1172
|
|
|
if (\strlen($preTitle) >= 15 && preg_match(self::PREDB_REGEX, $preTitle)) { |
|
1173
|
|
|
$titlematch = SphinxSearch::escapeString($preTitle); |
|
1174
|
|
|
$join .= sprintf( |
|
1175
|
|
|
'INNER JOIN releases_se rse ON rse.id = r.id |
|
1176
|
|
|
WHERE rse.query = "@(name,searchname,filename) %s;mode=extended"', |
|
1177
|
|
|
$titlematch |
|
1178
|
|
|
); |
|
1179
|
|
|
} |
|
1180
|
|
|
|
|
1181
|
|
|
return $join; |
|
1182
|
|
|
} |
|
1183
|
|
|
|
|
1184
|
|
|
/** |
|
1185
|
|
|
* Retrieves releases and their file names to attempt PreDB matches |
|
1186
|
|
|
* Runs in a limited mode based on arguments passed or a full mode broken into chunks of entire DB. |
|
1187
|
|
|
* |
|
1188
|
|
|
* @param array $args The CLI script arguments |
|
1189
|
|
|
* @throws \Exception |
|
1190
|
|
|
*/ |
|
1191
|
|
|
public function getPreFileNames(array $args = []): void |
|
1192
|
|
|
{ |
|
1193
|
|
|
$show = isset($args[2]) && $args[2] === 'show'; |
|
1194
|
|
|
|
|
1195
|
|
|
if (isset($args[1]) && is_numeric($args[1])) { |
|
1196
|
|
|
$limit = 'LIMIT '.$args[1]; |
|
1197
|
|
|
$orderby = 'ORDER BY r.id DESC'; |
|
1198
|
|
|
} else { |
|
1199
|
|
|
$orderby = 'ORDER BY r.id ASC'; |
|
1200
|
|
|
$limit = 'LIMIT 1000000'; |
|
1201
|
|
|
} |
|
1202
|
|
|
|
|
1203
|
|
|
$this->colorCli->header(PHP_EOL.'Match PreFiles '.$args[1].' Started at '.now()); |
|
1204
|
|
|
$this->colorCli->primary('Matching predb filename to cleaned release_files.name.'); |
|
1205
|
|
|
|
|
1206
|
|
|
$counter = $counted = 0; |
|
1207
|
|
|
$timestart = now(); |
|
1208
|
|
|
|
|
1209
|
|
|
$query = Release::fromQuery( |
|
1210
|
|
|
sprintf( |
|
1211
|
|
|
" |
|
1212
|
|
|
SELECT r.id AS releases_id, r.name, r.searchname, |
|
1213
|
|
|
r.fromname, r.groups_id, r.categories_id, |
|
1214
|
|
|
GROUP_CONCAT(rf.name ORDER BY LENGTH(rf.name) DESC SEPARATOR '||') AS filename |
|
1215
|
|
|
FROM releases r |
|
1216
|
|
|
INNER JOIN release_files rf ON r.id = rf.releases_id |
|
1217
|
|
|
WHERE rf.name IS NOT NULL |
|
1218
|
|
|
AND r.predb_id = 0 |
|
1219
|
|
|
AND r.categories_id IN (%s) |
|
1220
|
|
|
AND r.isrenamed = 0 |
|
1221
|
|
|
GROUP BY r.id |
|
1222
|
|
|
%s %s", |
|
1223
|
|
|
implode(',', Category::OTHERS_GROUP), |
|
1224
|
|
|
$orderby, |
|
1225
|
|
|
$limit |
|
1226
|
|
|
) |
|
1227
|
|
|
); |
|
1228
|
|
|
|
|
1229
|
|
|
if (! empty($query)) { |
|
1230
|
|
|
$total = \count($query); |
|
1231
|
|
|
|
|
1232
|
|
|
if ($total > 0) { |
|
1233
|
|
|
$this->colorCli->header(PHP_EOL.number_format($total).' releases to process.'); |
|
1234
|
|
|
|
|
1235
|
|
|
foreach ($query as $row) { |
|
1236
|
|
|
$success = $this->matchPreDbFiles($row, true, 1, $show); |
|
1237
|
|
|
if ($success === 1) { |
|
1238
|
|
|
$counted++; |
|
1239
|
|
|
} |
|
1240
|
|
|
if ($show === 0) { |
|
1241
|
|
|
$this->consoletools->overWritePrimary('Renamed Releases: ['.number_format($counted).'] '.$this->consoletools->percentString(++$counter, $total)); |
|
1242
|
|
|
} |
|
1243
|
|
|
} |
|
1244
|
|
|
$this->colorCli->header(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timestart).' seconds'.'.'); |
|
1245
|
|
|
} else { |
|
1246
|
|
|
$this->colorCli->info('Nothing to do.'); |
|
1247
|
|
|
} |
|
1248
|
|
|
} |
|
1249
|
|
|
} |
|
1250
|
|
|
|
|
1251
|
|
|
/** |
|
1252
|
|
|
* Match a release filename to a PreDB filename or title. |
|
1253
|
|
|
* |
|
1254
|
|
|
* @param $release |
|
1255
|
|
|
* @param bool $echo |
|
1256
|
|
|
* @param int $nameStatus |
|
1257
|
|
|
* @param bool $show |
|
1258
|
|
|
* |
|
1259
|
|
|
* @return int |
|
1260
|
|
|
* @throws \Exception |
|
1261
|
|
|
*/ |
|
1262
|
|
|
public function matchPreDbFiles($release, $echo, $nameStatus, $show): int |
|
1263
|
|
|
{ |
|
1264
|
|
|
$matching = 0; |
|
1265
|
|
|
|
|
1266
|
|
|
foreach (explode('||', $release->filename) as $key => $fileName) { |
|
1267
|
|
|
$this->_fileName = $fileName; |
|
1268
|
|
|
$this->_cleanMatchFiles(); |
|
1269
|
|
|
$preMatch = $this->preMatch($this->_fileName); |
|
1270
|
|
|
if ($preMatch[0] === true) { |
|
1271
|
|
|
$results = $this->sphinx->searchIndexes($preMatch[1], ['filename', 'title'], 'predb_rt'); |
|
1272
|
|
|
if (! empty($results)) { |
|
1273
|
|
|
foreach ($results as $result) { |
|
1274
|
|
|
if (! empty($result)) { |
|
1275
|
|
|
$preMatch = Predb::whereId($result['id'])->first(); |
|
1276
|
|
|
$preFtMatch = $this->preMatch($preMatch->filename); |
|
1277
|
|
|
if ($preFtMatch[0] === true) { |
|
1278
|
|
|
$this->_fileName = $preMatch->filename; |
|
1279
|
|
|
$release->filename = $this->_fileName; |
|
1280
|
|
|
if ($preMatch->title !== $release->searchname) { |
|
1281
|
|
|
$this->updateRelease($release, $preMatch->title, 'file matched source: '.$preMatch->source, $echo, 'PreDB file match, ', $nameStatus, $show, $preMatch->id); |
|
1282
|
|
|
} else { |
|
1283
|
|
|
$this->_updateSingleColumn('predb_id', $preMatch->id, $release->releases_id); |
|
1284
|
|
|
} |
|
1285
|
|
|
$matching++; |
|
1286
|
|
|
break; |
|
1287
|
|
|
} |
|
1288
|
|
|
} |
|
1289
|
|
|
} |
|
1290
|
|
|
} |
|
1291
|
|
|
} |
|
1292
|
|
|
} |
|
1293
|
|
|
|
|
1294
|
|
|
return $matching; |
|
1295
|
|
|
} |
|
1296
|
|
|
|
|
1297
|
|
|
/** |
|
1298
|
|
|
* Cleans file names for PreDB Match. |
|
1299
|
|
|
* |
|
1300
|
|
|
* |
|
1301
|
|
|
* @return string |
|
1302
|
|
|
*/ |
|
1303
|
|
|
protected function _cleanMatchFiles(): string |
|
1304
|
|
|
{ |
|
1305
|
|
|
|
|
1306
|
|
|
// first strip all non-printing chars from filename |
|
1307
|
|
|
$this->_fileName = Utility::stripNonPrintingChars($this->_fileName); |
|
1308
|
|
|
|
|
1309
|
|
|
if ($this->_fileName !== '' && strpos($this->_fileName, '.') !== 0) { |
|
1310
|
|
|
switch (true) { |
|
|
|
|
|
|
1311
|
|
|
|
|
1312
|
|
|
case strpos($this->_fileName, '.') !== false: |
|
1313
|
|
|
//some filenames start with a period that ends up creating bad matches so we don't process them |
|
1314
|
|
|
$this->_fileName = Utility::cutStringUsingLast('.', $this->_fileName, 'left', false); |
|
1315
|
|
|
break; |
|
1316
|
|
|
|
|
1317
|
|
|
//if filename has a .part001, send it back to the function to cut the next period |
|
1318
|
|
|
case preg_match('/\.part\d+$/', $this->_fileName): |
|
1319
|
|
|
$this->_fileName = Utility::cutStringUsingLast('.', $this->_fileName, 'left', false); |
|
1320
|
|
|
break; |
|
1321
|
|
|
|
|
1322
|
|
|
//if filename has a .vol001, send it back to the function to cut the next period |
|
1323
|
|
|
case preg_match('/\.vol\d+(\+\d+)?$/', $this->_fileName): |
|
1324
|
|
|
$this->_fileName = Utility::cutStringUsingLast('.', $this->_fileName, 'left', false); |
|
1325
|
|
|
break; |
|
1326
|
|
|
|
|
1327
|
|
|
//if filename contains a slash, cut the string and keep string to the right of the last slash to remove dir |
|
1328
|
|
|
case strpos($this->_fileName, '\\') !== false: |
|
1329
|
|
|
$this->_fileName = Utility::cutStringUsingLast('\\', $this->_fileName, 'right', false); |
|
1330
|
|
|
break; |
|
1331
|
|
|
|
|
1332
|
|
|
// A lot of obscured releases have one NFO file properly named with a track number (Audio) at the front of it |
|
1333
|
|
|
// This will strip out the track and match it to its pre title |
|
1334
|
|
|
case preg_match('/^\d{2}-/', $this->_fileName): |
|
1335
|
|
|
$this->_fileName = preg_replace('/^\d{2}-/', '', $this->_fileName); |
|
1336
|
|
|
} |
|
1337
|
|
|
|
|
1338
|
|
|
return trim($this->_fileName); |
|
1339
|
|
|
} |
|
1340
|
|
|
|
|
1341
|
|
|
return false; |
|
|
|
|
|
|
1342
|
|
|
} |
|
1343
|
|
|
|
|
1344
|
|
|
/** |
|
1345
|
|
|
* Match a Hash from the predb to a release. |
|
1346
|
|
|
* |
|
1347
|
|
|
* @param string $hash |
|
1348
|
|
|
* @param $release |
|
1349
|
|
|
* @param $echo |
|
1350
|
|
|
* @param $nameStatus |
|
1351
|
|
|
* @param $show |
|
1352
|
|
|
* |
|
1353
|
|
|
* @return int |
|
1354
|
|
|
* @throws \Exception |
|
1355
|
|
|
*/ |
|
1356
|
|
|
public function matchPredbHash($hash, $release, $echo, $nameStatus, $show): int |
|
1357
|
|
|
{ |
|
1358
|
|
|
$matching = 0; |
|
1359
|
|
|
$this->matched = false; |
|
1360
|
|
|
|
|
1361
|
|
|
// Determine MD5 or SHA1 |
|
1362
|
|
|
if (\strlen($hash) === 40) { |
|
1363
|
|
|
$hashtype = 'SHA1, '; |
|
1364
|
|
|
} else { |
|
1365
|
|
|
$hashtype = 'MD5, '; |
|
1366
|
|
|
} |
|
1367
|
|
|
|
|
1368
|
|
|
$row = Predb::fromQuery( |
|
1369
|
|
|
sprintf( |
|
1370
|
|
|
' |
|
1371
|
|
|
SELECT p.id AS predb_id, p.title, p.source |
|
1372
|
|
|
FROM predb p INNER JOIN predb_hashes h ON h.predb_id = p.id |
|
1373
|
|
|
WHERE h.hash = UNHEX(%s) |
|
1374
|
|
|
LIMIT 1', |
|
1375
|
|
|
escapeString($hash) |
|
1376
|
|
|
) |
|
1377
|
|
|
); |
|
1378
|
|
|
|
|
1379
|
|
|
foreach ($row as $item) { |
|
1380
|
|
|
if (! empty($item)) { |
|
1381
|
|
|
if ($item->title !== $release->searchname) { |
|
1382
|
|
|
$this->updateRelease($release, $item->title, 'predb hash release name: '.$item->source, $echo, $hashtype, $nameStatus, $show, $item->predb_id); |
|
|
|
|
|
|
1383
|
|
|
$matching++; |
|
1384
|
|
|
} |
|
1385
|
|
|
} else { |
|
1386
|
|
|
$this->_updateSingleColumn('dehashstatus', $release->dehashstatus - 1, $release->releases_id); |
|
1387
|
|
|
} |
|
1388
|
|
|
} |
|
1389
|
|
|
|
|
1390
|
|
|
return $matching; |
|
1391
|
|
|
} |
|
1392
|
|
|
|
|
1393
|
|
|
/** |
|
1394
|
|
|
* Matches the hashes within the predb table to release files and subjects (names) which are hashed. |
|
1395
|
|
|
* |
|
1396
|
|
|
* @param $time |
|
1397
|
|
|
* @param $echo |
|
1398
|
|
|
* @param $cats |
|
1399
|
|
|
* @param $nameStatus |
|
1400
|
|
|
* @param $show |
|
1401
|
|
|
* |
|
1402
|
|
|
* @return int |
|
1403
|
|
|
* @throws \Exception |
|
1404
|
|
|
*/ |
|
1405
|
|
|
public function parseTitles($time, $echo, $cats, $nameStatus, $show): int |
|
1406
|
|
|
{ |
|
1407
|
|
|
$updated = $checked = 0; |
|
1408
|
|
|
|
|
1409
|
|
|
$tq = ''; |
|
1410
|
|
|
if ($time === 1) { |
|
1411
|
|
|
$tq = 'AND r.adddate > (NOW() - INTERVAL 3 HOUR) ORDER BY rf.releases_id, rf.size DESC'; |
|
1412
|
|
|
} |
|
1413
|
|
|
$ct = ''; |
|
1414
|
|
|
if ($cats === 1) { |
|
1415
|
|
|
$ct = sprintf('AND r.categories_id IN (%s)', $this->othercats); |
|
1416
|
|
|
} |
|
1417
|
|
|
|
|
1418
|
|
|
if ($this->echooutput) { |
|
1419
|
|
|
$te = ''; |
|
1420
|
|
|
if ($time === 1) { |
|
1421
|
|
|
$te = ' in the past 3 hours'; |
|
1422
|
|
|
} |
|
1423
|
|
|
$this->colorCli->header('Fixing search names'.$te.' using the predb hash.'); |
|
1424
|
|
|
} |
|
1425
|
|
|
$regex = 'AND (r.ishashed = 1 OR rf.ishashed = 1)'; |
|
1426
|
|
|
|
|
1427
|
|
|
if ($cats === 3) { |
|
1428
|
|
|
$query = sprintf('SELECT r.id AS releases_id, r.name, r.searchname, r.categories_id, r.groups_id, ' |
|
1429
|
|
|
.'dehashstatus, rf.name AS filename FROM releases r ' |
|
1430
|
|
|
.'LEFT OUTER JOIN release_files rf ON r.id = rf.releases_id ' |
|
1431
|
|
|
.'WHERE nzbstatus = 1 AND dehashstatus BETWEEN -6 AND 0 AND predb_id = 0 %s', $regex); |
|
1432
|
|
|
} else { |
|
1433
|
|
|
$query = sprintf('SELECT r.id AS releases_id, r.name, r.searchname, r.categories_id, r.groups_id, ' |
|
1434
|
|
|
.'dehashstatus, rf.name AS filename FROM releases r ' |
|
1435
|
|
|
.'LEFT OUTER JOIN release_files rf ON r.id = rf.releases_id ' |
|
1436
|
|
|
.'WHERE nzbstatus = 1 AND isrenamed = 0 AND dehashstatus BETWEEN -6 AND 0 %s %s %s', $regex, $ct, $tq); |
|
1437
|
|
|
} |
|
1438
|
|
|
|
|
1439
|
|
|
$res = Release::fromQuery($query); |
|
1440
|
|
|
$total = \count($res); |
|
1441
|
|
|
$this->colorCli->primary(number_format($total).' releases to process.'); |
|
1442
|
|
|
foreach ($res as $row) { |
|
1443
|
|
|
if (preg_match('/[a-fA-F0-9]{32,40}/i', $row->name, $matches)) { |
|
1444
|
|
|
$updated += $this->matchPredbHash($matches[0], $row, $echo, $nameStatus, $show); |
|
1445
|
|
|
} elseif (preg_match('/[a-fA-F0-9]{32,40}/i', $row->filename, $matches)) { |
|
|
|
|
|
|
1446
|
|
|
$updated += $this->matchPredbHash($matches[0], $row, $echo, $nameStatus, $show); |
|
1447
|
|
|
} |
|
1448
|
|
|
if ($show === 2) { |
|
1449
|
|
|
$this->colorCli->overWritePrimary('Renamed Releases: ['.number_format($updated).'] '.$this->consoletools->percentString($checked++, $total)); |
|
|
|
|
|
|
1450
|
|
|
} |
|
1451
|
|
|
} |
|
1452
|
|
|
if ($echo === 1) { |
|
1453
|
|
|
$this->colorCli->header(PHP_EOL.$updated.' releases have had their names changed out of: '.number_format($checked).' files.'); |
|
1454
|
|
|
} else { |
|
1455
|
|
|
$this->colorCli->header(PHP_EOL.$updated.' releases could have their names changed. '.number_format($checked).' files were checked.'); |
|
1456
|
|
|
} |
|
1457
|
|
|
|
|
1458
|
|
|
return $updated; |
|
1459
|
|
|
} |
|
1460
|
|
|
|
|
1461
|
|
|
/** |
|
1462
|
|
|
* Check the array using regex for a clean name. |
|
1463
|
|
|
* |
|
1464
|
|
|
* @param $release |
|
1465
|
|
|
* @param bool $echo |
|
1466
|
|
|
* @param string $type |
|
1467
|
|
|
* @param int $nameStatus |
|
1468
|
|
|
* @param bool $show |
|
1469
|
|
|
* @param bool $preid |
|
1470
|
|
|
* |
|
1471
|
|
|
* @return bool |
|
1472
|
|
|
* @throws \Exception |
|
1473
|
|
|
*/ |
|
1474
|
|
|
public function checkName($release, $echo, $type, $nameStatus, $show, $preid = false): bool |
|
1475
|
|
|
{ |
|
1476
|
|
|
// Get pre style name from releases.name |
|
1477
|
|
|
if (preg_match_all(self::PREDB_REGEX, $release->textstring, $matches) && ! preg_match('/Source\s\:/i', $release->textstring)) { |
|
1478
|
|
|
foreach ($matches as $match) { |
|
1479
|
|
|
foreach ($match as $val) { |
|
1480
|
|
|
$title = Predb::query()->where('title', trim($val))->select(['title', 'id'])->first(); |
|
1481
|
|
|
if ($title !== null) { |
|
1482
|
|
|
$this->updateRelease($release, $title['title'], 'preDB: Match', $echo, $type, $nameStatus, $show, $title['id']); |
|
1483
|
|
|
$preid = true; |
|
1484
|
|
|
} |
|
1485
|
|
|
} |
|
1486
|
|
|
} |
|
1487
|
|
|
} |
|
1488
|
|
|
|
|
1489
|
|
|
// if only processing for PreDB match skip to return |
|
1490
|
|
|
if ($preid !== true) { |
|
1491
|
|
|
switch ($type) { |
|
1492
|
|
|
case 'PAR2, ': |
|
1493
|
|
|
$this->fileCheck($release, $echo, $type, $nameStatus, $show); |
|
1494
|
|
|
break; |
|
1495
|
|
|
case 'PAR2 hash, ': |
|
1496
|
|
|
$this->hashCheck($release, $echo, $type, $nameStatus, $show); |
|
1497
|
|
|
break; |
|
1498
|
|
|
case 'UID, ': |
|
1499
|
|
|
$this->uidCheck($release, $echo, $type, $nameStatus, $show); |
|
1500
|
|
|
break; |
|
1501
|
|
|
case 'Mediainfo, ': |
|
1502
|
|
|
$this->mediaMovieNameCheck($release, $echo, $type, $nameStatus, $show); |
|
1503
|
|
|
break; |
|
1504
|
|
|
case 'SRR, ': |
|
1505
|
|
|
$this->srrNameCheck($release, $echo, $type, $nameStatus, $show); |
|
1506
|
|
|
break; |
|
1507
|
|
|
case 'CRC32, ': |
|
1508
|
|
|
$this->crcCheck($release, $echo, $type, $nameStatus, $show); |
|
1509
|
|
|
break; |
|
1510
|
|
|
case 'NFO, ': |
|
1511
|
|
|
$this->nfoCheckTV($release, $echo, $type, $nameStatus, $show); |
|
1512
|
|
|
$this->nfoCheckMov($release, $echo, $type, $nameStatus, $show); |
|
1513
|
|
|
$this->nfoCheckMus($release, $echo, $type, $nameStatus, $show); |
|
1514
|
|
|
$this->nfoCheckTY($release, $echo, $type, $nameStatus, $show); |
|
1515
|
|
|
$this->nfoCheckG($release, $echo, $type, $nameStatus, $show); |
|
1516
|
|
|
break; |
|
1517
|
|
|
case 'Filenames, ': |
|
1518
|
|
|
$this->preDbFileCheck($release, $echo, $type, $nameStatus, $show); |
|
1519
|
|
|
$this->preDbTitleCheck($release, $echo, $type, $nameStatus, $show); |
|
1520
|
|
|
$this->fileCheck($release, $echo, $type, $nameStatus, $show); |
|
1521
|
|
|
break; |
|
1522
|
|
|
default: |
|
1523
|
|
|
$this->tvCheck($release, $echo, $type, $nameStatus, $show); |
|
1524
|
|
|
$this->movieCheck($release, $echo, $type, $nameStatus, $show); |
|
1525
|
|
|
$this->gameCheck($release, $echo, $type, $nameStatus, $show); |
|
1526
|
|
|
$this->appCheck($release, $echo, $type, $nameStatus, $show); |
|
1527
|
|
|
} |
|
1528
|
|
|
|
|
1529
|
|
|
// set NameFixer process flags after run |
|
1530
|
|
|
if ($nameStatus === 1 && $this->matched === false) { |
|
1531
|
|
|
switch ($type) { |
|
1532
|
|
|
case 'NFO, ': |
|
1533
|
|
|
$this->_updateSingleColumn('proc_nfo', self::PROC_NFO_DONE, $release->releases_id); |
|
1534
|
|
|
break; |
|
1535
|
|
|
case 'Filenames, ': |
|
1536
|
|
|
$this->_updateSingleColumn('proc_files', self::PROC_FILES_DONE, $release->releases_id); |
|
1537
|
|
|
break; |
|
1538
|
|
|
case 'PAR2, ': |
|
1539
|
|
|
$this->_updateSingleColumn('proc_par2', self::PROC_PAR2_DONE, $release->releases_id); |
|
1540
|
|
|
break; |
|
1541
|
|
|
case 'PAR2 hash, ': |
|
1542
|
|
|
$this->_updateSingleColumn('proc_hash16k', self::PROC_HASH16K_DONE, $release->releases_id); |
|
1543
|
|
|
break; |
|
1544
|
|
|
case 'SRR, ': |
|
1545
|
|
|
$this->_updateSingleColumn('proc_srr', self::PROC_SRR_DONE, $release->releases_id); |
|
1546
|
|
|
break; |
|
1547
|
|
|
case 'UID, ': |
|
1548
|
|
|
$this->_updateSingleColumn('proc_uid', self::PROC_UID_DONE, $release->releases_id); |
|
1549
|
|
|
break; |
|
1550
|
|
|
} |
|
1551
|
|
|
} |
|
1552
|
|
|
} |
|
1553
|
|
|
|
|
1554
|
|
|
return $this->matched; |
|
1555
|
|
|
} |
|
1556
|
|
|
|
|
1557
|
|
|
/** This function updates a single variable column in releases |
|
1558
|
|
|
* The first parameter is the column to update, the second is the value |
|
1559
|
|
|
* The final parameter is the ID of the release to update. |
|
1560
|
|
|
* |
|
1561
|
|
|
* @param string $column |
|
1562
|
|
|
* @param int $status |
|
1563
|
|
|
* @param int $id |
|
1564
|
|
|
*/ |
|
1565
|
|
|
public function _updateSingleColumn($column = '', $status = 0, $id = 0): void |
|
1566
|
|
|
{ |
|
1567
|
|
|
if ((string) $column !== '' && (int) $id !== 0) { |
|
1568
|
|
|
Release::query()->where('id', $id)->update([$column => $status]); |
|
1569
|
|
|
} |
|
1570
|
|
|
} |
|
1571
|
|
|
|
|
1572
|
|
|
/** |
|
1573
|
|
|
* Look for a TV name. |
|
1574
|
|
|
* |
|
1575
|
|
|
* @param $release |
|
1576
|
|
|
* @param bool $echo |
|
1577
|
|
|
* @param string $type |
|
1578
|
|
|
* @param $nameStatus |
|
1579
|
|
|
* @param $show |
|
1580
|
|
|
* @throws \Exception |
|
1581
|
|
|
*/ |
|
1582
|
|
|
public function tvCheck($release, $echo, $type, $nameStatus, $show): void |
|
1583
|
|
|
{ |
|
1584
|
|
|
$result = []; |
|
1585
|
|
|
|
|
1586
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1587
|
|
|
if (preg_match('/\w[-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|(?<!\d)[S|]\d{1,2}[E|x]\d{1,}(?!\d)|ep[._ -]?\d{2})[-\w.\',;.()]+(BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -][-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1588
|
|
|
$this->updateRelease($release, $result['0'], 'tvCheck: Title.SxxExx.Text.source.group', $echo, $type, $nameStatus, $show); |
|
1589
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[-\w.\',;& ]+((19|20)\d\d)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1590
|
|
|
$this->updateRelease($release, $result['0'], 'tvCheck: Title.SxxExx.Text.year.group', $echo, $type, $nameStatus, $show); |
|
1591
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[-\w.\',;& ]+(480|720|1080)[ip][._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1592
|
|
|
$this->updateRelease($release, $result['0'], 'tvCheck: Title.SxxExx.Text.resolution.source.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1593
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1594
|
|
|
$this->updateRelease($release, $result['0'], 'tvCheck: Title.SxxExx.source.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1595
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](480|720|1080)[ip][._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1596
|
|
|
$this->updateRelease($release, $result['0'], 'tvCheck: Title.SxxExx.acodec.source.res.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1597
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -]((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1598
|
|
|
$this->updateRelease($release, $result['0'], 'tvCheck: Title.year.###(season/episode).source.group', $echo, $type, $nameStatus, $show); |
|
1599
|
|
|
} elseif (preg_match('/\w(19|20)\d\d[._ -]\d{2}[._ -]\d{2}[._ -](IndyCar|NBA|NCW([TY])S|NNS|NSCS?)([._ -](19|20)\d\d)?[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1600
|
|
|
$this->updateRelease($release, $result['0'], 'tvCheck: Sports', $echo, $type, $nameStatus, $show); |
|
1601
|
|
|
} |
|
1602
|
|
|
} |
|
1603
|
|
|
} |
|
1604
|
|
|
|
|
1605
|
|
|
/** |
|
1606
|
|
|
* Look for a movie name. |
|
1607
|
|
|
* |
|
1608
|
|
|
* @param $release |
|
1609
|
|
|
* @param bool $echo |
|
1610
|
|
|
* @param string $type |
|
1611
|
|
|
* @param $nameStatus |
|
1612
|
|
|
* @param $show |
|
1613
|
|
|
* @throws \Exception |
|
1614
|
|
|
*/ |
|
1615
|
|
|
public function movieCheck($release, $echo, $type, $nameStatus, $show): void |
|
1616
|
|
|
{ |
|
1617
|
|
|
$result = []; |
|
1618
|
|
|
|
|
1619
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1620
|
|
|
if (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[-\w.\',;& ]+(480|720|1080)[ip][._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1621
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.Text.res.vcod.group', $echo, $type, $nameStatus, $show); |
|
1622
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[._ -](480|720|1080)[ip][-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1623
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.source.vcodec.res.group', $echo, $type, $nameStatus, $show); |
|
1624
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1625
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.source.vcodec.acodec.group', $echo, $type, $nameStatus, $show); |
|
1626
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+(Brazilian|Chinese|Croatian|Danish|Deutsch|Dutch|Estonian|English|Finnish|Flemish|Francais|French|German|Greek|Hebrew|Icelandic|Italian|Japenese|Japan|Japanese|Korean|Latin|Nordic|Norwegian|Polish|Portuguese|Russian|Serbian|Slovenian|Swedish|Spanisch|Spanish|Thai|Turkish)[._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1627
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.language.acodec.source.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1628
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -](480|720|1080)[ip][._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1629
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.resolution.source.acodec.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1630
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -](480|720|1080)[ip][._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1631
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.resolution.source.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1632
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](480|720|1080)[ip][._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1633
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.source.resolution.acodec.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1634
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -](480|720|1080)[ip][._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1635
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.resolution.acodec.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1636
|
|
|
} elseif (preg_match('/[-\w.\',;& ]+((19|20)\d\d)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BR(RIP)?|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](480|720|1080)[ip][._ -][-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1637
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.source.res.group', $echo, $type, $nameStatus, $show); |
|
1638
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+((19|20)\d\d)[._ -][-\w.\',;& ]+[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BR(RIP)?|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1639
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.year.eptitle.source.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1640
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+(480|720|1080)[ip][._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1641
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.resolution.source.acodec.vcodec.group', $echo, $type, $nameStatus, $show); |
|
1642
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+(480|720|1080)[ip][._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[-\w.\',;& ]+(BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -]((19|20)\d\d)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1643
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.resolution.acodec.eptitle.source.year.group', $echo, $type, $nameStatus, $show); |
|
1644
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+(Brazilian|Chinese|Croatian|Danish|Deutsch|Dutch|Estonian|English|Finnish|Flemish|Francais|French|German|Greek|Hebrew|Icelandic|Italian|Japenese|Japan|Japanese|Korean|Latin|Nordic|Norwegian|Polish|Portuguese|Russian|Serbian|Slovenian|Swedish|Spanisch|Spanish|Thai|Turkish)[._ -]((19|20)\d\d)[._ -](AAC( LC)?|AC-?3|DD5([._ -]1)?|(A_)?DTS-?(HD)?|Dolby( ?TrueHD)?|MP3|TrueHD)[._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1645
|
|
|
$this->updateRelease($release, $result['0'], 'movieCheck: Title.language.year.acodec.src', $echo, $type, $nameStatus, $show); |
|
1646
|
|
|
} |
|
1647
|
|
|
} |
|
1648
|
|
|
} |
|
1649
|
|
|
|
|
1650
|
|
|
/** |
|
1651
|
|
|
* Look for a game name. |
|
1652
|
|
|
* |
|
1653
|
|
|
* @param $release |
|
1654
|
|
|
* @param bool $echo |
|
1655
|
|
|
* @param string $type |
|
1656
|
|
|
* @param $nameStatus |
|
1657
|
|
|
* @param $show |
|
1658
|
|
|
* @throws \Exception |
|
1659
|
|
|
*/ |
|
1660
|
|
|
public function gameCheck($release, $echo, $type, $nameStatus, $show): void |
|
1661
|
|
|
{ |
|
1662
|
|
|
$result = []; |
|
1663
|
|
|
|
|
1664
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1665
|
|
|
if (preg_match('/\w[-\w.\',;& ]+(ASIA|DLC|EUR|GOTY|JPN|KOR|MULTI\d{1}|NTSCU?|PAL|RF|Region[._ -]?Free|USA|XBLA)[._ -](DLC[._ -]Complete|FRENCH|GERMAN|MULTI\d{1}|PROPER|PSN|READ[._ -]?NFO|UMD)?[._ -]?(GC|NDS|NGC|PS3|PSP|WII|XBOX(360)?)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1666
|
|
|
$this->updateRelease($release, $result['0'], 'gameCheck: Videogames 1', $echo, $type, $nameStatus, $show); |
|
1667
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+(GC|NDS|NGC|PS3|WII|XBOX(360)?)[._ -](DUPLEX|iNSOMNi|OneUp|STRANGE|SWAG|SKY)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1668
|
|
|
$this->updateRelease($release, $result['0'], 'gameCheck: Videogames 2', $echo, $type, $nameStatus, $show); |
|
1669
|
|
|
} elseif (preg_match('/\w[\w.\',;-].+-OUTLAWS/i', $release->textstring, $result)) { |
|
1670
|
|
|
$result = str_replace('OUTLAWS', 'PC GAME OUTLAWS', $result['0']); |
|
1671
|
|
|
$this->updateRelease($release, $result['0'], 'gameCheck: PC Games -OUTLAWS', $echo, $type, $nameStatus, $show); |
|
1672
|
|
|
} elseif (preg_match('/\w[\w.\',;-].+\-ALiAS/i', $release->textstring, $result)) { |
|
1673
|
|
|
$newresult = str_replace('-ALiAS', ' PC GAME ALiAS', $result['0']); |
|
1674
|
|
|
$this->updateRelease($release, $newresult, 'gameCheck: PC Games -ALiAS', $echo, $type, $nameStatus, $show); |
|
1675
|
|
|
} |
|
1676
|
|
|
} |
|
1677
|
|
|
} |
|
1678
|
|
|
|
|
1679
|
|
|
/** |
|
1680
|
|
|
* Look for a app name. |
|
1681
|
|
|
* |
|
1682
|
|
|
* @param $release |
|
1683
|
|
|
* @param bool $echo |
|
1684
|
|
|
* @param string $type |
|
1685
|
|
|
* @param $nameStatus |
|
1686
|
|
|
* @param $show |
|
1687
|
|
|
* @throws \Exception |
|
1688
|
|
|
*/ |
|
1689
|
|
|
public function appCheck($release, $echo, $type, $nameStatus, $show): void |
|
1690
|
|
|
{ |
|
1691
|
|
|
$result = []; |
|
1692
|
|
|
|
|
1693
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1694
|
|
|
if (preg_match('/\w[-\w.\',;& ]+(\d{1,10}|Linux|UNIX)[._ -](RPM)?[._ -]?(X64)?[._ -]?(Incl)[._ -](Keygen)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1695
|
|
|
$this->updateRelease($release, $result['0'], 'appCheck: Apps 1', $echo, $type, $nameStatus, $show); |
|
1696
|
|
|
} elseif (preg_match('/\w[-\w.\',;& ]+\d{1,8}[._ -](winall-freeware)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1697
|
|
|
$this->updateRelease($release, $result['0'], 'appCheck: Apps 2', $echo, $type, $nameStatus, $show); |
|
1698
|
|
|
} |
|
1699
|
|
|
} |
|
1700
|
|
|
} |
|
1701
|
|
|
|
|
1702
|
|
|
/** |
|
1703
|
|
|
* TV. |
|
1704
|
|
|
* |
|
1705
|
|
|
* @param $release |
|
1706
|
|
|
* @param bool $echo |
|
1707
|
|
|
* @param string $type |
|
1708
|
|
|
* @param $nameStatus |
|
1709
|
|
|
* @param $show |
|
1710
|
|
|
* @throws \Exception |
|
1711
|
|
|
*/ |
|
1712
|
|
|
public function nfoCheckTV($release, $echo, $type, $nameStatus, $show): void |
|
1713
|
|
|
{ |
|
1714
|
|
|
$result = []; |
|
1715
|
|
|
|
|
1716
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1717
|
|
|
if (preg_match('/:\s*.*[\\\\\/]([A-Z0-9].+?S\d+[.-_ ]?[ED]\d+.+?)\.\w{2,}\s+/i', $release->textstring, $result)) { |
|
1718
|
|
|
$this->updateRelease($release, $result['1'], 'nfoCheck: Generic TV 1', $echo, $type, $nameStatus, $show); |
|
1719
|
|
|
} elseif (preg_match('/(?:(\:\s{1,}))(.+?S\d{1,3}[.-_ ]?[ED]\d{1,3}.+?)(\s{2,}|\r|\n)/i', $release->textstring, $result)) { |
|
1720
|
|
|
$this->updateRelease($release, $result['2'], 'nfoCheck: Generic TV 2', $echo, $type, $nameStatus, $show); |
|
1721
|
|
|
} |
|
1722
|
|
|
} |
|
1723
|
|
|
} |
|
1724
|
|
|
|
|
1725
|
|
|
/** |
|
1726
|
|
|
* Movies. |
|
1727
|
|
|
* |
|
1728
|
|
|
* @param $release |
|
1729
|
|
|
* @param bool $echo |
|
1730
|
|
|
* @param string $type |
|
1731
|
|
|
* @param $nameStatus |
|
1732
|
|
|
* @param $show |
|
1733
|
|
|
* @throws \Exception |
|
1734
|
|
|
*/ |
|
1735
|
|
|
public function nfoCheckMov($release, $echo, $type, $nameStatus, $show): void |
|
1736
|
|
|
{ |
|
1737
|
|
|
$result = []; |
|
1738
|
|
|
|
|
1739
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1740
|
|
|
if (preg_match('/(?:((?!Source\s)\:\s{1,}))(.+?(19|20)\d\d.+?(BDRip|bluray|DVD(R|Rip)?|XVID).+?)(\s{2,}|\r|\n)/i', $release->textstring, $result)) { |
|
1741
|
|
|
$this->updateRelease($release, $result['2'], 'nfoCheck: Generic Movies 1', $echo, $type, $nameStatus, $show); |
|
1742
|
|
|
} elseif (preg_match('/(?:(\s{2,}))((?!Source).+?[\.\-_ ](19|20)\d\d.+?(BDRip|bluray|DVD(R|Rip)?|XVID).+?)(\s{2,}|\r|\n)/i', $release->textstring, $result)) { |
|
1743
|
|
|
$this->updateRelease($release, $result['2'], 'nfoCheck: Generic Movies 2', $echo, $type, $nameStatus, $show); |
|
1744
|
|
|
} elseif (preg_match('/(?:(\s{2,}))(.+?[\.\-_ ](NTSC|MULTi).+?(MULTi|DVDR)[\.\-_ ].+?)(\s{2,}|\r|\n)/i', $release->textstring, $result)) { |
|
1745
|
|
|
$this->updateRelease($release, $result['2'], 'nfoCheck: Generic Movies 3', $echo, $type, $nameStatus, $show); |
|
1746
|
|
|
} |
|
1747
|
|
|
} |
|
1748
|
|
|
} |
|
1749
|
|
|
|
|
1750
|
|
|
/** |
|
1751
|
|
|
* @param $release |
|
1752
|
|
|
* @param bool $echo |
|
1753
|
|
|
* @param string $type |
|
1754
|
|
|
* @param $nameStatus |
|
1755
|
|
|
* @param $show |
|
1756
|
|
|
* @throws \Exception |
|
1757
|
|
|
*/ |
|
1758
|
|
|
public function nfoCheckMus($release, $echo, $type, $nameStatus, $show): void |
|
1759
|
|
|
{ |
|
1760
|
|
|
$result = []; |
|
1761
|
|
|
|
|
1762
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id && preg_match('/(?:\s{2,})(.+?-FM-\d{2}-\d{2})/i', $release->textstring, $result)) { |
|
1763
|
|
|
$newname = str_replace('-FM-', '-FM-Radio-MP3-', $result['1']); |
|
1764
|
|
|
$this->updateRelease($release, $newname, 'nfoCheck: Music FM RADIO', $echo, $type, $nameStatus, $show); |
|
1765
|
|
|
} |
|
1766
|
|
|
} |
|
1767
|
|
|
|
|
1768
|
|
|
/** |
|
1769
|
|
|
* Title (year). |
|
1770
|
|
|
* |
|
1771
|
|
|
* @param $release |
|
1772
|
|
|
* @param bool $echo |
|
1773
|
|
|
* @param string $type |
|
1774
|
|
|
* @param $nameStatus |
|
1775
|
|
|
* @param $show |
|
1776
|
|
|
* @throws \Exception |
|
1777
|
|
|
*/ |
|
1778
|
|
|
public function nfoCheckTY($release, $echo, $type, $nameStatus, $show): void |
|
1779
|
|
|
{ |
|
1780
|
|
|
$result = []; |
|
1781
|
|
|
|
|
1782
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id && preg_match('/(\w[-\w`~!@#$%^&*()_+={}|"<>?\[\]\\;\',.\/ ]+\s?\((19|20)\d\d\))/i', $release->textstring, $result) && ! preg_match('/\.pdf|Audio ?Book/i', $release->textstring)) { |
|
1783
|
|
|
$releaseName = $result[0]; |
|
1784
|
|
|
if (preg_match('/(idiomas|lang|language|langue|sprache).*?\b(?P<lang>Brazilian|Chinese|Croatian|Danish|DE|Deutsch|Dutch|Estonian|ES|English|Englisch|Finnish|Flemish|Francais|French|FR|German|Greek|Hebrew|Icelandic|Italian|Japenese|Japan|Japanese|Korean|Latin|Nordic|Norwegian|Polish|Portuguese|Russian|Serbian|Slovenian|Swedish|Spanisch|Spanish|Thai|Turkish)\b/i', $release->textstring, $result)) { |
|
1785
|
|
|
switch ($result['lang']) { |
|
1786
|
|
|
case 'DE': |
|
1787
|
|
|
$result['lang'] = 'DUTCH'; |
|
1788
|
|
|
break; |
|
1789
|
|
|
case 'Englisch': |
|
1790
|
|
|
$result['lang'] = 'ENGLISH'; |
|
1791
|
|
|
break; |
|
1792
|
|
|
case 'FR': |
|
1793
|
|
|
$result['lang'] = 'FRENCH'; |
|
1794
|
|
|
break; |
|
1795
|
|
|
case 'ES': |
|
1796
|
|
|
$result['lang'] = 'SPANISH'; |
|
1797
|
|
|
break; |
|
1798
|
|
|
default: |
|
1799
|
|
|
break; |
|
1800
|
|
|
} |
|
1801
|
|
|
$releaseName = $releaseName.'.'.$result['lang']; |
|
1802
|
|
|
} |
|
1803
|
|
|
|
|
1804
|
|
|
if (preg_match('/(frame size|(video )?res(olution)?|video).*?(?P<res>(272|336|480|494|528|608|\(?640|688|704|720x480|810|816|820|1 ?080|1280( \@)?|1 ?920(x1080)?))/i', $release->textstring, $result)) { |
|
1805
|
|
|
switch ($result['res']) { |
|
1806
|
|
|
case '272': |
|
1807
|
|
|
case '336': |
|
1808
|
|
|
case '480': |
|
1809
|
|
|
case '494': |
|
1810
|
|
|
case '608': |
|
1811
|
|
|
case '640': |
|
1812
|
|
|
case '(640': |
|
1813
|
|
|
case '688': |
|
1814
|
|
|
case '704': |
|
1815
|
|
|
case '720x480': |
|
1816
|
|
|
$result['res'] = '480p'; |
|
1817
|
|
|
break; |
|
1818
|
|
|
case '1280x720': |
|
1819
|
|
|
case '1280': |
|
1820
|
|
|
case '1280 @': |
|
1821
|
|
|
$result['res'] = '720p'; |
|
1822
|
|
|
break; |
|
1823
|
|
|
case '810': |
|
1824
|
|
|
case '816': |
|
1825
|
|
|
case '820': |
|
1826
|
|
|
case '1920': |
|
1827
|
|
|
case '1 920': |
|
1828
|
|
|
case '1080': |
|
1829
|
|
|
case '1 080': |
|
1830
|
|
|
case '1920x1080': |
|
1831
|
|
|
$result['res'] = '1080p'; |
|
1832
|
|
|
break; |
|
1833
|
|
|
case '2160': |
|
1834
|
|
|
$result['res'] = '2160p'; |
|
1835
|
|
|
break; |
|
1836
|
|
|
} |
|
1837
|
|
|
|
|
1838
|
|
|
$releaseName = $releaseName.'.'.$result['res']; |
|
1839
|
|
|
} elseif (preg_match('/(largeur|width).*?(?P<res>(\(?640|688|704|720|1280( \@)?|1 ?920))/i', $release->textstring, $result)) { |
|
1840
|
|
|
switch ($result['res']) { |
|
1841
|
|
|
case '640': |
|
1842
|
|
|
case '(640': |
|
1843
|
|
|
case '688': |
|
1844
|
|
|
case '704': |
|
1845
|
|
|
case '720': |
|
1846
|
|
|
$result['res'] = '480p'; |
|
1847
|
|
|
break; |
|
1848
|
|
|
case '1280 @': |
|
1849
|
|
|
case '1280': |
|
1850
|
|
|
$result['res'] = '720p'; |
|
1851
|
|
|
break; |
|
1852
|
|
|
case '1920': |
|
1853
|
|
|
case '1 920': |
|
1854
|
|
|
$result['res'] = '1080p'; |
|
1855
|
|
|
break; |
|
1856
|
|
|
case '2160': |
|
1857
|
|
|
$result['res'] = '2160p'; |
|
1858
|
|
|
break; |
|
1859
|
|
|
} |
|
1860
|
|
|
|
|
1861
|
|
|
$releaseName = $releaseName.'.'.$result['res']; |
|
1862
|
|
|
} |
|
1863
|
|
|
|
|
1864
|
|
|
if (preg_match('/source.*?\b(?P<source>BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)\b/i', $release->textstring, $result)) { |
|
1865
|
|
|
switch ($result['source']) { |
|
1866
|
|
|
case 'BD': |
|
1867
|
|
|
$result['source'] = 'Bluray.x264'; |
|
1868
|
|
|
break; |
|
1869
|
|
|
case 'CAMRIP': |
|
1870
|
|
|
$result['source'] = 'CAM'; |
|
1871
|
|
|
break; |
|
1872
|
|
|
case 'DBrip': |
|
1873
|
|
|
$result['source'] = 'BDRIP'; |
|
1874
|
|
|
break; |
|
1875
|
|
|
case 'DVD R1': |
|
1876
|
|
|
case 'NTSC': |
|
1877
|
|
|
case 'PAL': |
|
1878
|
|
|
case 'VOD': |
|
1879
|
|
|
$result['source'] = 'DVD'; |
|
1880
|
|
|
break; |
|
1881
|
|
|
case 'HD': |
|
1882
|
|
|
$result['source'] = 'HDTV'; |
|
1883
|
|
|
break; |
|
1884
|
|
|
case 'Ripped ': |
|
1885
|
|
|
$result['source'] = 'DVDRIP'; |
|
1886
|
|
|
} |
|
1887
|
|
|
|
|
1888
|
|
|
$releaseName = $releaseName.'.'.$result['source']; |
|
1889
|
|
|
} elseif (preg_match('/(codec( (name|code))?|(original )?format|res(olution)|video( (codec|format|res))?|tv system|type|writing library).*?\b(?P<video>AVC|AVI|DBrip|DIVX|\(Divx|DVD|[HX][._ -]?264|MPEG-4 Visual|NTSC|PAL|WMV|XVID)\b/i', $release->textstring, $result)) { |
|
1890
|
|
|
switch ($result['video']) { |
|
1891
|
|
|
case 'AVI': |
|
1892
|
|
|
$result['video'] = 'DVDRIP'; |
|
1893
|
|
|
break; |
|
1894
|
|
|
case 'DBrip': |
|
1895
|
|
|
$result['video'] = 'BDRIP'; |
|
1896
|
|
|
break; |
|
1897
|
|
|
case '(Divx': |
|
1898
|
|
|
$result['video'] = 'DIVX'; |
|
1899
|
|
|
break; |
|
1900
|
|
|
case 'h264': |
|
1901
|
|
|
case 'h-264': |
|
1902
|
|
|
case 'h.264': |
|
1903
|
|
|
$result['video'] = 'H264'; |
|
1904
|
|
|
break; |
|
1905
|
|
|
case 'MPEG-4 Visual': |
|
1906
|
|
|
case 'x264': |
|
1907
|
|
|
case 'x-264': |
|
1908
|
|
|
case 'x.264': |
|
1909
|
|
|
$result['video'] = 'x264'; |
|
1910
|
|
|
break; |
|
1911
|
|
|
case 'NTSC': |
|
1912
|
|
|
case 'PAL': |
|
1913
|
|
|
$result['video'] = 'DVD'; |
|
1914
|
|
|
break; |
|
1915
|
|
|
} |
|
1916
|
|
|
|
|
1917
|
|
|
$releaseName = $releaseName.'.'.$result['video']; |
|
1918
|
|
|
} |
|
1919
|
|
|
|
|
1920
|
|
|
if (preg_match('/(audio( format)?|codec( name)?|format).*?\b(?P<audio>0x0055 MPEG-1 Layer 3|AAC( LC)?|AC-?3|\(AC3|DD5(.1)?|(A_)?DTS-?(HD)?|Dolby(\s?TrueHD)?|TrueHD|FLAC|MP3)\b/i', $release->textstring, $result)) { |
|
1921
|
|
|
switch ($result['audio']) { |
|
1922
|
|
|
case '0x0055 MPEG-1 Layer 3': |
|
1923
|
|
|
$result['audio'] = 'MP3'; |
|
1924
|
|
|
break; |
|
1925
|
|
|
case 'AC-3': |
|
1926
|
|
|
case '(AC3': |
|
1927
|
|
|
$result['audio'] = 'AC3'; |
|
1928
|
|
|
break; |
|
1929
|
|
|
case 'AAC LC': |
|
1930
|
|
|
$result['audio'] = 'AAC'; |
|
1931
|
|
|
break; |
|
1932
|
|
|
case 'A_DTS': |
|
1933
|
|
|
case 'DTS-HD': |
|
1934
|
|
|
case 'DTSHD': |
|
1935
|
|
|
$result['audio'] = 'DTS'; |
|
1936
|
|
|
} |
|
1937
|
|
|
$releaseName = $releaseName.'.'.$result['audio']; |
|
1938
|
|
|
} |
|
1939
|
|
|
$releaseName .= '-NoGroup'; |
|
1940
|
|
|
$this->updateRelease($release, $releaseName, 'nfoCheck: Title (Year)', $echo, $type, $nameStatus, $show); |
|
1941
|
|
|
} |
|
1942
|
|
|
} |
|
1943
|
|
|
|
|
1944
|
|
|
/** |
|
1945
|
|
|
* Games. |
|
1946
|
|
|
* |
|
1947
|
|
|
* @param $release |
|
1948
|
|
|
* @param bool $echo |
|
1949
|
|
|
* @param string $type |
|
1950
|
|
|
* @param $nameStatus |
|
1951
|
|
|
* @param $show |
|
1952
|
|
|
* @throws \Exception |
|
1953
|
|
|
*/ |
|
1954
|
|
|
public function nfoCheckG($release, $echo, $type, $nameStatus, $show): void |
|
1955
|
|
|
{ |
|
1956
|
|
|
$result = []; |
|
1957
|
|
|
|
|
1958
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1959
|
|
|
if (preg_match('/ALiAS|BAT-TEAM|FAiRLiGHT|Game Type|Glamoury|HI2U|iTWINS|JAGUAR|(LARGE|MEDIUM)ISO|MAZE|nERv|PROPHET|PROFiT|PROCYON|RELOADED|REVOLVER|ROGUE|ViTALiTY/i', $release->textstring)) { |
|
1960
|
|
|
if (preg_match('/\w[\w.+&*\/\()\',;: -]+\(c\)[-\w.\',;& ]+\w/i', $release->textstring, $result)) { |
|
1961
|
|
|
$releaseName = str_replace(['(c)', '(C)'], '(GAMES) (c)', $result['0']); |
|
1962
|
|
|
$this->updateRelease($release, $releaseName, 'nfoCheck: PC Games (c)', $echo, $type, $nameStatus, $show); |
|
1963
|
|
|
} elseif (preg_match('/\w[\w.+&*\/()\',;: -]+\*ISO\*/i', $release->textstring, $result)) { |
|
1964
|
|
|
$releaseName = str_replace('*ISO*', '*ISO* (PC GAMES)', $result['0']); |
|
1965
|
|
|
$this->updateRelease($release, $releaseName, 'nfoCheck: PC Games *ISO*', $echo, $type, $nameStatus, $show); |
|
1966
|
|
|
} |
|
1967
|
|
|
} |
|
1968
|
|
|
} |
|
1969
|
|
|
} |
|
1970
|
|
|
|
|
1971
|
|
|
// |
|
1972
|
|
|
|
|
1973
|
|
|
/** |
|
1974
|
|
|
* Misc. |
|
1975
|
|
|
* |
|
1976
|
|
|
* @param $release |
|
1977
|
|
|
* @param bool $echo |
|
1978
|
|
|
* @param string $type |
|
1979
|
|
|
* @param $nameStatus |
|
1980
|
|
|
* @param $show |
|
1981
|
|
|
* @throws \Exception |
|
1982
|
|
|
*/ |
|
1983
|
|
|
public function nfoCheckMisc($release, $echo, $type, $nameStatus, $show): void |
|
1984
|
|
|
{ |
|
1985
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
1986
|
|
|
if (preg_match('/Supplier.+?IGUANA/i', $release->textstring)) { |
|
1987
|
|
|
$releaseName = ''; |
|
1988
|
|
|
$result = []; |
|
1989
|
|
|
if (preg_match('/\w[-\w`~!@#$%^&*()+={}|:"<>?\[\]\\;\',.\/ ]+\s\((19|20)\d\d\)/i', $release->textstring, $result)) { |
|
1990
|
|
|
$releaseName = $result[0]; |
|
1991
|
|
|
} elseif (preg_match('/\s\[\*\] (English|Dutch|French|German|Spanish)\b/i', $release->textstring, $result)) { |
|
1992
|
|
|
$releaseName = $releaseName.'.'.$result[1]; |
|
1993
|
|
|
} elseif (preg_match('/\s\[\*\] (DT?S [2567][._ -][0-2]( MONO)?)\b/i', $release->textstring, $result)) { |
|
1994
|
|
|
$releaseName = $releaseName.'.'.$result[2]; |
|
1995
|
|
|
} elseif (preg_match('/Format.+(DVD([59R])?|[HX][._ -]?264)\b/i', $release->textstring, $result)) { |
|
1996
|
|
|
$releaseName = $releaseName.'.'.$result[1]; |
|
1997
|
|
|
} elseif (preg_match('/\[(640x.+|1280x.+|1920x.+)\] Resolution\b/i', $release->textstring, $result)) { |
|
1998
|
|
|
if ($result[1] === '640x.+') { |
|
1999
|
|
|
$result[1] = '480p'; |
|
2000
|
|
|
} elseif ($result[1] === '1280x.+') { |
|
2001
|
|
|
$result[1] = '720p'; |
|
2002
|
|
|
} elseif ($result[1] === '1920x.+') { |
|
2003
|
|
|
$result[1] = '1080p'; |
|
2004
|
|
|
} |
|
2005
|
|
|
$releaseName = $releaseName.'.'.$result[1]; |
|
2006
|
|
|
} |
|
2007
|
|
|
$result = $releaseName.'.IGUANA'; |
|
2008
|
|
|
$this->updateRelease($release, $result, 'nfoCheck: IGUANA', $echo, $type, $nameStatus, $show); |
|
2009
|
|
|
} |
|
2010
|
|
|
} |
|
2011
|
|
|
} |
|
2012
|
|
|
|
|
2013
|
|
|
/** |
|
2014
|
|
|
* Just for filenames. |
|
2015
|
|
|
* |
|
2016
|
|
|
* @param $release |
|
2017
|
|
|
* @param bool $echo |
|
2018
|
|
|
* @param string $type |
|
2019
|
|
|
* @param $nameStatus |
|
2020
|
|
|
* @param $show |
|
2021
|
|
|
* |
|
2022
|
|
|
* @return bool |
|
2023
|
|
|
* @throws \Exception |
|
2024
|
|
|
*/ |
|
2025
|
|
|
public function fileCheck($release, $echo, $type, $nameStatus, $show): bool |
|
2026
|
|
|
{ |
|
2027
|
|
|
$result = []; |
|
2028
|
|
|
|
|
2029
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
2030
|
|
|
switch (true) { |
|
|
|
|
|
|
2031
|
|
|
case preg_match('/^(.+?(x264|XviD)\-TVP)\\\\/i', $release->textstring, $result): |
|
2032
|
|
|
$this->updateRelease($release, $result['1'], 'fileCheck: TVP', $echo, $type, $nameStatus, $show); |
|
2033
|
|
|
break; |
|
2034
|
|
|
case preg_match('/^(\\\\|\/)?(.+(\\\\|\/))*(.+?S\d{1,3}[.-_ ]?[ED]\d{1,3}.+)\.(.+)$/i', $release->textstring, $result): |
|
2035
|
|
|
$this->updateRelease($release, $result['4'], 'fileCheck: Generic TV', $echo, $type, $nameStatus, $show); |
|
2036
|
|
|
break; |
|
2037
|
|
|
case preg_match('/^(\\\\|\/)?(.+(\\\\|\/))*(.+?([\.\-_ ]\d{4}[\.\-_ ].+?(BDRip|bluray|DVDRip|XVID)).+)\.(.+)$/i', $release->textstring, $result): |
|
2038
|
|
|
$this->updateRelease($release, $result['4'], 'fileCheck: Generic movie 1', $echo, $type, $nameStatus, $show); |
|
2039
|
|
|
break; |
|
2040
|
|
|
case preg_match('/^([a-z0-9\.\-_]+(19|20)\d\d[a-z0-9\.\-_]+[\.\-_ ](720p|1080p|BDRip|bluray|DVDRip|x264|XviD)[a-z0-9\.\-_]+)\.[a-z]{2,}$/i', $release->textstring, $result): |
|
2041
|
|
|
$this->updateRelease($release, $result['1'], 'fileCheck: Generic movie 2', $echo, $type, $nameStatus, $show); |
|
2042
|
|
|
break; |
|
2043
|
|
|
case preg_match('/(.+?([\.\-_ ](CD|FM)|[\.\-_ ]\dCD|CDR|FLAC|SAT|WEB).+?(19|20)\d\d.+?)\\\\.+/i', $release->textstring, $result): |
|
2044
|
|
|
$this->updateRelease($release, $result['1'], 'fileCheck: Generic music', $echo, $type, $nameStatus, $show); |
|
2045
|
|
|
break; |
|
2046
|
|
|
case preg_match('/^(.+?(19|20)\d\d\-([a-z0-9]{3}|[a-z]{2,}|C4))\\\\/i', $release->textstring, $result): |
|
2047
|
|
|
$this->updateRelease($release, $result['1'], 'fileCheck: music groups', $echo, $type, $nameStatus, $show); |
|
2048
|
|
|
break; |
|
2049
|
|
|
case preg_match('/.+\\\\(.+\((19|20)\d\d\)\.avi)$/i', $release->textstring, $result): |
|
2050
|
|
|
$newname = str_replace('.avi', ' DVDRip XVID NoGroup', $result['1']); |
|
2051
|
|
|
$this->updateRelease($release, $newname, 'fileCheck: Movie (year) avi', $echo, $type, $nameStatus, $show); |
|
2052
|
|
|
break; |
|
2053
|
|
|
case preg_match('/.+\\\\(.+\((19|20)\d\d\)\.iso)$/i', $release->textstring, $result): |
|
2054
|
|
|
$newname = str_replace('.iso', ' DVD NoGroup', $result['1']); |
|
2055
|
|
|
$this->updateRelease($release, $newname, 'fileCheck: Movie (year) iso', $echo, $type, $nameStatus, $show); |
|
2056
|
|
|
break; |
|
2057
|
|
|
case preg_match('/^(.+?IMAGESET.+?)\\\\.+/i', $release->textstring, $result): |
|
2058
|
|
|
$this->updateRelease($release, $result['1'], 'fileCheck: XXX Imagesets', $echo, $type, $nameStatus, $show); |
|
2059
|
|
|
break; |
|
2060
|
|
|
case preg_match('/^VIDEOOT-[A-Z0-9]+\\\\([\w!.,& ()\[\]\'\`-]{8,}?\b.?)([-_](proof|sample|thumbs?))*(\.part\d*(\.rar)?|\.rar|\.7z)?(\d{1,3}\.rev|\.vol.+?|\.mp4)/', $release->textstring, $result): |
|
2061
|
|
|
$this->updateRelease($release, $result['1'].' XXX DVDRIP XviD-VIDEOOT', 'fileCheck: XXX XviD VIDEOOT', $echo, $type, $nameStatus, $show); |
|
2062
|
|
|
break; |
|
2063
|
|
|
case preg_match('/^.+?SDPORN/i', $release->textstring, $result): |
|
2064
|
|
|
$this->updateRelease($release, $result['0'], 'fileCheck: XXX SDPORN', $echo, $type, $nameStatus, $show); |
|
2065
|
|
|
break; |
|
2066
|
|
|
case preg_match('/\w[-\w.\',;& ]+1080i[._ -]DD5[._ -]1[._ -]MPEG2-R&C(?=\.ts)$/i', $release->textstring, $result): |
|
2067
|
|
|
$result = str_replace('MPEG2', 'MPEG2.HDTV', $result['0']); |
|
2068
|
|
|
$this->updateRelease($release, $result, 'fileCheck: R&C', $echo, $type, $nameStatus, $show); |
|
2069
|
|
|
break; |
|
2070
|
|
|
case preg_match('/\w[-\w.\',;& ]+((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[._ -](480|720|1080)[ip][._ -](BD(-?(25|50|RIP))?|Blu-?Ray ?(3D)?|BRRIP|CAM(RIP)?|DBrip|DTV|DVD\-?(5|9|(R(IP)?|scr(eener)?))?|[HPS]D?(RIP|TV(RIP)?)?|NTSC|PAL|R5|Ripped |S?VCD|scr(eener)?|SAT(RIP)?|TS|VHS(RIP)?|VOD|WEB-DL)[._ -]nSD[._ -](DivX|[HX][._ -]?264|MPEG2|XviD(HD)?|WMV)[._ -]NhaNC3[-\w.\',;& ]+\w/i', $release->textstring, $result): |
|
2071
|
|
|
$this->updateRelease($release, $result['0'], 'fileCheck: NhaNc3', $echo, $type, $nameStatus, $show); |
|
2072
|
|
|
break; |
|
2073
|
|
|
case preg_match('/\wtvp-[\w.\-\',;]+((s\d{1,2}[._ -]?[bde]\d{1,2})|\d{1,2}x\d{2}|ep[._ -]?\d{2})[._ -](720p|1080p|xvid)(?=\.(avi|mkv))$/i', $release->textstring, $result): |
|
2074
|
|
|
$result = str_replace('720p', '720p.HDTV.X264', $result['0']); |
|
2075
|
|
|
$result = str_replace('1080p', '1080p.Bluray.X264', $result['0']); |
|
2076
|
|
|
$result = str_replace('xvid', 'XVID.DVDrip', $result['0']); |
|
2077
|
|
|
$this->updateRelease($release, $result, 'fileCheck: tvp', $echo, $type, $nameStatus, $show); |
|
2078
|
|
|
break; |
|
2079
|
|
|
case preg_match('/\w[-\w.\',;& ]+\d{3,4}\.hdtv-lol\.(avi|mp4|mkv|ts|nfo|nzb)/i', $release->textstring, $result): |
|
2080
|
|
|
$this->updateRelease($release, $result['0'], 'fileCheck: Title.211.hdtv-lol.extension', $echo, $type, $nameStatus, $show); |
|
2081
|
|
|
break; |
|
2082
|
|
|
case preg_match('/\w[-\w.\',;& ]+-S\d{1,2}[EX]\d{1,2}-XVID-DL.avi/i', $release->textstring, $result): |
|
2083
|
|
|
$this->updateRelease($release, $result['0'], 'fileCheck: Title-SxxExx-XVID-DL.avi', $echo, $type, $nameStatus, $show); |
|
2084
|
|
|
break; |
|
2085
|
|
|
case preg_match('/\S.*[\w.\-\',;]+\s\-\ss\d{2}[ex]\d{2}\s\-\s[\w.\-\',;].+\./i', $release->textstring, $result): |
|
2086
|
|
|
$this->updateRelease($release, $result['0'], 'fileCheck: Title - SxxExx - Eptitle', $echo, $type, $nameStatus, $show); |
|
2087
|
|
|
break; |
|
2088
|
|
|
case preg_match('/\w.+?\)\.nds$/i', $release->textstring, $result): |
|
2089
|
|
|
$this->updateRelease($release, $result['0'], 'fileCheck: ).nds Nintendo DS', $echo, $type, $nameStatus, $show); |
|
2090
|
|
|
break; |
|
2091
|
|
|
case preg_match('/3DS_\d{4}.+\d{4} - (.+?)\.3ds/i', $release->textstring, $result): |
|
2092
|
|
|
$this->updateRelease($release, '3DS '.$result['1'], 'fileCheck: .3ds Nintendo 3DS', $echo, $type, $nameStatus, $show); |
|
2093
|
|
|
break; |
|
2094
|
|
|
case preg_match('/\w.+?\.(epub|mobi|azw|opf|fb2|prc|djvu|cb[rz])/i', $release->textstring, $result): |
|
2095
|
|
|
$result = str_replace('.'.$result['1'], ' ('.$result['1'].')', $result['0']); |
|
2096
|
|
|
$this->updateRelease($release, $result, 'fileCheck: EBook', $echo, $type, $nameStatus, $show); |
|
2097
|
|
|
break; |
|
2098
|
|
|
case preg_match('/\w+[-\w.\',;& ]+$/i', $release->textstring, $result) && preg_match(self::PREDB_REGEX, $release->textstring): |
|
2099
|
|
|
$this->updateRelease($release, $result['0'], 'fileCheck: Folder name', $echo, $type, $nameStatus, $show); |
|
2100
|
|
|
break; |
|
2101
|
|
|
default: |
|
2102
|
|
|
return false; |
|
2103
|
|
|
} |
|
2104
|
|
|
|
|
2105
|
|
|
return true; |
|
2106
|
|
|
} |
|
2107
|
|
|
|
|
2108
|
|
|
return false; |
|
2109
|
|
|
} |
|
2110
|
|
|
|
|
2111
|
|
|
/** |
|
2112
|
|
|
* Look for a name based on mediainfo xml Unique_ID. |
|
2113
|
|
|
* |
|
2114
|
|
|
* |
|
2115
|
|
|
* @param $release |
|
2116
|
|
|
* @param $echo |
|
2117
|
|
|
* @param $type |
|
2118
|
|
|
* @param $nameStatus |
|
2119
|
|
|
* @param $show |
|
2120
|
|
|
* |
|
2121
|
|
|
* @return bool |
|
2122
|
|
|
* @throws \Exception |
|
2123
|
|
|
*/ |
|
2124
|
|
|
public function uidCheck($release, $echo, $type, $nameStatus, $show): bool |
|
2125
|
|
|
{ |
|
2126
|
|
|
if (! empty($release->uid) && $this->done === false && $this->relid !== (int) $release->releases_id) { |
|
2127
|
|
|
$result = Release::fromQuery(sprintf( |
|
2128
|
|
|
' |
|
2129
|
|
|
SELECT r.id AS releases_id, r.size AS relsize, r.name AS textstring, r.searchname, r.fromname, r.predb_id |
|
2130
|
|
|
FROM releases r |
|
2131
|
|
|
LEFT JOIN release_unique ru ON ru.releases_id = r.id |
|
2132
|
|
|
WHERE ru.releases_id IS NOT NULL |
|
2133
|
|
|
AND ru.uniqueid = %s |
|
2134
|
|
|
AND ru.releases_id != %d |
|
2135
|
|
|
AND (r.predb_id > 0 OR r.anidbid > 0 OR r.fromname = %s)', |
|
2136
|
|
|
escapeString($release->uid), |
|
2137
|
|
|
$release->releases_id, |
|
2138
|
|
|
escapeString('[email protected] (EF)') |
|
2139
|
|
|
)); |
|
2140
|
|
|
|
|
2141
|
|
|
foreach ($result as $res) { |
|
2142
|
|
|
$floor = round(($res['relsize'] - $release->relsize) / $res['relsize'] * 100, 1); |
|
2143
|
|
|
if ($floor >= -10 && $floor <= 10) { |
|
2144
|
|
|
$this->updateRelease( |
|
2145
|
|
|
$release, |
|
2146
|
|
|
$res->searchname, |
|
2147
|
|
|
'uidCheck: Unique_ID', |
|
2148
|
|
|
$echo, |
|
2149
|
|
|
$type, |
|
2150
|
|
|
$nameStatus, |
|
2151
|
|
|
$show, |
|
2152
|
|
|
$res->predb_id |
|
2153
|
|
|
); |
|
2154
|
|
|
|
|
2155
|
|
|
return true; |
|
2156
|
|
|
} |
|
2157
|
|
|
} |
|
2158
|
|
|
} |
|
2159
|
|
|
$this->_updateSingleColumn('proc_uid', self::PROC_UID_DONE, $release->releases_id); |
|
2160
|
|
|
|
|
2161
|
|
|
return false; |
|
2162
|
|
|
} |
|
2163
|
|
|
|
|
2164
|
|
|
/** |
|
2165
|
|
|
* Look for a name based on mediainfo xml Unique_ID. |
|
2166
|
|
|
* |
|
2167
|
|
|
* |
|
2168
|
|
|
* @param $release |
|
2169
|
|
|
* @param $echo |
|
2170
|
|
|
* @param $type |
|
2171
|
|
|
* @param $nameStatus |
|
2172
|
|
|
* @param $show |
|
2173
|
|
|
* |
|
2174
|
|
|
* @return bool |
|
2175
|
|
|
* @throws \Exception |
|
2176
|
|
|
*/ |
|
2177
|
|
|
public function mediaMovieNameCheck($release, $echo, $type, $nameStatus, $show): bool |
|
2178
|
|
|
{ |
|
2179
|
|
|
$newName = ''; |
|
2180
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
2181
|
|
|
if (preg_match('/<Movie_name>(.+)<\/Movie_name>/i', $release->mediainfo, $match)) { |
|
2182
|
|
|
$media = $match[1]; |
|
2183
|
|
|
if (preg_match(self::PREDB_REGEX, $media, $match)) { |
|
2184
|
|
|
$newName = $match[1]; |
|
2185
|
|
|
} elseif (preg_match('/(.+)[\,](\sRMZ\.cr)?$/i', $media, $match)) { |
|
2186
|
|
|
$newName = $match[1]; |
|
2187
|
|
|
} else { |
|
2188
|
|
|
$newName = $media; |
|
2189
|
|
|
} |
|
2190
|
|
|
} |
|
2191
|
|
|
|
|
2192
|
|
|
if ($newName !== '') { |
|
2193
|
|
|
$this->updateRelease($release, $newName, 'MediaInfo: Movie Name', $echo, $type, $nameStatus, $show, $release->predb_id); |
|
2194
|
|
|
|
|
2195
|
|
|
return true; |
|
2196
|
|
|
} |
|
2197
|
|
|
} |
|
2198
|
|
|
$this->_updateSingleColumn('proc_uid', self::PROC_UID_DONE, $release->releases_id); |
|
2199
|
|
|
|
|
2200
|
|
|
return false; |
|
2201
|
|
|
} |
|
2202
|
|
|
|
|
2203
|
|
|
/** |
|
2204
|
|
|
* Look for a name based on xxx release filename. |
|
2205
|
|
|
* |
|
2206
|
|
|
* |
|
2207
|
|
|
* @param $release |
|
2208
|
|
|
* @param $echo |
|
2209
|
|
|
* @param $type |
|
2210
|
|
|
* @param $nameStatus |
|
2211
|
|
|
* @param $show |
|
2212
|
|
|
* |
|
2213
|
|
|
* @return bool |
|
2214
|
|
|
* @throws \Exception |
|
2215
|
|
|
*/ |
|
2216
|
|
|
public function xxxNameCheck($release, $echo, $type, $nameStatus, $show): bool |
|
2217
|
|
|
{ |
|
2218
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
2219
|
|
|
$result = Release::fromQuery( |
|
2220
|
|
|
sprintf( |
|
2221
|
|
|
" |
|
2222
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
2223
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
2224
|
|
|
FROM releases rel |
|
2225
|
|
|
INNER JOIN release_files rf ON (rf.releases_id = {$release->releases_id}) |
|
2226
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN(%d, %d)) |
|
2227
|
|
|
AND rf.name LIKE %s", |
|
2228
|
|
|
self::IS_RENAMED_NONE, |
|
2229
|
|
|
Category::OTHER_MISC, |
|
2230
|
|
|
Category::OTHER_HASHED, |
|
2231
|
|
|
escapeString('%SDPORN%') |
|
2232
|
|
|
) |
|
2233
|
|
|
); |
|
2234
|
|
|
|
|
2235
|
|
|
foreach ($result as $res) { |
|
2236
|
|
|
if (preg_match('/^.+?SDPORN/i', $res->textstring, $match)) { |
|
|
|
|
|
|
2237
|
|
|
$this->updateRelease( |
|
2238
|
|
|
$release, |
|
2239
|
|
|
$match['0'], |
|
2240
|
|
|
'fileCheck: XXX SDPORN', |
|
2241
|
|
|
$echo, |
|
2242
|
|
|
$type, |
|
2243
|
|
|
$nameStatus, |
|
2244
|
|
|
$show |
|
2245
|
|
|
); |
|
2246
|
|
|
|
|
2247
|
|
|
return true; |
|
2248
|
|
|
} |
|
2249
|
|
|
} |
|
2250
|
|
|
} |
|
2251
|
|
|
$this->_updateSingleColumn('proc_files', self::PROC_FILES_DONE, $release->releases_id); |
|
2252
|
|
|
|
|
2253
|
|
|
return false; |
|
2254
|
|
|
} |
|
2255
|
|
|
|
|
2256
|
|
|
/** |
|
2257
|
|
|
* Look for a name based on .srr release files extension. |
|
2258
|
|
|
* |
|
2259
|
|
|
* |
|
2260
|
|
|
* @param $release |
|
2261
|
|
|
* @param $echo |
|
2262
|
|
|
* @param $type |
|
2263
|
|
|
* @param $nameStatus |
|
2264
|
|
|
* @param $show |
|
2265
|
|
|
* |
|
2266
|
|
|
* @return bool |
|
2267
|
|
|
* @throws \Exception |
|
2268
|
|
|
*/ |
|
2269
|
|
|
public function srrNameCheck($release, $echo, $type, $nameStatus, $show): bool |
|
2270
|
|
|
{ |
|
2271
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
2272
|
|
|
$result = Release::fromQuery( |
|
2273
|
|
|
sprintf( |
|
2274
|
|
|
" |
|
2275
|
|
|
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, |
|
2276
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
2277
|
|
|
FROM releases rel |
|
2278
|
|
|
INNER JOIN release_files rf ON (rf.releases_id = {$release->releases_id}) |
|
2279
|
|
|
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%d, %d)) |
|
2280
|
|
|
AND rf.name LIKE %s", |
|
2281
|
|
|
self::IS_RENAMED_NONE, |
|
2282
|
|
|
Category::OTHER_MISC, |
|
2283
|
|
|
Category::OTHER_HASHED, |
|
2284
|
|
|
escapeString('%.srr') |
|
2285
|
|
|
) |
|
2286
|
|
|
); |
|
2287
|
|
|
|
|
2288
|
|
|
foreach ($result as $res) { |
|
2289
|
|
|
if (preg_match('/^(.*)\.srr$/i', $res->textstring, $match)) { |
|
|
|
|
|
|
2290
|
|
|
$this->updateRelease( |
|
2291
|
|
|
$release, |
|
2292
|
|
|
$match['1'], |
|
2293
|
|
|
'fileCheck: SRR extension', |
|
2294
|
|
|
$echo, |
|
2295
|
|
|
$type, |
|
2296
|
|
|
$nameStatus, |
|
2297
|
|
|
$show |
|
2298
|
|
|
); |
|
2299
|
|
|
|
|
2300
|
|
|
return true; |
|
2301
|
|
|
} |
|
2302
|
|
|
} |
|
2303
|
|
|
} |
|
2304
|
|
|
$this->_updateSingleColumn('proc_srr', self::PROC_SRR_DONE, $release->releases_id); |
|
2305
|
|
|
|
|
2306
|
|
|
return false; |
|
2307
|
|
|
} |
|
2308
|
|
|
|
|
2309
|
|
|
/** |
|
2310
|
|
|
* Look for a name based on par2 hash_16K block. |
|
2311
|
|
|
* |
|
2312
|
|
|
* |
|
2313
|
|
|
* @param $release |
|
2314
|
|
|
* @param $echo |
|
2315
|
|
|
* @param $type |
|
2316
|
|
|
* @param $nameStatus |
|
2317
|
|
|
* @param $show |
|
2318
|
|
|
* |
|
2319
|
|
|
* @return bool |
|
2320
|
|
|
* @throws \Exception |
|
2321
|
|
|
*/ |
|
2322
|
|
|
public function hashCheck($release, $echo, $type, $nameStatus, $show): bool |
|
2323
|
|
|
{ |
|
2324
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id) { |
|
2325
|
|
|
$result = Release::fromQuery(sprintf( |
|
2326
|
|
|
' |
|
2327
|
|
|
SELECT r.id AS releases_id, r.size AS relsize, r.name AS textstring, r.searchname, r.fromname, r.predb_id |
|
2328
|
|
|
FROM releases r |
|
2329
|
|
|
LEFT JOIN par_hashes ph ON ph.releases_id = r.id |
|
2330
|
|
|
WHERE ph.hash = %s |
|
2331
|
|
|
AND ph.releases_id != %d |
|
2332
|
|
|
AND (r.predb_id > 0 OR r.anidbid > 0)', |
|
2333
|
|
|
escapeString($release->hash), |
|
2334
|
|
|
$release->releases_id |
|
2335
|
|
|
)); |
|
2336
|
|
|
|
|
2337
|
|
|
foreach ($result as $res) { |
|
2338
|
|
|
$floor = round(($res->relsize - $release->relsize) / $res->relsize * 100, 1); |
|
|
|
|
|
|
2339
|
|
|
if ($floor >= -5 && $floor <= 5) { |
|
2340
|
|
|
$this->updateRelease( |
|
2341
|
|
|
$release, |
|
2342
|
|
|
$res->searchname, |
|
2343
|
|
|
'hashCheck: PAR2 hash_16K', |
|
2344
|
|
|
$echo, |
|
2345
|
|
|
$type, |
|
2346
|
|
|
$nameStatus, |
|
2347
|
|
|
$show, |
|
2348
|
|
|
$res->predb_id |
|
2349
|
|
|
); |
|
2350
|
|
|
|
|
2351
|
|
|
return true; |
|
2352
|
|
|
} |
|
2353
|
|
|
} |
|
2354
|
|
|
} |
|
2355
|
|
|
$this->_updateSingleColumn('proc_hash16k', self::PROC_HASH16K_DONE, $release->releases_id); |
|
2356
|
|
|
|
|
2357
|
|
|
return false; |
|
2358
|
|
|
} |
|
2359
|
|
|
|
|
2360
|
|
|
/** |
|
2361
|
|
|
* Look for a name based on rar crc32 hash. |
|
2362
|
|
|
* |
|
2363
|
|
|
* |
|
2364
|
|
|
* @param $release |
|
2365
|
|
|
* @param $echo |
|
2366
|
|
|
* @param $type |
|
2367
|
|
|
* @param $nameStatus |
|
2368
|
|
|
* @param $show |
|
2369
|
|
|
* |
|
2370
|
|
|
* @return bool |
|
2371
|
|
|
* @throws \Exception |
|
2372
|
|
|
*/ |
|
2373
|
|
|
public function crcCheck($release, $echo, $type, $nameStatus, $show): bool |
|
2374
|
|
|
{ |
|
2375
|
|
|
if ($this->done === false && $this->relid !== (int) $release->releases_id && $release->textstring !== '') { |
|
2376
|
|
|
$result = Release::fromQuery( |
|
2377
|
|
|
sprintf( |
|
2378
|
|
|
' |
|
2379
|
|
|
SELECT rf.crc32, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, rel.size as relsize, rel.predb_id as predb_id, |
|
2380
|
|
|
rf.releases_id AS fileid, rel.id AS releases_id |
|
2381
|
|
|
FROM releases rel |
|
2382
|
|
|
LEFT JOIN release_files rf ON rf.releases_id = rel.id |
|
2383
|
|
|
WHERE rel.predb_id > 0 |
|
2384
|
|
|
AND rf.crc32 = %s', |
|
2385
|
|
|
escapeString($release->textstring) |
|
2386
|
|
|
) |
|
2387
|
|
|
); |
|
2388
|
|
|
|
|
2389
|
|
|
foreach ($result as $res) { |
|
2390
|
|
|
$floor = round(($res->relsize - $release->relsize) / $res->relsize * 100, 1); |
|
|
|
|
|
|
2391
|
|
|
if ($floor >= -5 && $floor <= 5) { |
|
2392
|
|
|
$this->updateRelease( |
|
2393
|
|
|
$release, |
|
2394
|
|
|
$res->searchname, |
|
2395
|
|
|
'crcCheck: CRC32', |
|
2396
|
|
|
$echo, |
|
2397
|
|
|
$type, |
|
2398
|
|
|
$nameStatus, |
|
2399
|
|
|
$show, |
|
2400
|
|
|
$res->predb_id |
|
2401
|
|
|
); |
|
2402
|
|
|
|
|
2403
|
|
|
return true; |
|
2404
|
|
|
} |
|
2405
|
|
|
} |
|
2406
|
|
|
} |
|
2407
|
|
|
$this->_updateSingleColumn('proc_crc32', self::PROC_CRC_DONE, $release->releases_id); |
|
2408
|
|
|
|
|
2409
|
|
|
return false; |
|
2410
|
|
|
} |
|
2411
|
|
|
|
|
2412
|
|
|
/** |
|
2413
|
|
|
* Resets NameFixer status variables for new processing. |
|
2414
|
|
|
*/ |
|
2415
|
|
|
public function reset(): void |
|
2416
|
|
|
{ |
|
2417
|
|
|
$this->done = $this->matched = false; |
|
2418
|
|
|
} |
|
2419
|
|
|
|
|
2420
|
|
|
/** |
|
2421
|
|
|
* @param string $fileName |
|
2422
|
|
|
* |
|
2423
|
|
|
* @return array |
|
2424
|
|
|
*/ |
|
2425
|
|
|
private function preMatch($fileName): array |
|
2426
|
|
|
{ |
|
2427
|
|
|
$result = preg_match('/(\d{2}\.\d{2}\.\d{2})+([\w\-.]+[\w]$)/i', $fileName, $match); |
|
2428
|
|
|
|
|
2429
|
|
|
return [$result === 1, $match[0] ?? '']; |
|
2430
|
|
|
} |
|
2431
|
|
|
|
|
2432
|
|
|
/** |
|
2433
|
|
|
* @param $release |
|
2434
|
|
|
* @param bool $echo |
|
2435
|
|
|
* @param string $type |
|
2436
|
|
|
* @param int $nameStatus |
|
2437
|
|
|
* @param bool $show |
|
2438
|
|
|
* @return bool |
|
2439
|
|
|
* @throws \Exception |
|
2440
|
|
|
*/ |
|
2441
|
|
|
public function preDbFileCheck($release, bool $echo, string $type, int $nameStatus, bool $show): bool |
|
2442
|
|
|
{ |
|
2443
|
|
|
$this->_fileName = $release->textstring; |
|
2444
|
|
|
$this->_cleanMatchFiles(); |
|
2445
|
|
|
|
|
2446
|
|
|
if (! empty($this->_fileName)) { |
|
2447
|
|
|
foreach ($this->sphinx->searchIndexes($this->_fileName, ['filename', 'title'], 'predb_rt') as $match) { |
|
2448
|
|
|
if (! empty($match)) { |
|
2449
|
|
|
$preTitle = Predb::whereId($match['id'])->first(); |
|
2450
|
|
|
$this->updateRelease($release, $preTitle->title, 'PreDb: Filename match', $echo, $type, $nameStatus, $show, $preTitle->id); |
|
2451
|
|
|
|
|
2452
|
|
|
return true; |
|
2453
|
|
|
} |
|
2454
|
|
|
} |
|
2455
|
|
|
} |
|
2456
|
|
|
|
|
2457
|
|
|
return false; |
|
2458
|
|
|
} |
|
2459
|
|
|
|
|
2460
|
|
|
/** |
|
2461
|
|
|
* @param $release |
|
2462
|
|
|
* @param bool $echo |
|
2463
|
|
|
* @param string $type |
|
2464
|
|
|
* @param int $nameStatus |
|
2465
|
|
|
* @param bool $show |
|
2466
|
|
|
* @return bool |
|
2467
|
|
|
* @throws \Exception |
|
2468
|
|
|
*/ |
|
2469
|
|
|
public function preDbTitleCheck($release, bool $echo, string $type, int $nameStatus, bool $show): bool |
|
2470
|
|
|
{ |
|
2471
|
|
|
$this->_fileName = $release->textstring; |
|
2472
|
|
|
$this->_cleanMatchFiles(); |
|
2473
|
|
|
$this->cleanFileNames(); |
|
2474
|
|
|
if (! empty($this->_fileName)) { |
|
2475
|
|
|
foreach ($this->sphinx->searchIndexes($this->_fileName, 'title', 'predb_rt') as $match) { |
|
2476
|
|
|
if (! empty($match)) { |
|
2477
|
|
|
$preTitle = Predb::whereId($match['id'])->first(); |
|
2478
|
|
|
$this->updateRelease($release, $preTitle->title, 'PreDb: Title match', $echo, $type, $nameStatus, $show, $preTitle->id); |
|
2479
|
|
|
|
|
2480
|
|
|
return true; |
|
2481
|
|
|
} |
|
2482
|
|
|
} |
|
2483
|
|
|
} |
|
2484
|
|
|
|
|
2485
|
|
|
return false; |
|
2486
|
|
|
} |
|
2487
|
|
|
|
|
2488
|
|
|
/** |
|
2489
|
|
|
* Clean filenames for predb title match. |
|
2490
|
|
|
* |
|
2491
|
|
|
* |
|
2492
|
|
|
* @return string|string[]|null |
|
2493
|
|
|
*/ |
|
2494
|
|
|
private function cleanFileNames() |
|
2495
|
|
|
{ |
|
2496
|
|
|
if (preg_match('/(\.[a-zA-Z]{2})?(\.4k|\.fullhd|\.hd|\.int|\.\d+)?$/i', $this->_fileName, $match)) { |
|
2497
|
|
|
if (preg_match('/\.[a-zA-Z]{2}/i', $match[1])) { |
|
2498
|
|
|
$this->_fileName = preg_replace('/\.[a-zA-Z]{2}\./i', '.', $this->_fileName); |
|
2499
|
|
|
} |
|
2500
|
|
|
if (preg_match('/\.4k$/', $match[2])) { |
|
2501
|
|
|
$this->_fileName = preg_replace('/\.4k$/', '.2160p', $this->_fileName); |
|
2502
|
|
|
} |
|
2503
|
|
|
if (preg_match('/\.fullhd$/i', $match[2])) { |
|
2504
|
|
|
$this->_fileName = preg_replace('/\.fullhd$/i', '.1080p', $this->_fileName); |
|
2505
|
|
|
} |
|
2506
|
|
|
if (preg_match('/\.hd$/i', $match[2])) { |
|
2507
|
|
|
$this->_fileName = preg_replace('/\.hd$/i', '.720p', $this->_fileName); |
|
2508
|
|
|
} |
|
2509
|
|
|
if (preg_match('/\.int$/i', $match[2])) { |
|
2510
|
|
|
$this->_fileName = preg_replace('/\.int$/i', '.INTERNAL', $this->_fileName); |
|
2511
|
|
|
} |
|
2512
|
|
|
if (preg_match('/\.\d+/', $match[2])) { |
|
2513
|
|
|
$this->_fileName = preg_replace('/\.\d+$/', '', $this->_fileName); |
|
2514
|
|
|
} |
|
2515
|
|
|
if (preg_match('/^[a-zA-Z]{0,4}\./', $match[0])) { |
|
2516
|
|
|
$this->_fileName = preg_replace('/^[a-zA-Z]{0,4}\./', '', $this->_fileName); |
|
2517
|
|
|
} |
|
2518
|
|
|
} |
|
2519
|
|
|
|
|
2520
|
|
|
|
|
2521
|
|
|
return $this->_fileName; |
|
2522
|
|
|
} |
|
2523
|
|
|
} |
|
2524
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.