@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | use Symfony\Component\Process\Process; |
| 17 | 17 | use Zip as ZipStream; |
| 18 | 18 | |
| 19 | -if (! function_exists('getRawHtml')) { |
|
| 19 | +if (!function_exists('getRawHtml')) { |
|
| 20 | 20 | /** |
| 21 | 21 | * @param bool $cookie |
| 22 | 22 | * @return bool|mixed|string |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -if (! function_exists('makeFieldLinks')) { |
|
| 54 | +if (!function_exists('makeFieldLinks')) { |
|
| 55 | 55 | /** |
| 56 | 56 | * @return string |
| 57 | 57 | * |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | -if (! function_exists('getUserBrowseOrder')) { |
|
| 84 | +if (!function_exists('getUserBrowseOrder')) { |
|
| 85 | 85 | /** |
| 86 | 86 | * @param string $orderBy |
| 87 | 87 | */ |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | -if (! function_exists('getUserBrowseOrdering')) { |
|
| 110 | +if (!function_exists('getUserBrowseOrdering')) { |
|
| 111 | 111 | function getUserBrowseOrdering(): array |
| 112 | 112 | { |
| 113 | 113 | return [ |
@@ -137,21 +137,21 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | -if (! function_exists('createGUID')) { |
|
| 140 | +if (!function_exists('createGUID')) { |
|
| 141 | 141 | /** |
| 142 | 142 | * @throws Exception |
| 143 | 143 | */ |
| 144 | 144 | function createGUID(): string |
| 145 | 145 | { |
| 146 | 146 | $data = random_bytes(16); |
| 147 | - $data[6] = \chr(\ord($data[6]) & 0x0F | 0x40); // set version to 0100 |
|
| 148 | - $data[8] = \chr(\ord($data[8]) & 0x3F | 0x80); // set bits 6-7 to 10 |
|
| 147 | + $data[6] = \chr(\ord($data[6]) & 0x0F|0x40); // set version to 0100 |
|
| 148 | + $data[8] = \chr(\ord($data[8]) & 0x3F|0x80); // set bits 6-7 to 10 |
|
| 149 | 149 | |
| 150 | 150 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(sodium_bin2hex($data), 4)); |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -if (! function_exists('getSimilarName')) { |
|
| 154 | +if (!function_exists('getSimilarName')) { |
|
| 155 | 155 | /** |
| 156 | 156 | * @param string $name |
| 157 | 157 | */ |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | -if (! function_exists('color')) { |
|
| 164 | +if (!function_exists('color')) { |
|
| 165 | 165 | /** |
| 166 | 166 | * @param string $string |
| 167 | 167 | */ |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | -if (! function_exists('human_filesize')) { |
|
| 174 | +if (!function_exists('human_filesize')) { |
|
| 175 | 175 | /** |
| 176 | 176 | * @param int $decimals |
| 177 | 177 | */ |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | -if (! function_exists('bcdechex')) { |
|
| 187 | +if (!function_exists('bcdechex')) { |
|
| 188 | 188 | /** |
| 189 | 189 | * @return string |
| 190 | 190 | */ |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | -if (! function_exists('runCmd')) { |
|
| 204 | +if (!function_exists('runCmd')) { |
|
| 205 | 205 | /** |
| 206 | 206 | * Run CLI command. |
| 207 | 207 | * |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | -if (! function_exists('escapeString')) { |
|
| 232 | +if (!function_exists('escapeString')) { |
|
| 233 | 233 | /** |
| 234 | 234 | * @return string |
| 235 | 235 | */ |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | -if (! function_exists('realDuration')) { |
|
| 242 | +if (!function_exists('realDuration')) { |
|
| 243 | 243 | /** |
| 244 | 244 | * @return string |
| 245 | 245 | */ |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | -if (! function_exists('is_it_json')) { |
|
| 254 | +if (!function_exists('is_it_json')) { |
|
| 255 | 255 | /** |
| 256 | 256 | * @param array|string $isIt |
| 257 | 257 | * @return bool |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | return $zipped; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | -if (! function_exists('release_flag')) { |
|
| 297 | +if (!function_exists('release_flag')) { |
|
| 298 | 298 | // Function inspired by c0r3@newznabforums adds country flags on the browse page. |
| 299 | 299 | /** |
| 300 | 300 | * @param string $text Text to match against. |
@@ -430,10 +430,10 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | return ''; |
| 432 | 432 | } |
| 433 | - if (! function_exists('sanitize')) { |
|
| 433 | + if (!function_exists('sanitize')) { |
|
| 434 | 434 | function sanitize(array|string $phrases, array $doNotSanitize = []): string |
| 435 | 435 | { |
| 436 | - if (! is_array($phrases)) { |
|
| 436 | + if (!is_array($phrases)) { |
|
| 437 | 437 | $wordArray = explode(' ', str_replace('.', ' ', $phrases)); |
| 438 | 438 | } else { |
| 439 | 439 | $wordArray = $phrases; |
@@ -444,9 +444,9 @@ discard block |
||
| 444 | 444 | foreach ($wordArray as $words) { |
| 445 | 445 | $words = preg_split('/\s+/', $words); |
| 446 | 446 | foreach ($words as $st) { |
| 447 | - if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 447 | + if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 448 | 448 | $str = $st; |
| 449 | - } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 449 | + } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
| 450 | 450 | $str = $st; |
| 451 | 451 | } else { |
| 452 | 452 | $str = Sanitizer::escape($st, $doNotSanitize); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | $binaries = new Binaries(['NNTP' => $nntp]); |
| 21 | 21 | |
| 22 | -if (isset($argv[1]) && ! is_numeric($argv[1])) { |
|
| 22 | +if (isset($argv[1]) && !is_numeric($argv[1])) { |
|
| 23 | 23 | $groupName = $argv[1]; |
| 24 | 24 | $colorCli->header("Updating group: $groupName"); |
| 25 | 25 | |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | } else { |
| 38 | 38 | try { |
| 39 | - $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : |
|
| 40 | - $maxHeaders)); |
|
| 39 | + $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : $maxHeaders)); |
|
| 41 | 40 | } catch (Throwable $e) { |
| 42 | 41 | Illuminate\Support\Facades\Log::error($e->getMessage()); |
| 43 | 42 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | 'false', |
| 35 | 35 | ]; |
| 36 | 36 | |
| 37 | -if (! isset($argv[1], $argv[2]) || ! in_array($argv[1], $args, false) || ! in_array($argv[2], $bool, false)) { |
|
| 37 | +if (!isset($argv[1], $argv[2]) || !in_array($argv[1], $args, false) || !in_array($argv[2], $bool, false)) { |
|
| 38 | 38 | exit( |
| 39 | 39 | (new Blacklight\ColorCLI())->error( |
| 40 | 40 | "\nIncorrect arguments.\n" |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | 'airdate', |
| 94 | 94 | 'episode_title', |
| 95 | 95 | ])->first(); |
| 96 | - if (! empty($result)) { |
|
| 96 | + if (!empty($result)) { |
|
| 97 | 97 | return $result->toArray(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $this->status = self::PROC_EXTFAIL; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (! empty($hits['title'])) { |
|
| 146 | + if (!empty($hits['title'])) { |
|
| 147 | 147 | $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -187,10 +187,10 @@ discard block |
||
| 187 | 187 | $anidbId = $this->getAnidbByName($tmpName); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - if (! empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
| 190 | + if (!empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
| 191 | 191 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid, $cleanArr['epno']); |
| 192 | 192 | if (empty($updatedAni)) { |
| 193 | - if (! empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
| 193 | + if (!empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
| 194 | 194 | $this->padb->populateTable('info', $anidbId->anidbid); |
| 195 | 195 | $this->doRandomSleep(); |
| 196 | 196 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function updatePreDb(array $parameters): void |
| 155 | 155 | { |
| 156 | - if (! empty($parameters)) { |
|
| 156 | + if (!empty($parameters)) { |
|
| 157 | 157 | $this->insertPredb($parameters); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -214,15 +214,15 @@ discard block |
||
| 214 | 214 | $resultData = []; |
| 215 | 215 | try { |
| 216 | 216 | $query = $this->search->setIndex($rt_index)->option('ranker', 'sph04')->option('sort_method', 'pq')->maxMatches(10000)->limit(10000)->sort('id', 'desc')->stripBadUtf8(true)->trackScores(true); |
| 217 | - if (! empty($searchArray)) { |
|
| 217 | + if (!empty($searchArray)) { |
|
| 218 | 218 | foreach ($searchArray as $key => $value) { |
| 219 | 219 | $query->search('@@relaxed @'.$key.' '.self::escapeString($value)); |
| 220 | 220 | } |
| 221 | - } elseif (! empty($searchString)) { |
|
| 221 | + } elseif (!empty($searchString)) { |
|
| 222 | 222 | // If $column is an array and has more than one item, implode it and wrap in parentheses. |
| 223 | - if (! empty($column) && \count($column) > 1) { |
|
| 223 | + if (!empty($column) && \count($column) > 1) { |
|
| 224 | 224 | $searchColumns = '@('.implode(',', $column).')'; |
| 225 | - } elseif (! empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
| 225 | + } elseif (!empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
| 226 | 226 | $searchColumns = '@'.$column[0]; |
| 227 | 227 | } else { |
| 228 | 228 | $searchColumns = ''; // Careful, this will search all columns. |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $this->colorCli = new ColorCLI(); |
| 75 | 75 | |
| 76 | 76 | $this->tmpPath = config('nntmux.tmp_unrar_path'); |
| 77 | - if (! preg_match('/[\/\\\\]$/', $this->tmpPath)) { |
|
| 77 | + if (!preg_match('/[\/\\\\]$/', $this->tmpPath)) { |
|
| 78 | 78 | $this->tmpPath .= '/'; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $size = \strlen($possibleNFO); |
| 136 | 136 | if ($size < 65535 && |
| 137 | 137 | $size > 11 && |
| 138 | - ! preg_match( |
|
| 138 | + !preg_match( |
|
| 139 | 139 | '/\A(\s*<\?xml|=newz\[NZB\]=|RIFF|\s*[RP]AR|.{0,10}(JFIF|matroska|ftyp|ID3))|;\s*Generated\s*by.*SF\w/i', |
| 140 | 140 | $possibleNFO |
| 141 | 141 | )) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // Linux boxes have 'file' (so should Macs), Windows *can* have it too: see GNUWIN.txt in docs. |
| 147 | 147 | $result = Utility::fileInfo($tmpPath); |
| 148 | - if (! empty($result)) { |
|
| 148 | + if (!empty($result)) { |
|
| 149 | 149 | // Check if it's text. |
| 150 | 150 | if (preg_match('/(ASCII|ISO-8859|UTF-(8|16|32).*?)\s*text/', $result)) { |
| 151 | 151 | @File::delete($tmpPath); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | Release::whereId($release->id)->update(['nfostatus' => self::NFO_FOUND]); |
| 205 | 205 | |
| 206 | - if (! isset($release->completion)) { |
|
| 206 | + if (!isset($release->completion)) { |
|
| 207 | 207 | $release->completion = 0; |
| 208 | 208 | } |
| 209 | 209 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $this->config->language = $this->lookuplanguage; |
| 138 | 138 | $this->config->throwHttpExceptions = false; |
| 139 | 139 | $cacheDir = storage_path('framework/cache/imdb_cache'); |
| 140 | - if (! File::isDirectory($cacheDir)) { |
|
| 140 | + if (!File::isDirectory($cacheDir)) { |
|
| 141 | 141 | File::makeDirectory($cacheDir, 0777, false, true); |
| 142 | 142 | } |
| 143 | 143 | $this->config->cachedir = $cacheDir; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | ORDER BY %s %s %s", |
| 191 | 191 | $this->showPasswords, |
| 192 | 192 | $this->getBrowseBy(), |
| 193 | - (! empty($catsrch) ? $catsrch : ''), |
|
| 193 | + (!empty($catsrch) ? $catsrch : ''), |
|
| 194 | 194 | ( |
| 195 | 195 | $maxAge > 0 |
| 196 | 196 | ? 'AND r.postdate > NOW() - INTERVAL '.$maxAge.'DAY ' |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | Cache::put(md5($moviesSql.$page), $movies, $expiresAt); |
| 211 | 211 | } |
| 212 | 212 | $movieIDs = $releaseIDs = []; |
| 213 | - if (! empty($movies['result'])) { |
|
| 213 | + if (!empty($movies['result'])) { |
|
| 214 | 214 | foreach ($movies['result'] as $movie => $id) { |
| 215 | 215 | $movieIDs[] = $id->imdbid; |
| 216 | 216 | $releaseIDs[] = $id->grp_release_id; |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | AND r.id IN (%s) %s |
| 250 | 250 | GROUP BY m.imdbid |
| 251 | 251 | ORDER BY %s %s", |
| 252 | - (\is_array($movieIDs) && ! empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
| 253 | - (\is_array($releaseIDs) && ! empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
| 254 | - (! empty($catsrch) ? $catsrch : ''), |
|
| 252 | + (\is_array($movieIDs) && !empty($movieIDs) ? implode(',', $movieIDs) : -1), |
|
| 253 | + (\is_array($releaseIDs) && !empty($releaseIDs) ? implode(',', $releaseIDs) : -1), |
|
| 254 | + (!empty($catsrch) ? $catsrch : ''), |
|
| 255 | 255 | $order[0], |
| 256 | 256 | $order[1] |
| 257 | 257 | ); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $browseBy = ' '; |
| 298 | 298 | $browseByArr = ['title', 'director', 'actors', 'genre', 'rating', 'year', 'imdb']; |
| 299 | 299 | foreach ($browseByArr as $bb) { |
| 300 | - if (request()->has($bb) && ! empty(request()->input($bb))) { |
|
| 300 | + if (request()->has($bb) && !empty(request()->input($bb))) { |
|
| 301 | 301 | $bbv = stripslashes(request()->input($bb)); |
| 302 | 302 | if ($bb === 'rating') { |
| 303 | 303 | $bbv .= '.'; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | if ($this->traktcheck !== null) { |
| 332 | 332 | $data = $this->traktTv->client->movieSummary('tt'.$imdbId, 'full'); |
| 333 | - if (($data !== false) && ! empty($data['trailer'])) { |
|
| 333 | + if (($data !== false) && !empty($data['trailer'])) { |
|
| 334 | 334 | return $data['trailer']; |
| 335 | 335 | } |
| 336 | 336 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | return false; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - if (! empty($data['trailer'])) { |
|
| 359 | + if (!empty($data['trailer'])) { |
|
| 360 | 360 | $data['trailer'] = str_ireplace( |
| 361 | 361 | ['watch?v=', 'http://'], |
| 362 | 362 | ['embed/', 'https://'], |
@@ -390,17 +390,17 @@ discard block |
||
| 390 | 390 | */ |
| 391 | 391 | private function checkTraktValue($value) |
| 392 | 392 | { |
| 393 | - if (\is_array($value) && ! empty($value)) { |
|
| 393 | + if (\is_array($value) && !empty($value)) { |
|
| 394 | 394 | $temp = ''; |
| 395 | 395 | foreach ($value as $val) { |
| 396 | - if (! \is_array($val) && ! \is_object($val)) { |
|
| 396 | + if (!\is_array($val) && !\is_object($val)) { |
|
| 397 | 397 | $temp .= $val; |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | $value = $temp; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - return ! empty($value) ? $value : ''; |
|
| 403 | + return !empty($value) ? $value : ''; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | */ |
| 422 | 422 | public function update(array $values): bool |
| 423 | 423 | { |
| 424 | - if (! \count($values)) { |
|
| 424 | + if (!\count($values)) { |
|
| 425 | 425 | return false; |
| 426 | 426 | } |
| 427 | 427 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $onDuplicateKey = ['created_at' => now()]; |
| 430 | 430 | $found = 0; |
| 431 | 431 | foreach ($values as $key => $value) { |
| 432 | - if (! empty($value)) { |
|
| 432 | + if (!empty($value)) { |
|
| 433 | 433 | $found++; |
| 434 | 434 | if (\in_array($key, ['genre', 'language'], false)) { |
| 435 | 435 | $value = substr($value, 0, 64); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $onDuplicateKey += [$key => $value]; |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | - if (! $found) { |
|
| 441 | + if (!$found) { |
|
| 442 | 442 | return false; |
| 443 | 443 | } |
| 444 | 444 | foreach ($query as $key => $value) { |
@@ -455,19 +455,19 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | protected function setVariables(string|array $variable1, string|array $variable2, string|array $variable3, string|array $variable4, string|array $variable5) |
| 457 | 457 | { |
| 458 | - if (! empty($variable1)) { |
|
| 458 | + if (!empty($variable1)) { |
|
| 459 | 459 | return $variable1; |
| 460 | 460 | } |
| 461 | - if (! empty($variable2)) { |
|
| 461 | + if (!empty($variable2)) { |
|
| 462 | 462 | return $variable2; |
| 463 | 463 | } |
| 464 | - if (! empty($variable3)) { |
|
| 464 | + if (!empty($variable3)) { |
|
| 465 | 465 | return $variable3; |
| 466 | 466 | } |
| 467 | - if (! empty($variable4)) { |
|
| 467 | + if (!empty($variable4)) { |
|
| 468 | 468 | return $variable4; |
| 469 | 469 | } |
| 470 | - if (! empty($variable5)) { |
|
| 470 | + if (!empty($variable5)) { |
|
| 471 | 471 | return $variable5; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | |
| 503 | 503 | $iTunes = $this->fetchItunesMovieProperties($this->currentTitle); |
| 504 | 504 | |
| 505 | - if (! $imdb && ! $tmdb && ! $trakt && ! $omdb && empty($iTunes)) { |
|
| 505 | + if (!$imdb && !$tmdb && !$trakt && !$omdb && empty($iTunes)) { |
|
| 506 | 506 | return false; |
| 507 | 507 | } |
| 508 | 508 | |
@@ -515,36 +515,36 @@ discard block |
||
| 515 | 515 | $mov['type'] = $mov['director'] = $mov['actors'] = $mov['language'] = ''; |
| 516 | 516 | |
| 517 | 517 | $mov['imdbid'] = $imdbId; |
| 518 | - $mov['tmdbid'] = (! isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
| 519 | - $mov['traktid'] = (! isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
| 518 | + $mov['tmdbid'] = (!isset($tmdb['tmdbid']) || $tmdb['tmdbid'] === '') ? 0 : $tmdb['tmdbid']; |
|
| 519 | + $mov['traktid'] = (!isset($trakt['id']) || $trakt['id'] === '') ? 0 : $trakt['id']; |
|
| 520 | 520 | |
| 521 | 521 | // Prefer Fanart.tv cover over TMDB,TMDB over IMDB,IMDB over OMDB and OMDB over iTunes. |
| 522 | - if (! empty($fanart['cover'])) { |
|
| 522 | + if (!empty($fanart['cover'])) { |
|
| 523 | 523 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $fanart['cover'], $this->imgSavePath); |
| 524 | - } elseif (! empty($tmdb['cover'])) { |
|
| 524 | + } elseif (!empty($tmdb['cover'])) { |
|
| 525 | 525 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $tmdb['cover'], $this->imgSavePath); |
| 526 | - } elseif (! empty($imdb['cover'])) { |
|
| 526 | + } elseif (!empty($imdb['cover'])) { |
|
| 527 | 527 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $imdb['cover'], $this->imgSavePath); |
| 528 | - } elseif (! empty($omdb['cover'])) { |
|
| 528 | + } elseif (!empty($omdb['cover'])) { |
|
| 529 | 529 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $omdb['cover'], $this->imgSavePath); |
| 530 | - } elseif (! empty($iTunes['cover'])) { |
|
| 530 | + } elseif (!empty($iTunes['cover'])) { |
|
| 531 | 531 | $mov['cover'] = $this->releaseImage->saveImage($imdbId.'-cover', $iTunes['cover'], $this->imgSavePath); |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | // Backdrops. |
| 535 | - if (! empty($fanart['backdrop'])) { |
|
| 535 | + if (!empty($fanart['backdrop'])) { |
|
| 536 | 536 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $fanart['backdrop'], $this->imgSavePath, 1920, 1024); |
| 537 | - } elseif (! empty($tmdb['backdrop'])) { |
|
| 537 | + } elseif (!empty($tmdb['backdrop'])) { |
|
| 538 | 538 | $mov['backdrop'] = $this->releaseImage->saveImage($imdbId.'-backdrop', $tmdb['backdrop'], $this->imgSavePath, 1920, 1024); |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | // Banner |
| 542 | - if (! empty($fanart['banner'])) { |
|
| 542 | + if (!empty($fanart['banner'])) { |
|
| 543 | 543 | $mov['banner'] = $this->releaseImage->saveImage($imdbId.'-banner', $fanart['banner'], $this->imgSavePath); |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | // RottenTomatoes rating from OmdbAPI |
| 547 | - if ($omdb !== false && ! empty($omdb['rtRating'])) { |
|
| 547 | + if ($omdb !== false && !empty($omdb['rtRating'])) { |
|
| 548 | 548 | $mov['rtrating'] = $omdb['rtRating']; |
| 549 | 549 | } |
| 550 | 550 | |
@@ -555,29 +555,29 @@ discard block |
||
| 555 | 555 | $mov['year'] = $this->setVariables($imdb['year'] ?? '', $tmdb['year'] ?? '', $trakt['year'] ?? '', $omdb['year'] ?? '', $iTunes['year'] ?? ''); |
| 556 | 556 | $mov['genre'] = $this->setVariables($imdb['genre'] ?? '', $tmdb['genre'] ?? '', $trakt['genres'] ?? '', $omdb['genre'] ?? '', $iTunes['genre'] ?? ''); |
| 557 | 557 | |
| 558 | - if (! empty($imdb['type'])) { |
|
| 558 | + if (!empty($imdb['type'])) { |
|
| 559 | 559 | $mov['type'] = $imdb['type']; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - if (! empty($imdb['director'])) { |
|
| 562 | + if (!empty($imdb['director'])) { |
|
| 563 | 563 | $mov['director'] = \is_array($imdb['director']) ? implode(', ', array_unique($imdb['director'])) : $imdb['director']; |
| 564 | - } elseif (! empty($omdb['director'])) { |
|
| 564 | + } elseif (!empty($omdb['director'])) { |
|
| 565 | 565 | $mov['director'] = \is_array($omdb['director']) ? implode(', ', array_unique($omdb['director'])) : $omdb['director']; |
| 566 | - } elseif (! empty($tmdb['director'])) { |
|
| 566 | + } elseif (!empty($tmdb['director'])) { |
|
| 567 | 567 | $mov['director'] = \is_array($tmdb['director']) ? implode(', ', array_unique($tmdb['director'])) : $tmdb['director']; |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - if (! empty($imdb['actors'])) { |
|
| 570 | + if (!empty($imdb['actors'])) { |
|
| 571 | 571 | $mov['actors'] = \is_array($imdb['actors']) ? implode(', ', array_unique($imdb['actors'])) : $imdb['actors']; |
| 572 | - } elseif (! empty($omdb['actors'])) { |
|
| 572 | + } elseif (!empty($omdb['actors'])) { |
|
| 573 | 573 | $mov['actors'] = \is_array($omdb['actors']) ? implode(', ', array_unique($omdb['actors'])) : $omdb['actors']; |
| 574 | - } elseif (! empty($tmdb['actors'])) { |
|
| 574 | + } elseif (!empty($tmdb['actors'])) { |
|
| 575 | 575 | $mov['actors'] = \is_array($tmdb['actors']) ? implode(', ', array_unique($tmdb['actors'])) : $tmdb['actors']; |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - if (! empty($imdb['language'])) { |
|
| 578 | + if (!empty($imdb['language'])) { |
|
| 579 | 579 | $mov['language'] = \is_array($imdb['language']) ? implode(', ', array_unique($imdb['language'])) : $imdb['language']; |
| 580 | - } elseif (! empty($omdb['language']) && ! is_bool($omdb['language'])) { |
|
| 580 | + } elseif (!empty($omdb['language']) && !is_bool($omdb['language'])) { |
|
| 581 | 581 | $mov['language'] = \is_array($omdb['language']) ? implode(', ', array_unique($omdb['language'])) : $omdb['language']; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -635,20 +635,20 @@ discard block |
||
| 635 | 635 | if ($this->fanartapikey !== null) { |
| 636 | 636 | $art = $this->fanart->getMovieFanArt('tt'.$imdbId); |
| 637 | 637 | |
| 638 | - if (! empty($art)) { |
|
| 638 | + if (!empty($art)) { |
|
| 639 | 639 | if (isset($art['status']) && $art['status'] === 'error') { |
| 640 | 640 | return false; |
| 641 | 641 | } |
| 642 | 642 | $ret = []; |
| 643 | - if (! empty($art['moviebackground'][0]['url'])) { |
|
| 643 | + if (!empty($art['moviebackground'][0]['url'])) { |
|
| 644 | 644 | $ret['backdrop'] = $art['moviebackground'][0]['url']; |
| 645 | - } elseif (! empty($art['moviethumb'][0]['url'])) { |
|
| 645 | + } elseif (!empty($art['moviethumb'][0]['url'])) { |
|
| 646 | 646 | $ret['backdrop'] = $art['moviethumb'][0]['url']; |
| 647 | 647 | } |
| 648 | - if (! empty($art['movieposter'][0]['url'])) { |
|
| 648 | + if (!empty($art['movieposter'][0]['url'])) { |
|
| 649 | 649 | $ret['cover'] = $art['movieposter'][0]['url']; |
| 650 | 650 | } |
| 651 | - if (! empty($art['moviebanner'][0]['url'])) { |
|
| 651 | + if (!empty($art['moviebanner'][0]['url'])) { |
|
| 652 | 652 | $ret['banner'] = $art['moviebanner'][0]['url']; |
| 653 | 653 | } |
| 654 | 654 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | return false; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if (! empty($tmdbLookup)) { |
|
| 688 | + if (!empty($tmdbLookup)) { |
|
| 689 | 689 | if ($this->currentTitle !== '') { |
| 690 | 690 | // Check the similarity. |
| 691 | 691 | similar_text($this->currentTitle, $tmdbLookup['title'], $percent); |
@@ -714,7 +714,7 @@ discard block |
||
| 714 | 714 | $ret['rating'] = ''; |
| 715 | 715 | } |
| 716 | 716 | $actors = Arr::pluck($tmdbLookup['credits']['cast'], 'name'); |
| 717 | - if (! empty($actors)) { |
|
| 717 | + if (!empty($actors)) { |
|
| 718 | 718 | $ret['actors'] = $actors; |
| 719 | 719 | } else { |
| 720 | 720 | $ret['actors'] = ''; |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | } |
| 726 | 726 | } |
| 727 | 727 | $overview = $tmdbLookup['overview']; |
| 728 | - if (! empty($overview)) { |
|
| 728 | + if (!empty($overview)) { |
|
| 729 | 729 | $ret['plot'] = $overview; |
| 730 | 730 | } else { |
| 731 | 731 | $ret['plot'] = ''; |
@@ -735,13 +735,13 @@ discard block |
||
| 735 | 735 | $ret['tagline'] = $tagline ?? ''; |
| 736 | 736 | |
| 737 | 737 | $released = $tmdbLookup['release_date']; |
| 738 | - if (! empty($released)) { |
|
| 738 | + if (!empty($released)) { |
|
| 739 | 739 | $ret['year'] = Carbon::parse($released)->year; |
| 740 | 740 | } else { |
| 741 | 741 | $ret['year'] = ''; |
| 742 | 742 | } |
| 743 | 743 | $genresa = $tmdbLookup['genres']; |
| 744 | - if (! empty($genresa) && \count($genresa) > 0) { |
|
| 744 | + if (!empty($genresa) && \count($genresa) > 0) { |
|
| 745 | 745 | $genres = []; |
| 746 | 746 | foreach ($genresa as $genre) { |
| 747 | 747 | $genres[] = $genre['name']; |
@@ -751,13 +751,13 @@ discard block |
||
| 751 | 751 | $ret['genre'] = ''; |
| 752 | 752 | } |
| 753 | 753 | $posterp = $tmdbLookup['poster_path']; |
| 754 | - if (! empty($posterp)) { |
|
| 754 | + if (!empty($posterp)) { |
|
| 755 | 755 | $ret['cover'] = 'https://image.tmdb.org/t/p/original'.$posterp; |
| 756 | 756 | } else { |
| 757 | 757 | $ret['cover'] = ''; |
| 758 | 758 | } |
| 759 | 759 | $backdrop = $tmdbLookup['backdrop_path']; |
| 760 | - if (! empty($backdrop)) { |
|
| 760 | + if (!empty($backdrop)) { |
|
| 761 | 761 | $ret['backdrop'] = 'https://image.tmdb.org/t/p/original'.$backdrop; |
| 762 | 762 | } else { |
| 763 | 763 | $ret['backdrop'] = ''; |
@@ -779,9 +779,9 @@ discard block |
||
| 779 | 779 | { |
| 780 | 780 | $realId = (new Title($imdbId, $this->config))->real_id(); |
| 781 | 781 | $result = new Title($realId, $this->config); |
| 782 | - $title = ! empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
| 783 | - if (! empty($title)) { |
|
| 784 | - if (! empty($this->currentTitle)) { |
|
| 782 | + $title = !empty($result->orig_title()) ? $result->orig_title() : $result->title(); |
|
| 783 | + if (!empty($title)) { |
|
| 784 | + if (!empty($this->currentTitle)) { |
|
| 785 | 785 | similar_text($this->currentTitle, $title, $percent); |
| 786 | 786 | if ($percent >= self::MATCH_PERCENT) { |
| 787 | 787 | similar_text($this->currentYear, $result->year(), $percent); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | 'title' => $title, |
| 791 | 791 | 'tagline' => $result->tagline() ?? '', |
| 792 | 792 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
| 793 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
| 793 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
| 794 | 794 | 'year' => $result->year() ?? '', |
| 795 | 795 | 'cover' => $result->photo() ?? '', |
| 796 | 796 | 'genre' => $result->genre() ?? '', |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | 'title' => $title, |
| 816 | 816 | 'tagline' => $result->tagline() ?? '', |
| 817 | 817 | 'plot' => Arr::get($result->plot_split(), '0.plot'), |
| 818 | - 'rating' => ! empty($result->rating()) ? $result->rating() : '', |
|
| 818 | + 'rating' => !empty($result->rating()) ? $result->rating() : '', |
|
| 819 | 819 | 'year' => $result->year() ?? '', |
| 820 | 820 | 'cover' => $result->photo() ?? '', |
| 821 | 821 | 'genre' => $result->genre() ?? '', |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | if ($this->omdbapikey !== null) { |
| 890 | 890 | $resp = $this->omdbApi->fetch('i', 'tt'.$imdbId); |
| 891 | 891 | |
| 892 | - if (\is_object($resp) && $resp->message === 'OK' && ! Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
| 892 | + if (\is_object($resp) && $resp->message === 'OK' && !Str::contains($resp->data->Response, 'Error:') && $resp->data->Response !== 'False') { |
|
| 893 | 893 | similar_text($this->currentTitle, $resp->data->Title, $percent); |
| 894 | 894 | if ($percent >= self::MATCH_PERCENT) { |
| 895 | 895 | similar_text($this->currentYear, $resp->data->Year, $percent); |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | // Loop over releases. |
| 1056 | 1056 | foreach ($res as $arr) { |
| 1057 | 1057 | // Try to get a name/year. |
| 1058 | - if (! $this->parseMovieSearchName($arr['searchname'])) { |
|
| 1058 | + if (!$this->parseMovieSearchName($arr['searchname'])) { |
|
| 1059 | 1059 | //We didn't find a name, so set to all 0's so we don't parse again. |
| 1060 | 1060 | Release::query()->where('id', $arr['id'])->update(['imdbid' => 0000000]); |
| 1061 | 1061 | |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | $imdbSearch = new TitleSearch($this->config); |
| 1090 | 1090 | foreach ($imdbSearch->search($this->currentTitle, [TitleSearch::MOVIE]) as $imdbTitle) { |
| 1091 | 1091 | try { |
| 1092 | - if (! empty($imdbTitle->title())) { |
|
| 1092 | + if (!empty($imdbTitle->title())) { |
|
| 1093 | 1093 | similar_text($imdbTitle->title(), $this->currentTitle, $percent); |
| 1094 | 1094 | if ($percent >= self::MATCH_PERCENT) { |
| 1095 | 1095 | similar_text($this->currentYear, $imdbTitle->year(), $percent); |
@@ -1119,10 +1119,10 @@ discard block |
||
| 1119 | 1119 | $buffer = $this->omdbApi->search($omdbTitle, 'movie'); |
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - if (\is_object($buffer) && $buffer->message === 'OK' && ! Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
| 1122 | + if (\is_object($buffer) && $buffer->message === 'OK' && !Str::contains($buffer->data->Response, 'Error:') && $buffer->data->Response === 'True') { |
|
| 1123 | 1123 | $getIMDBid = $buffer->data->Search[0]->imdbID; |
| 1124 | 1124 | |
| 1125 | - if (! empty($getIMDBid)) { |
|
| 1125 | + if (!empty($getIMDBid)) { |
|
| 1126 | 1126 | $imdbId = $this->doMovieUpdate($getIMDBid, 'OMDbAPI', $arr['id']); |
| 1127 | 1127 | if ($imdbId !== false) { |
| 1128 | 1128 | $movieUpdated = true; |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | $data = $this->traktTv->client->movieSummary($movieName, 'full'); |
| 1138 | 1138 | if ($data !== false) { |
| 1139 | 1139 | $this->parseTraktTv($data); |
| 1140 | - if (! empty($data['ids']['imdb'])) { |
|
| 1140 | + if (!empty($data['ids']['imdb'])) { |
|
| 1141 | 1141 | $imdbId = $this->doMovieUpdate($data['ids']['imdb'], 'Trakt', $arr['id']); |
| 1142 | 1142 | if ($imdbId !== false) { |
| 1143 | 1143 | $movieUpdated = true; |
@@ -1150,13 +1150,13 @@ discard block |
||
| 1150 | 1150 | if ($movieUpdated === false) { |
| 1151 | 1151 | try { |
| 1152 | 1152 | $data = Tmdb::getSearchApi()->searchMovies($this->currentTitle); |
| 1153 | - if (($data['total_results'] > 0) && ! empty($data['results'])) { |
|
| 1153 | + if (($data['total_results'] > 0) && !empty($data['results'])) { |
|
| 1154 | 1154 | foreach ($data['results'] as $result) { |
| 1155 | - if (! empty($result['id']) && ! empty($result['release_date'])) { |
|
| 1155 | + if (!empty($result['id']) && !empty($result['release_date'])) { |
|
| 1156 | 1156 | similar_text($this->currentYear, Carbon::parse($result['release_date'])->year, $percent); |
| 1157 | 1157 | if ($percent >= self::YEAR_MATCH_PERCENT) { |
| 1158 | 1158 | $ret = $this->fetchTMDBProperties($result['id'], true); |
| 1159 | - if ($ret !== false && ! empty($ret['imdbid'])) { |
|
| 1159 | + if ($ret !== false && !empty($ret['imdbid'])) { |
|
| 1160 | 1160 | $imdbId = $this->doMovieUpdate('tt'.$ret['imdbid'], 'TMDB', $arr['id']); |
| 1161 | 1161 | if ($imdbId !== false) { |
| 1162 | 1162 | $movieUpdated = true; |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | // Finally remove multiple spaces and trim leading spaces. |
| 1258 | 1258 | $name = trim(preg_replace('/\s{2,}/', ' ', $name)); |
| 1259 | 1259 | // Check if the name is long enough and not just numbers. |
| 1260 | - if (\strlen($name) > 4 && ! preg_match('/^\d+$/', $name)) { |
|
| 1260 | + if (\strlen($name) > 4 && !preg_match('/^\d+$/', $name)) { |
|
| 1261 | 1261 | $this->currentTitle = $name; |
| 1262 | 1262 | $this->currentYear = $year; |
| 1263 | 1263 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | public function beginImport($filesToProcess, bool $useNzbName = false, bool $delete = false, bool $deleteFailed = false): bool|string |
| 81 | 81 | { |
| 82 | 82 | // Get all the groups in the DB. |
| 83 | - if (! $this->getAllGroups()) { |
|
| 83 | + if (!$this->getAllGroups()) { |
|
| 84 | 84 | if ($this->browser) { |
| 85 | 85 | return $this->retVal; |
| 86 | 86 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | gzwrite($fp, $nzbString); |
| 146 | 146 | gzclose($fp); |
| 147 | 147 | |
| 148 | - if (! File::isFile($path)) { |
|
| 148 | + if (!File::isFile($path)) { |
|
| 149 | 149 | $this->echoOut('ERROR: Problem compressing NZB file to: '.$path); |
| 150 | 150 | |
| 151 | 151 | // Remove the release. |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if ($groupID === -1) { |
| 232 | 232 | if (array_key_exists($group, $this->allGroups)) { |
| 233 | 233 | $groupID = $this->allGroups[$group]; |
| 234 | - if (! $groupName) { |
|
| 234 | + if (!$groupName) { |
|
| 235 | 235 | $groupName = $group; |
| 236 | 236 | } |
| 237 | 237 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // If we found a group and it's not blacklisted. |
| 268 | - if ($groupID !== -1 && ! $isBlackListed) { |
|
| 268 | + if ($groupID !== -1 && !$isBlackListed) { |
|
| 269 | 269 | // Get the size of the release. |
| 270 | 270 | if (\count($file->segments->segment) > 0) { |
| 271 | 271 | foreach ($file->segments->segment as $segment) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $user = User::query()->where('email', '=', $payload['metadata']['buyerEmail'])->first(); |
| 106 | 106 | if ($user) { |
| 107 | 107 | $checkOrder = Payment::query()->where('invoice_id', '=', $payload['invoiceId'])->where('payment_status', '=', 'Settled')->first(); |
| 108 | - if (! empty($checkOrder)) { |
|
| 108 | + if (!empty($checkOrder)) { |
|
| 109 | 109 | Log::error('Duplicate BTCPay webhook: '.$payload['webhookId']); |
| 110 | 110 | |
| 111 | 111 | return response('Not Found', 404); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | } elseif ($payload['type'] === 'InvoiceSettled') { |
| 135 | 135 | // Check if we have the invoice_id in payments table and if we do, update the user account |
| 136 | 136 | $checkOrder = Payment::query()->where('invoice_id', '=', $payload['invoiceId'])->where('payment_status', '=', 'Settled')->first(); |
| 137 | - if (! empty($checkOrder)) { |
|
| 137 | + if (!empty($checkOrder)) { |
|
| 138 | 138 | $user = User::query()->where('email', '=', $checkOrder->email)->first(); |
| 139 | 139 | if ($user) { |
| 140 | 140 | preg_match('/(?P<role>\w+(\s\+\+)?)[\s](?P<addYears>\d+)/i', $checkOrder->item_description, $matches); |