Completed
Push — master ( 9492ba...5fed73 )
by Stanislav
306:28
created
src/Command/WeburgSeriesAdd.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
         $seriesId = $weburgClient->cleanMovieId($seriesArgument);
45 45
 
46 46
         if (!$seriesId) {
47
-            $output->writeln($seriesArgument . ' seems not weburg series url');
47
+            $output->writeln($seriesArgument.' seems not weburg series url');
48 48
             return 1;
49 49
         }
50 50
 
51 51
         $seriesList = $config->get('weburg-series-list');
52
-        if (!empty(array_filter($seriesList, function ($item) use ($seriesId) {
52
+        if (!empty(array_filter($seriesList, function($item) use ($seriesId) {
53 53
             // can be array or id
54 54
             return is_array($item) ? $item['id'] == $seriesId : $item == $seriesId;
55 55
         }))) {
56
-            $output->writeln($seriesId . ' already in list');
56
+            $output->writeln($seriesId.' already in list');
57 57
             return 0;
58 58
         }
59 59
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $config->set('weburg-series-list', $seriesList);
67 67
         $config->saveConfigFile();
68 68
 
69
-        $output->writeln('Series ' . $seriesId . ' ' . $seriesInfo['title'] . ' added to list');
69
+        $output->writeln('Series '.$seriesId.' '.$seriesInfo['title'].' added to list');
70 70
         return 0;
71 71
     }
72 72
 }
Please login to merge, or discard this patch.
src/Command/WeburgDownload.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 );
88 88
             }
89 89
 
