Completed
Push — master ( 8828d1...509b32 )
by Stanislav
08:31
created
src/Command/WeburgDownload.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 );
87 87
             }
88 88
 
89
-            $this->dryRun($input, $output, function () use (
89
+            $this->dryRun($input, $output, function() use (
90 90
                 $input,
91 91
                 $output,
92 92
                 $weburgClient,
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
         $progress->start();
156 156
 
157 157
         foreach ($moviesIds as $movieId) {
158
-            $progress->setMessage('Check movie ' . $movieId . '...');
158
+            $progress->setMessage('Check movie '.$movieId.'...');
159 159
             $progress->advance();
160 160
 
161
-            $downloadedLogfile = $downloadDir . '/' . $movieId;
161
+            $downloadedLogfile = $downloadDir.'/'.$movieId;
162 162
 
163 163
             $isDownloaded = file_exists($downloadedLogfile);
164 164
             if ($isDownloaded) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             $movieInfo = $weburgClient->getMovieInfoById($movieId);
169 169
             foreach (array_keys($movieInfo) as $infoField) {
170 170
                 if (!isset($movieInfo[$infoField])) {
171
-                    $logger->warning('Cannot find ' . $infoField . ' in movie ' . $movieId);
171
+                    $logger->warning('Cannot find '.$infoField.' in movie '.$movieId);
172 172
                 }
173 173
             }
174 174
 
@@ -181,15 +181,15 @@  discard block
 block discarded – undo
181 181
             );
182 182
 
183 183
             if ($isTorrentPopular) {
184
-                $progress->setMessage('Download movie ' . $movieId . '...');
184
+                $progress->setMessage('Download movie '.$movieId.'...');
185 185
 
186 186
                 $movieUrls = $weburgClient->getMovieTorrentUrlsById($movieId);
187 187
                 $torrentsUrls = array_merge($torrentsUrls, $movieUrls);
188
-                $logger->info('Download movie ' . $movieId . ': ' . $movieInfo['title']);
188
+                $logger->info('Download movie '.$movieId.': '.$movieInfo['title']);
189 189
 
190 190
                 file_put_contents(
191 191
                     $downloadedLogfile,
192
-                    date('Y-m-d H:i:s') . "\n" . implode("\n", $torrentsUrls)
192
+                    date('Y-m-d H:i:s')."\n".implode("\n", $torrentsUrls)
193 193
                 );
194 194
             }
195 195
         }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         $progress->start();
224 224
 
225 225
         foreach ($seriesIds as $seriesId) {
226
-            $progress->setMessage('Check series ' . $seriesId . '...');
226
+            $progress->setMessage('Check series '.$seriesId.'...');
227 227
             $progress->advance();
228 228
 
229 229
             $movieInfo = $weburgClient->getMovieInfoById($seriesId);
@@ -250,18 +250,18 @@  discard block
 block discarded – undo
250 250
 
251 251
         $movieId = $weburgClient->cleanMovieId($movieId);
252 252
         if (!$movieId) {
253
-            throw new \RuntimeException($movieId . ' seems not weburg movie ID or URL');
253
+            throw new \RuntimeException($movieId.' seems not weburg movie ID or URL');
254 254
         }
255 255
 
256 256
         $movieInfo = $weburgClient->getMovieInfoById($movieId);
257
-        $logger->info('Search series ' . $movieId);
257
+        $logger->info('Search series '.$movieId);
258 258
         if (!empty($movieInfo['hashes'])) {
259 259
             $seriesUrls = $weburgClient->getSeriesTorrents($movieId, $movieInfo['hashes'], $daysMax, $allowedMisses);
260 260
             $torrentsUrls = array_merge($torrentsUrls, $seriesUrls);
261 261
 
262 262
             if (count($seriesUrls)) {
263
-                $logger->info('Download series ' . $movieId . ': '
264
-                    . $movieInfo['title'] . ' (' . count($seriesUrls) . ')');
263
+                $logger->info('Download series '.$movieId.': '
264
+                    . $movieInfo['title'].' ('.count($seriesUrls).')');
265 265
             }
266 266
         } else {
267 267
             $torrentsUrls = array_merge($torrentsUrls, $weburgClient->getMovieTorrentUrlsById($movieId));
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
         }
288 288
 
289 289
         if (!file_exists($torrentsDir)) {
290
-            throw new \RuntimeException('Destination directory not exists: ' . $torrentsDir);
290
+            throw new \RuntimeException('Destination directory not exists: '.$torrentsDir);
291 291
         }
292 292
 
293
-        $downloadDir = $torrentsDir . '/downloaded';
293
+        $downloadDir = $torrentsDir.'/downloaded';
294 294
         if (!file_exists($downloadDir)) {
295 295
             mkdir($downloadDir, 0777);
296 296
         }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             );
322 322
 
323 323
             $addInput = new ArrayInput($arguments);
324
-            $output->writeln("\nAdd torrents to " . $host);
324
+            $output->writeln("\nAdd torrents to ".$host);
325 325
             $command->run($addInput, $output);
326 326
         }
327 327
     }
Please login to merge, or discard this patch.
src/Config.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,22 +44,22 @@  discard block
 block discarded – undo
44 44
 
45 45
         $this->configFile = $configFile;
46 46
         if (!isset($configFile)) {
47
-            $this->configFile = self::getHomeDir() . '/.transmission-cli.yml';
47
+            $this->configFile = self::getHomeDir().'/.transmission-cli.yml';
48 48
         }
49 49
     }
