@@ -1,157 +1,157 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | - namespace App\Console\Commands; |
|
3 | + namespace App\Console\Commands; |
|
4 | 4 | |
5 | - use Blacklight\NameFixer; |
|
6 | - use Blacklight\NNTP; |
|
7 | - use Illuminate\Console\Command; |
|
5 | + use Blacklight\NameFixer; |
|
6 | + use Blacklight\NNTP; |
|
7 | + use Illuminate\Console\Command; |
|
8 | 8 | |
9 | - class FixReleaseNames extends Command |
|
10 | - { |
|
11 | - /** |
|
12 | - * The name and signature of the console command. |
|
13 | - * |
|
14 | - * @var string |
|
15 | - */ |
|
16 | - protected $signature = 'releases:fix-names |
|
9 | + class FixReleaseNames extends Command |
|
10 | + { |
|
11 | + /** |
|
12 | + * The name and signature of the console command. |
|
13 | + * |
|
14 | + * @var string |
|
15 | + */ |
|
16 | + protected $signature = 'releases:fix-names |
|
17 | 17 | {method : The method number (3-20) to use for fixing names} |
18 | 18 | {--update : Actually update the names, otherwise just display results} |
19 | 19 | {--category=other : Category to process: "other", "all", or "predb_id"} |
20 | 20 | {--set-status : Set releases as checked after processing} |
21 | 21 | {--show : Display detailed release changes rather than just counters}'; |
22 | 22 | |
23 | - /** |
|
24 | - * The console command description. |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - protected $description = 'Fix release names using various methods (NFO, file name, Par2, etc.)'; |
|
23 | + /** |
|
24 | + * The console command description. |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + protected $description = 'Fix release names using various methods (NFO, file name, Par2, etc.)'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Execute the console command. |
|
32 | - */ |
|
33 | - public function handle(NameFixer $nameFixer, NNTP $nntp): int |
|
34 | - { |
|
35 | - $method = $this->argument('method'); |
|
36 | - $update = $this->option('update'); |
|
37 | - $setStatus = $this->option('set-status'); |
|
38 | - $show = $this->option('show') ? 1 : 2; |
|
30 | + /** |
|
31 | + * Execute the console command. |
|
32 | + */ |
|
33 | + public function handle(NameFixer $nameFixer, NNTP $nntp): int |
|
34 | + { |
|
35 | + $method = $this->argument('method'); |
|
36 | + $update = $this->option('update'); |
|
37 | + $setStatus = $this->option('set-status'); |
|
38 | + $show = $this->option('show') ? 1 : 2; |
|
39 | 39 | |
40 | - // Set category option |
|
41 | - $categoryOption = $this->option('category'); |
|
42 | - $other = 1; |
|
43 | - if ($categoryOption === 'all') { |
|
44 | - $other = 2; |
|
45 | - } elseif ($categoryOption === 'predb_id') { |
|
46 | - $other = 3; |
|
47 | - } |
|
40 | + // Set category option |
|
41 | + $categoryOption = $this->option('category'); |
|
42 | + $other = 1; |
|
43 | + if ($categoryOption === 'all') { |
|
44 | + $other = 2; |
|
45 | + } elseif ($categoryOption === 'predb_id') { |
|
46 | + $other = 3; |
|
47 | + } |
|
48 | 48 | |
49 | - // Connect to NNTP if method requires it |
|
50 | - if ($method === '7' || $method === '8') { |
|
51 | - $compressedHeaders = config('nntmux_nntp.compressed_headers'); |
|
52 | - if ((config('nntmux_nntp.use_alternate_nntp_server') === true ? |
|
49 | + // Connect to NNTP if method requires it |
|
50 | + if ($method === '7' || $method === '8') { |
|
51 | + $compressedHeaders = config('nntmux_nntp.compressed_headers'); |
|
52 | + if ((config('nntmux_nntp.use_alternate_nntp_server') === true ? |
|
53 | 53 | $nntp->doConnect($compressedHeaders, true) : |
54 | 54 | $nntp->doConnect()) !== true) { |
55 | - $this->error('Unable to connect to usenet.'); |
|
56 | - return 1; |
|
57 | - } |
|
58 | - } |
|
55 | + $this->error('Unable to connect to usenet.'); |
|
56 | + return 1; |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - switch ($method) { |
|
61 | - case '3': |
|
60 | + switch ($method) { |
|
61 | + case '3': |
|
62 | 62 | $nameFixer->fixNamesWithNfo(1, $update, $other, $setStatus, $show); |
63 | - break; |
|
64 | - case '4': |
|
63 | + break; |
|
64 | + case '4': |
|
65 | 65 | $nameFixer->fixNamesWithNfo(2, $update, $other, $setStatus, $show); |
66 | - break; |
|
67 | - case '5': |
|
66 | + break; |
|
67 | + case '5': |
|
68 | 68 | $nameFixer->fixNamesWithFiles(1, $update, $other, $setStatus, $show); |
69 | - break; |
|
70 | - case '6': |
|
69 | + break; |
|
70 | + case '6': |
|
71 | 71 | $nameFixer->fixNamesWithFiles(2, $update, $other, $setStatus, $show); |
72 | - break; |
|
73 | - case '7': |
|
72 | + break; |
|
73 | + case '7': |
|
74 | 74 | $nameFixer->fixNamesWithPar2(1, $update, $other, $setStatus, $show, $nntp); |
75 | - break; |
|
76 | - case '8': |
|
75 | + break; |
|
76 | + case '8': |
|
77 | 77 | $nameFixer->fixNamesWithPar2(2, $update, $other, $setStatus, $show, $nntp); |
78 | - break; |
|
79 | - case '9': |
|
78 | + break; |
|
79 | + case '9': |
|
80 | 80 | $nameFixer->fixNamesWithMedia(1, $update, $other, $setStatus, $show); |
81 | - break; |
|
82 | - case '10': |
|
81 | + break; |
|
82 | + case '10': |
|
83 | 83 | $nameFixer->fixNamesWithMedia(2, $update, $other, $setStatus, $show); |
84 | - break; |
|
85 | - case '11': |
|
84 | + break; |
|
85 | + case '11': |
|
86 | 86 | $nameFixer->fixXXXNamesWithFiles(1, $update, $other, $setStatus, $show); |
87 | - break; |
|
88 | - case '12': |
|
87 | + break; |
|
88 | + case '12': |
|
89 | 89 | $nameFixer->fixXXXNamesWithFiles(2, $update, $other, $setStatus, $show); |
90 | - break; |
|
91 | - case '13': |
|
90 | + break; |
|
91 | + case '13': |
|
92 | 92 | $nameFixer->fixNamesWithSrr(1, $update, $other, $setStatus, $show); |
93 | - break; |
|
94 | - case '14': |
|
93 | + break; |
|
94 | + case '14': |
|
95 | 95 | $nameFixer->fixNamesWithSrr(2, $update, $other, $setStatus, $show); |
96 | - break; |
|
97 | - case '15': |
|
96 | + break; |
|
97 | + case '15': |
|
98 | 98 | $nameFixer->fixNamesWithParHash(1, $update, $other, $setStatus, $show); |
99 | - break; |
|
100 | - case '16': |
|
99 | + break; |
|
100 | + case '16': |
|
101 | 101 | $nameFixer->fixNamesWithParHash(2, $update, $other, $setStatus, $show); |
102 | - break; |
|
103 | - case '17': |
|
102 | + break; |
|
103 | + case '17': |
|
104 | 104 | $nameFixer->fixNamesWithMediaMovieName(1, $update, $other, $setStatus, $show); |
105 | - break; |
|
106 | - case '18': |
|
105 | + break; |
|
106 | + case '18': |
|
107 | 107 | $nameFixer->fixNamesWithMediaMovieName(2, $update, $other, $setStatus, $show); |
108 | - break; |
|
109 | - case '19': |
|
108 | + break; |
|
109 | + case '19': |
|
110 | 110 | $nameFixer->fixNamesWithCrc(1, $update, $other, $setStatus, $show); |
111 | - break; |
|
112 | - case '20': |
|
111 | + break; |
|
112 | + case '20': |
|
113 | 113 | $nameFixer->fixNamesWithCrc(2, $update, $other, $setStatus, $show); |
114 | - break; |
|
115 | - default: |
|
114 | + break; |
|
115 | + default: |
|
116 | 116 | $this->showHelp(); |
117 | - return 1; |
|
118 | - } |
|
117 | + return 1; |
|
118 | + } |
|
119 | 119 | |
120 | - return 0; |
|
121 | - } |
|
120 | + return 0; |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * Display detailed help information. |
|
125 | - */ |
|
126 | - protected function showHelp(): void |
|
127 | - { |
|
128 | - $this->info(''); |
|
129 | - $this->info('Usage Examples:'); |
|
130 | - $this->info(''); |
|
131 | - $this->info('php artisan releases:fix-names 3 : Fix release names using NFO in the past 6 hours.'); |
|
132 | - $this->info('php artisan releases:fix-names 4 : Fix release names using NFO.'); |
|
133 | - $this->info('php artisan releases:fix-names 5 : Fix release names in misc categories using File Name in the past 6 hours.'); |
|
134 | - $this->info('php artisan releases:fix-names 6 : Fix release names in misc categories using File Name.'); |
|
135 | - $this->info('php artisan releases:fix-names 7 : Fix release names in misc categories using Par2 Files in the past 6 hours.'); |
|
136 | - $this->info('php artisan releases:fix-names 8 : Fix release names in misc categories using Par2 Files.'); |
|
137 | - $this->info('php artisan releases:fix-names 9 : Fix release names in misc categories using UID in the past 6 hours.'); |
|
138 | - $this->info('php artisan releases:fix-names 10 : Fix release names in misc categories using UID.'); |
|
139 | - $this->info('php artisan releases:fix-names 11 : Fix SDPORN XXX release names using specific File Name in the past 6 hours.'); |
|
140 | - $this->info('php artisan releases:fix-names 12 : Fix SDPORN XXX release names using specific File Name.'); |
|
141 | - $this->info('php artisan releases:fix-names 13 : Fix release names using SRR files in the past 6 hours.'); |
|
142 | - $this->info('php artisan releases:fix-names 14 : Fix release names using SRR files.'); |
|
143 | - $this->info('php artisan releases:fix-names 15 : Fix release names using PAR2 hash_16K block in the past 6 hours.'); |
|
144 | - $this->info('php artisan releases:fix-names 16 : Fix release names using PAR2 hash_16K block.'); |
|
145 | - $this->info('php artisan releases:fix-names 17 : Fix release names using Mediainfo in the past 6 hours.'); |
|
146 | - $this->info('php artisan releases:fix-names 18 : Fix release names using Mediainfo.'); |
|
147 | - $this->info('php artisan releases:fix-names 19 : Fix release names using CRC32 in the past 6 hours.'); |
|
148 | - $this->info('php artisan releases:fix-names 20 : Fix release names using CRC32.'); |
|
149 | - $this->info(''); |
|
150 | - $this->info('Options:'); |
|
151 | - $this->info(' --update Actually update the names (default: only display potential changes)'); |
|
152 | - $this->info(' --category=VALUE Process "other" categories (default), "all" categories, or "predb_id" for unmatched'); |
|
153 | - $this->info(' --set-status Mark releases as checked so they won\'t be processed again'); |
|
154 | - $this->info(' --show Display detailed release changes (default: only show counters)'); |
|
155 | - $this->info(''); |
|
156 | - } |
|
157 | - } |
|
123 | + /** |
|
124 | + * Display detailed help information. |
|
125 | + */ |
|
126 | + protected function showHelp(): void |
|
127 | + { |
|
128 | + $this->info(''); |
|
129 | + $this->info('Usage Examples:'); |
|
130 | + $this->info(''); |
|
131 | + $this->info('php artisan releases:fix-names 3 : Fix release names using NFO in the past 6 hours.'); |
|
132 | + $this->info('php artisan releases:fix-names 4 : Fix release names using NFO.'); |
|
133 | + $this->info('php artisan releases:fix-names 5 : Fix release names in misc categories using File Name in the past 6 hours.'); |
|
134 | + $this->info('php artisan releases:fix-names 6 : Fix release names in misc categories using File Name.'); |
|
135 | + $this->info('php artisan releases:fix-names 7 : Fix release names in misc categories using Par2 Files in the past 6 hours.'); |
|
136 | + $this->info('php artisan releases:fix-names 8 : Fix release names in misc categories using Par2 Files.'); |
|
137 | + $this->info('php artisan releases:fix-names 9 : Fix release names in misc categories using UID in the past 6 hours.'); |
|
138 | + $this->info('php artisan releases:fix-names 10 : Fix release names in misc categories using UID.'); |
|
139 | + $this->info('php artisan releases:fix-names 11 : Fix SDPORN XXX release names using specific File Name in the past 6 hours.'); |
|
140 | + $this->info('php artisan releases:fix-names 12 : Fix SDPORN XXX release names using specific File Name.'); |
|
141 | + $this->info('php artisan releases:fix-names 13 : Fix release names using SRR files in the past 6 hours.'); |
|
142 | + $this->info('php artisan releases:fix-names 14 : Fix release names using SRR files.'); |
|
143 | + $this->info('php artisan releases:fix-names 15 : Fix release names using PAR2 hash_16K block in the past 6 hours.'); |
|
144 | + $this->info('php artisan releases:fix-names 16 : Fix release names using PAR2 hash_16K block.'); |
|
145 | + $this->info('php artisan releases:fix-names 17 : Fix release names using Mediainfo in the past 6 hours.'); |
|
146 | + $this->info('php artisan releases:fix-names 18 : Fix release names using Mediainfo.'); |
|
147 | + $this->info('php artisan releases:fix-names 19 : Fix release names using CRC32 in the past 6 hours.'); |
|
148 | + $this->info('php artisan releases:fix-names 20 : Fix release names using CRC32.'); |
|
149 | + $this->info(''); |
|
150 | + $this->info('Options:'); |
|
151 | + $this->info(' --update Actually update the names (default: only display potential changes)'); |
|
152 | + $this->info(' --category=VALUE Process "other" categories (default), "all" categories, or "predb_id" for unmatched'); |
|
153 | + $this->info(' --set-status Mark releases as checked so they won\'t be processed again'); |
|
154 | + $this->info(' --show Display detailed release changes (default: only show counters)'); |
|
155 | + $this->info(''); |
|
156 | + } |
|
157 | + } |
@@ -50,8 +50,7 @@ |
||
50 | 50 | if ($method === '7' || $method === '8') { |
51 | 51 | $compressedHeaders = config('nntmux_nntp.compressed_headers'); |
52 | 52 | if ((config('nntmux_nntp.use_alternate_nntp_server') === true ? |
53 | - $nntp->doConnect($compressedHeaders, true) : |
|
54 | - $nntp->doConnect()) !== true) { |
|
53 | + $nntp->doConnect($compressedHeaders, true) : $nntp->doConnect()) !== true) { |
|
55 | 54 | $this->error('Unable to connect to usenet.'); |
56 | 55 | return 1; |
57 | 56 | } |