@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ); |
91 | 91 | } |
92 | 92 | |
93 | - $this->dryRun($input, $output, function () use ( |
|
93 | + $this->dryRun($input, $output, function() use ( |
|
94 | 94 | $input, |
95 | 95 | $output, |
96 | 96 | $weburgClient, |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | $limit = $input->getOption('limit'); |
106 | 106 | if ($limit && count($torrentsUrls) > $limit) { |
107 | - $output->writeln("\nLimit list from " . count($torrentsUrls) . " to $limit"); |
|
107 | + $output->writeln("\nLimit list from ".count($torrentsUrls)." to $limit"); |
|
108 | 108 | $torrentsUrls = array_slice($torrentsUrls, 0, $limit); |
109 | 109 | } |
110 | 110 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $output->writeln("\nNot found any for query $query"); |
180 | 180 | } |
181 | 181 | |
182 | - $downloadedLogfile = $downloadDir . '/' . $movieId; |
|
182 | + $downloadedLogfile = $downloadDir.'/'.$movieId; |
|
183 | 183 | |
184 | 184 | $isDownloaded = file_exists($downloadedLogfile); |
185 | 185 | if ($isDownloaded) { |
@@ -189,17 +189,17 @@ discard block |
||
189 | 189 | $movieInfo = $weburgClient->getMovieInfoById($movieId); |
190 | 190 | foreach (array_keys($movieInfo) as $infoField) { |
191 | 191 | if (!isset($movieInfo[$infoField])) { |
192 | - $logger->warning('Cannot find ' . $infoField . ' in movie ' . $movieId); |
|
192 | + $logger->warning('Cannot find '.$infoField.' in movie '.$movieId); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | 196 | $movieUrls = $weburgClient->getMovieTorrentUrlsById($movieId); |
197 | 197 | $torrentsUrls = array_merge($torrentsUrls, $movieUrls); |
198 | - $logger->info('Download movie ' . $movieId . ': ' . $movieInfo['title']); |
|
198 | + $logger->info('Download movie '.$movieId.': '.$movieInfo['title']); |
|
199 | 199 | |
200 | 200 | file_put_contents( |
201 | 201 | $downloadedLogfile, |
202 | - date('Y-m-d H:i:s') . "\n" . implode("\n", $torrentsUrls) |
|
202 | + date('Y-m-d H:i:s')."\n".implode("\n", $torrentsUrls) |
|
203 | 203 | ); |
204 | 204 | |
205 | 205 | return $torrentsUrls; |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | $progress->start(); |
225 | 225 | |
226 | 226 | foreach ($moviesIds as $movieId) { |
227 | - $progress->setMessage('Check movie ' . $movieId . '...'); |
|
227 | + $progress->setMessage('Check movie '.$movieId.'...'); |
|
228 | 228 | $progress->advance(); |
229 | 229 | |
230 | - $downloadedLogfile = $downloadDir . '/' . $movieId; |
|
230 | + $downloadedLogfile = $downloadDir.'/'.$movieId; |
|
231 | 231 | |
232 | 232 | $isDownloaded = file_exists($downloadedLogfile); |
233 | 233 | if ($isDownloaded) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $movieInfo = $weburgClient->getMovieInfoById($movieId); |
238 | 238 | foreach (array_keys($movieInfo) as $infoField) { |
239 | 239 | if (!isset($movieInfo[$infoField])) { |
240 | - $logger->warning('Cannot find ' . $infoField . ' in movie ' . $movieId); |
|
240 | + $logger->warning('Cannot find '.$infoField.' in movie '.$movieId); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -250,15 +250,15 @@ discard block |
||
250 | 250 | ); |
251 | 251 | |
252 | 252 | if ($isTorrentPopular) { |
253 | - $progress->setMessage('Download movie ' . $movieId . '...'); |
|
253 | + $progress->setMessage('Download movie '.$movieId.'...'); |
|
254 | 254 | |
255 | 255 | $movieUrls = $weburgClient->getMovieTorrentUrlsById($movieId); |
256 | 256 | $torrentsUrls = array_merge($torrentsUrls, $movieUrls); |
257 | - $logger->info('Download movie ' . $movieId . ': ' . $movieInfo['title']); |
|
257 | + $logger->info('Download movie '.$movieId.': '.$movieInfo['title']); |
|
258 | 258 | |
259 | 259 | file_put_contents( |
260 | 260 | $downloadedLogfile, |
261 | - date('Y-m-d H:i:s') . "\n" . implode("\n", $torrentsUrls) |
|
261 | + date('Y-m-d H:i:s')."\n".implode("\n", $torrentsUrls) |
|
262 | 262 | ); |
263 | 263 | } |
264 | 264 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | } else { |
299 | 299 | $seriesId = $seriesTitle = $seriesItem; |
300 | 300 | } |
301 | - $progress->setMessage('Check series ' . $seriesTitle . '...'); |
|
301 | + $progress->setMessage('Check series '.$seriesTitle.'...'); |
|
302 | 302 | $progress->advance(); |
303 | 303 | |
304 | 304 | $movieInfo = $weburgClient->getMovieInfoById($seriesId); |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | |
326 | 326 | $movieId = $weburgClient->cleanMovieId($movieId); |
327 | 327 | if (!$movieId) { |
328 | - throw new \RuntimeException($movieId . ' seems not weburg movie ID or URL'); |
|
328 | + throw new \RuntimeException($movieId.' seems not weburg movie ID or URL'); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | $movieInfo = $weburgClient->getMovieInfoById($movieId); |
332 | - $logger->info('Search series ' . $movieId); |
|
332 | + $logger->info('Search series '.$movieId); |
|
333 | 333 | if (!empty($movieInfo['hashes'])) { |
334 | 334 | $seriesUrls = $weburgClient->getSeriesTorrents($movieId, $movieInfo['hashes'], $daysMax, $allowedMisses); |
335 | 335 | $torrentsUrls = array_merge($torrentsUrls, $seriesUrls); |
336 | 336 | |
337 | 337 | if (count($seriesUrls)) { |
338 | - $logger->info('Download series ' . $movieId . ': ' |
|
339 | - . $movieInfo['title'] . ' (' . count($seriesUrls) . ')'); |
|
338 | + $logger->info('Download series '.$movieId.': ' |
|
339 | + . $movieInfo['title'].' ('.count($seriesUrls).')'); |
|
340 | 340 | } |
341 | 341 | } else { |
342 | 342 | $torrentsUrls = array_merge($torrentsUrls, $weburgClient->getMovieTorrentUrlsById($movieId)); |
@@ -362,10 +362,10 @@ discard block |
||
362 | 362 | } |
363 | 363 | |
364 | 364 | if (!file_exists($torrentsDir)) { |
365 | - throw new \RuntimeException('Destination directory not exists: ' . $torrentsDir); |
|
365 | + throw new \RuntimeException('Destination directory not exists: '.$torrentsDir); |
|
366 | 366 | } |
367 | 367 | |
368 | - $downloadDir = $torrentsDir . '/downloaded'; |
|
368 | + $downloadDir = $torrentsDir.'/downloaded'; |
|
369 | 369 | if (!file_exists($downloadDir)) { |
370 | 370 | mkdir($downloadDir, 0777); |
371 | 371 | } |
@@ -381,24 +381,24 @@ discard block |
||
381 | 381 | $whitelist = $config->get('download-filename-whitelist'); |
382 | 382 | $blacklist = $config->get('download-filename-blacklist'); |
383 | 383 | |
384 | - $torrentFiles = array_filter($torrentFiles, function ($torrentFile) use ($whitelist, $blacklist, $logger) { |
|
384 | + $torrentFiles = array_filter($torrentFiles, function($torrentFile) use ($whitelist, $blacklist, $logger) { |
|
385 | 385 | if (!empty($whitelist)) { |
386 | 386 | $matched = false; |
387 | 387 | foreach ($whitelist as $white) { |
388 | - if (preg_match('/' . $white . '/i', $torrentFile)) { |
|
389 | - $logger->info($torrentFile . ' matched whitelist: ' . $white); |
|
388 | + if (preg_match('/'.$white.'/i', $torrentFile)) { |
|
389 | + $logger->info($torrentFile.' matched whitelist: '.$white); |
|
390 | 390 | $matched = true; |
391 | 391 | } |
392 | 392 | } |
393 | 393 | if (!$matched) { |
394 | - $logger->info($torrentFile . ' not matched any whitelist: ' . implode(', ', $whitelist)); |
|
394 | + $logger->info($torrentFile.' not matched any whitelist: '.implode(', ', $whitelist)); |
|
395 | 395 | return false; |
396 | 396 | } |
397 | 397 | } |
398 | 398 | if (!empty($blacklist)) { |
399 | 399 | foreach ($blacklist as $black) { |
400 | - if (preg_match('/' . $black . '/i', $torrentFile)) { |
|
401 | - $logger->info($torrentFile . ' matched blacklist: ' . $black); |
|
400 | + if (preg_match('/'.$black.'/i', $torrentFile)) { |
|
401 | + $logger->info($torrentFile.' matched blacklist: '.$black); |
|
402 | 402 | return false; |
403 | 403 | } |
404 | 404 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | ); |
434 | 434 | |
435 | 435 | $addInput = new ArrayInput($arguments); |
436 | - $output->writeln("\nAdd " . count($torrentFiles) . " torrents to " . $host); |
|
436 | + $output->writeln("\nAdd ".count($torrentFiles)." torrents to ".$host); |
|
437 | 437 | $command->run($addInput, $output); |
438 | 438 | } |
439 | 439 | } |