mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-03 03:38:52 +00:00
Check names inside RAR archive and rename releases based on it. Closes #1182
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Blacklight\processing\post;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Predb;
|
||||
use App\Models\Release;
|
||||
use App\Models\ReleaseFile;
|
||||
use App\Models\Settings;
|
||||
@@ -28,6 +29,7 @@ use FFMpeg\FFProbe;
|
||||
use FFMpeg\Filters\Video\ResizeFilter;
|
||||
use FFMpeg\Format\Audio\Vorbis;
|
||||
use FFMpeg\Format\Video\Ogg;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
@@ -1080,6 +1082,24 @@ class ProcessAdditional
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->_reverse) {
|
||||
$fileData = $dataSummary['file_list'] ?? [];
|
||||
$rarFileName = Arr::pluck($fileData, 'name');
|
||||
if (preg_match(NameFixer::PREDB_REGEX, $rarFileName[0], $hit)) {
|
||||
$preCheck = Predb::whereTitle($hit[0])->first();
|
||||
$this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0;
|
||||
(new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($hit[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', 1, true, $this->_release->preid);
|
||||
} elseif (! empty($dataSummary['archives']) && ! empty($dataSummary['archives'][$rarFileName[0]]['file_list'])) {
|
||||
$archiveData = $dataSummary['archives'][$rarFileName[0]]['file_list'];
|
||||
$archiveFileName = Arr::pluck($archiveData, 'name');
|
||||
if (preg_match(NameFixer::PREDB_REGEX, $archiveFileName[0], $match2)) {
|
||||
$preCheck = Predb::whereTitle($match2[0])->first();
|
||||
$this->_release->preid = $preCheck !== null ? $preCheck->value('id') : 0;
|
||||
(new NameFixer())->updateRelease($this->_release, $preCheck->title ?? ucwords($match2[0], '.'), 'RarInfo FileName Match', true, 'Filenames, ', 1, true, $this->_release->preid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ($dataSummary['main_type']) {
|
||||
case ArchiveInfo::TYPE_RAR:
|
||||
if ($this->_echoCLI) {
|
||||
|
||||
Reference in New Issue
Block a user