90
-            $this->dryRun($input, $output, function () use (
90
+            $this->dryRun($input, $output, function() use (
91 91
                 $input,
92 92
                 $output,
93 93
                 $weburgClient,
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
         $progress->start();
162 162
 
163 163
         foreach ($moviesIds as $movieId) {
164
-            $progress->setMessage('Check movie ' . $movieId . '...');
164
+            $progress->setMessage('Check movie '.$movieId.'...');
165 165
             $progress->advance();
166 166
 
167
-            $downloadedLogfile = $downloadDir . '/' . $movieId;
167
+            $downloadedLogfile = $downloadDir.'/'.$movieId;
168 168
 
169 169
             $isDownloaded = file_exists($downloadedLogfile);
170 170
             if ($isDownloaded) {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             $movieInfo = $weburgClient->getMovieInfoById($movieId);
175 175
             foreach (array_keys($movieInfo) as $infoField) {
176 176
                 if (!isset($movieInfo[$infoField])) {
177
-                    $logger->warning('Cannot find ' . $infoField . ' in movie ' . $movieId);
177
+                    $logger->warning('Cannot find '.$infoField.' in movie '.$movieId);
178 178
                 }
179 179
             }
180 180
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
             );
188 188
 
189 189
             if ($isTorrentPopular) {
190
-                $progress->setMessage('Download movie ' . $movieId . '...');
190
+                $progress->setMessage('Download movie '.$movieId.'...');
191 191
 
192 192
                 $movieUrls = $weburgClient->getMovieTorrentUrlsById($movieId);
193 193
                 $torrentsUrls = array_merge($torrentsUrls, $movieUrls);
194
-                $logger->info('Download movie ' . $movieId . ': ' . $movieInfo['title']);
194
+                $logger->info('Download movie '.$movieId.': '.$movieInfo['title']);
195 195
 
196 196
                 file_put_contents(
197 197
                     $downloadedLogfile,
198
-                    date('Y-m-d H:i:s') . "\n" . implode("\n", $torrentsUrls)
198
+                    date('Y-m-d H:i:s')."\n".implode("\n", $torrentsUrls)
199 199
                 );
200 200
             }
201 201
         }
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             } else {
236 236
                 $seriesId = $seriesTitle = $seriesItem;
237 237
             }
238
-            $progress->setMessage('Check series ' . $seriesTitle . '...');
238
+            $progress->setMessage('Check series '.$seriesTitle.'...');
239 239
             $progress->advance();
240 240
 
241 241
             $movieInfo = $weburgClient->getMovieInfoById($seriesId);
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 
263 263
         $movieId = $weburgClient->cleanMovieId($movieId);
264 264
         if (!$movieId) {
265
-            throw new \RuntimeException($movieId . ' seems not weburg movie ID or URL');
265
+            throw new \RuntimeException($movieId.' seems not weburg movie ID or URL');
266 266
         }
267 267
 
268 268
         $movieInfo = $weburgClient->getMovieInfoById($movieId);
269
-        $logger->info('Search series ' . $movieId);
269
+        $logger->info('Search series '.$movieId);
270 270
         if (!empty($movieInfo['hashes'])) {
271 271
             $seriesUrls = $weburgClient->getSeriesTorrents($movieId, $movieInfo['hashes'], $daysMax, $allowedMisses);
272 272
             $torrentsUrls = array_merge($torrentsUrls, $seriesUrls);
273 273
 
274 274
             if (count($seriesUrls)) {
275
-                $logger->info('Download series ' . $movieId . ': '
276
-                    . $movieInfo['title'] . ' (' . count($seriesUrls) . ')');
275
+                $logger->info('Download series '.$movieId.': '
276
+                    . $movieInfo['title'].' ('.count($seriesUrls).')');
277 277
             }
278 278
         } else {
279 279
             $torrentsUrls = array_merge($torrentsUrls, $weburgClient->getMovieTorrentUrlsById($movieId));
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
         }
300 300
 
301 301
         if (!file_exists($torrentsDir)) {
302
-            throw new \RuntimeException('Destination directory not exists: ' . $torrentsDir);
302
+            throw new \RuntimeException('Destination directory not exists: '.$torrentsDir);
303 303
         }
304 304
 
305
-        $downloadDir = $torrentsDir . '/downloaded';
305
+        $downloadDir = $torrentsDir.'/downloaded';
306 306
         if (!file_exists($downloadDir)) {
307 307
             mkdir($downloadDir, 0777);
308 308
         }
@@ -318,24 +318,24 @@  discard block
 block discarded – undo
318 318
         $whitelist = $config->get('download-filename-whitelist');
319 319
         $blacklist = $config->get('download-filename-blacklist');
320 320
 
321
-        $torrentFiles = array_filter($torrentFiles, function ($torrentFile) use ($whitelist, $blacklist, $logger) {
321
+        $torrentFiles = array_filter($torrentFiles, function($torrentFile) use ($whitelist, $blacklist, $logger) {
322 322
             if (!empty($whitelist)) {
323 323
                 $matched = false;
324 324
                 foreach ($whitelist as $white) {
325
-                    if (preg_match('/' . $white . '/i', $torrentFile)) {
326
-                        $logger->info($torrentFile . ' matched whitelist: ' . $white);
325
+                    if (preg_match('/'.$white.'/i', $torrentFile)) {
326
+                        $logger->info($torrentFile.' matched whitelist: '.$white);
327 327
                         $matched = true;
328 328
                     }
329 329
                 }
330 330
                 if (!$matched) {
331
-                    $logger->info($torrentFile . ' not matched any whitelist: ' . implode(', ', $whitelist));
331
+                    $logger->info($torrentFile.' not matched any whitelist: '.implode(', ', $whitelist));
332 332
                     return false;
333 333
                 }
334 334
             }
335 335
             if (!empty($blacklist)) {
336 336
                 foreach ($blacklist as $black) {
337
-                    if (preg_match('/' . $black . '/i', $torrentFile)) {
338
-                        $logger->info($torrentFile . ' matched blacklist: ' . $black);
337
+                    if (preg_match('/'.$black.'/i', $torrentFile)) {
338
+                        $logger->info($torrentFile.' matched blacklist: '.$black);
339 339
                         return false;
340 340
                     }
341 341
                 }
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
             );
371 371
 
372 372
             $addInput = new ArrayInput($arguments);
373
-            $output->writeln("\nAdd torrents to " . $host);
373
+            $output->writeln("\nAdd torrents to ".$host);
374 374
             $command->run($addInput, $output);
375 375
         }
376 376
     }
Please login to merge, or discard this patch.
src/Command/WeburgInfo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             $movieArgument = $input->getArgument('movie-id');
37 37
             $movieId = $weburgClient->cleanMovieId($movieArgument);
38 38
             if (!$movieId) {
39
-                throw new \RuntimeException($movieId . ' seems not weburg movie ID or URL');
39
+                throw new \RuntimeException($movieId.' seems not weburg movie ID or URL');
40 40
             }
41 41
 
42 42
             $movieInfo = $weburgClient->getMovieInfoById($movieId);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                     );
59 59
 
60 60
                     if (count($seriesUrls)) {
61
-                        $output->writeln('Found series: ' . count($seriesUrls));
61
+                        $output->writeln('Found series: '.count($seriesUrls));
62 62
                     }
63 63
                 }
64 64
             }
Please login to merge, or discard this patch.