50 50
 
51 51
     public function loadConfigFile()
52 52
     {
53 53
         if (!file_exists($this->configFile)) {
54
-            if ($this->configFile == self::getHomeDir() . '/.transmission-cli.yml') {
54
+            if ($this->configFile == self::getHomeDir().'/.transmission-cli.yml') {
55 55
                 $this->saveConfigFile();
56 56
             } else {
57
-                throw new \RuntimeException('Config file not found: ' . $this->configFile);
57
+                throw new \RuntimeException('Config file not found: '.$this->configFile);
58 58
             }
59 59
         }
60 60
         $yml = Yaml::parse(file_get_contents($this->configFile));
61 61
         if (!is_array($yml)) {
62
-            throw new \RuntimeException('Config file corrupted: ' . $this->configFile);
62
+            throw new \RuntimeException('Config file corrupted: '.$this->configFile);
63 63
         }
64 64
         $this->config = $yml + $this->config;
65 65
     }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $home = rtrim($home, '/');
107 107
         } elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) {
108 108
             // home on windows
109
-            $home = $_SERVER['HOMEDRIVE'] . $_SERVER['HOMEPATH'];
109
+            $home = $_SERVER['HOMEDRIVE'].$_SERVER['HOMEPATH'];
110 110
             // If HOMEPATH is a root directory the path can end with a slash. Make sure
111 111
             // that doesn't happen.
112 112
             $home = rtrim($home, '\\/');
Please login to merge, or discard this patch.
src/InfluxDbClient.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
         try {
91 91
             $databaseExists = $database->exists();
92 92
         } catch (ConnectException $e) {
93
-            throw new \RuntimeException('InfluxDb connection error: ' . $e->getMessage());
93
+            throw new \RuntimeException('InfluxDb connection error: '.$e->getMessage());
94 94
         }
95 95
         if (!$databaseExists) {
96
-            $this->log('info', 'Database ' . $this->databaseName . ' not exists, creating');
96
+            $this->log('info', 'Database '.$this->databaseName.' not exists, creating');
97 97
             $database->create(null, false);
98 98
         }
99 99
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             $points[] = $this->buildPoint($torrent, $transmissionHost);
172 172
         }
173 173
         $isSuccess = $this->writePoints($points);
174
-        $this->log('info', 'InfluxDB write ' . ($isSuccess ? 'success' : 'failed'));
174
+        $this->log('info', 'InfluxDB write '.($isSuccess ? 'success' : 'failed'));
175 175
         return $isSuccess;
176 176
     }
177 177
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
         $where = [];
188 188
 
189 189
         if (isset($torrent[Torrent\Get::NAME])) {
190
-            $where[] = "torrent_name = '" . $torrent[Torrent\Get::NAME] . "'";
190
+            $where[] = "torrent_name = '".$torrent[Torrent\Get::NAME]."'";
191 191
         }
192 192
 
193 193
         if ($transmissionHost) {
194
-            $where[] = "host = '" . $transmissionHost . "'";
194
+            $where[] = "host = '".$transmissionHost."'";
195 195
         }
196 196
 
197 197
         if ($lastDays) {
198
-            $fromTimestamp = strtotime('-' . $lastDays . ' days');
198
+            $fromTimestamp = strtotime('-'.$lastDays.' days');
199 199
             $fromDate = date('c', $fromTimestamp);
200 200
             $where[] = "time >= '$fromDate'";
201 201
         }
Please login to merge, or discard this patch.