diff --git a/Blacklight/Books.php b/Blacklight/Books.php index 4bcde305b..81751cfd3 100755 --- a/Blacklight/Books.php +++ b/Blacklight/Books.php @@ -309,7 +309,7 @@ class Books if ($bookInfo !== false) { if ($this->echooutput) { - $this->colorCli->climate()->info('Looking up: '.$bookInfo); + $this->colorCli->info('Looking up: '.$bookInfo); } // Do a local lookup first @@ -318,7 +318,7 @@ class Books if ($bookCheck === null && \in_array($bookInfo, $this->failCache, false)) { // Lookup recently failed, no point trying again if ($this->echooutput) { - $this->colorCli->climate()->info('Cached previous failure. Skipping.'); + $this->colorCli->info('Cached previous failure. Skipping.'); } $bookId = -2; } elseif ($bookCheck === null) { diff --git a/Blacklight/ColorCLI.php b/Blacklight/ColorCLI.php index 939a629bc..3272ca19f 100755 --- a/Blacklight/ColorCLI.php +++ b/Blacklight/ColorCLI.php @@ -2,122 +2,147 @@ namespace Blacklight; -use League\CLImate\CLImate; +use function Termwind\{render}; /** * Class ColorCLI. */ class ColorCLI { - protected CLImate $climate; - - /** - * ColorCLI constructor. - */ - public function __construct() - { - $this->climate = new CLImate; - } - public function debug(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->lightGray()->out($str); + render("
{$str}
"); } public function info(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->magenta()->out($str); + render("
{$str}
"); } public function notice(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->blue()->out($str); + render("
{$str}
"); } public function warning(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->yellow()->out($str); + render("
{$str}
"); } public function error(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->red()->out($str); + render("
{$str}
"); } public function primary(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->green()->out($str); + render("
{$str}
"); } public function header(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->yellow()->out($str); + render("
{$str}
"); } public function alternate(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->magenta()->bold()->out($str); + render("
{$str}
"); } public function tmuxOrange(string $str, bool $newline = false): void { if ($newline) { - $this->climate->br(); + render('
'); } - $this->climate->yellow()->bold()->out($str); + render("
{$str}
"); } public function primaryOver(string $str): void { - $this->climate->green()->inline($str); + echo "\033[32m{$str}\033[0m"; } public function headerOver(string $str): void { - $this->climate->yellow()->inline($str); + echo "\033[33m{$str}\033[0m"; } public function alternateOver(string $str): void { - $this->climate->magenta()->bold()->inline($str); + echo "\033[1;35m{$str}\033[0m"; } public function warningOver(string $str): void { - $this->climate->red()->inline($str); + echo "\033[31m{$str}\033[0m"; } - public function progress(): mixed + public function progress(): object { - return $this->climate->progress(); - } + return new class { + private int $total = 0; + private int $current = 0; + private string $label = ''; - public function climate(): CLImate - { - return $this->climate; + public function total(int $total): self + { + $this->total = $total; + return $this; + } + + public function current(int $current, ?string $label = null): void + { + $this->current = $current; + if ($label !== null) { + $this->label = $label; + } + $this->display(); + } + + public function advance(int $step = 1, ?string $label = null): void + { + $this->current += $step; + if ($label !== null) { + $this->label = $label; + } + $this->display(); + } + + private function display(): void + { + $percentage = $this->total > 0 ? (int) (($this->current / $this->total) * 100) : 0; + $bar = str_repeat('=', (int) ($percentage / 2)); + $spaces = str_repeat(' ', 50 - (int) ($percentage / 2)); + $label = $this->label ? " {$this->label}" : ''; + echo "\r[{$bar}{$spaces}] {$percentage}%{$label}"; + if ($this->current >= $this->total) { + echo "\n"; + } + } + }; } } diff --git a/Blacklight/Console.php b/Blacklight/Console.php index 1ff4fc91c..368343f45 100755 --- a/Blacklight/Console.php +++ b/Blacklight/Console.php @@ -745,7 +745,7 @@ class Console if ($gameInfo !== false) { if ($this->echooutput) { - $this->colorCli->climate()->info('Looking up: '.$gameInfo['title'].' ('.$gameInfo['platform'].')'); + $this->colorCli->info('Looking up: '.$gameInfo['title'].' ('.$gameInfo['platform'].')'); } // Check for existing console entry. @@ -754,7 +754,7 @@ class Console if ($gameCheck === false && \in_array($gameInfo['title'].$gameInfo['platform'], $this->failCache, false)) { // Lookup recently failed, no point trying again if ($this->echooutput) { - $this->colorCli->climate()->info('Cached previous failure. Skipping.'); + $this->colorCli->info('Cached previous failure. Skipping.'); } $gameId = -2; } elseif ($gameCheck === false) { diff --git a/Blacklight/Games.php b/Blacklight/Games.php index 56c3c0084..9d830fc10 100755 --- a/Blacklight/Games.php +++ b/Blacklight/Games.php @@ -581,7 +581,7 @@ class Games $gameInfo = $this->parseTitle($arr['searchname']); if ($gameInfo !== false) { if ($this->echoOutput) { - $this->colorCli->climate()->info('Looking up: '.$gameInfo['title'].' (PC)'); + $this->colorCli->info('Looking up: '.$gameInfo['title'].' (PC)'); } // Check for existing games entry. $gameCheck = $this->getGamesInfoByName($gameInfo['title']); diff --git a/Blacklight/Movie.php b/Blacklight/Movie.php index 79edbc4e3..0633efa59 100755 --- a/Blacklight/Movie.php +++ b/Blacklight/Movie.php @@ -661,7 +661,7 @@ class Movie $ret['title'] = $art['name']; } if ($this->echooutput) { - $this->colorCli->climate()->info('Fanart found '.$ret['title']); + $this->colorCli->info('Fanart found '.$ret['title']); } return $ret; @@ -794,7 +794,7 @@ class Movie // Log success if ($this->echooutput) { - $this->colorCli->climate()->info('TMDb found '.$ret['title']); + $this->colorCli->info('TMDb found '.$ret['title']); } // Cache the result @@ -878,7 +878,7 @@ class Movie // Log success if ($this->echooutput) { - $this->colorCli->climate()->info('IMDb found '.$title); + $this->colorCli->info('IMDb found '.$title); } // Cache the successful result @@ -969,7 +969,7 @@ class Movie // Log success if ($this->echooutput) { - $this->colorCli->climate()->info('Trakt found '.$movieData['title']); + $this->colorCli->info('Trakt found '.$movieData['title']); } // Cache the successful result @@ -1069,7 +1069,7 @@ class Movie // Log success if ($this->echooutput) { - $this->colorCli->climate()->info('OMDbAPI Found '.$movieData['title']); + $this->colorCli->info('OMDbAPI Found '.$movieData['title']); } // Cache the successful result @@ -1139,7 +1139,7 @@ class Movie // Log success if ($this->echooutput) { - $this->colorCli->climate()->info('iTunes found '.$movieData['title']); + $this->colorCli->info('iTunes found '.$movieData['title']); } // Cache the successful result @@ -1193,7 +1193,7 @@ class Movie try { $this->service = $service; if ($this->echooutput && $this->service !== '') { - $this->colorCli->climate()->info($this->service.' found IMDBid: tt'.$imdbId); + $this->colorCli->info($this->service.' found IMDBid: tt'.$imdbId); } // Get movie info ID @@ -1334,7 +1334,7 @@ class Movie // Log current lookup if output is enabled if ($this->echooutput) { - $this->colorCli->climate()->info('Looking up: '.$movieName); + $this->colorCli->info('Looking up: '.$movieName); } // Try all available sources to find IMDB ID @@ -1348,7 +1348,7 @@ class Movie if ($foundIMDB) { // Movie was successfully updated by one of the services if ($this->echooutput) { - $this->colorCli->climate()->success('Successfully updated release with IMDB ID'); + $this->colorCli->primary('Successfully updated release with IMDB ID'); } continue; @@ -1357,7 +1357,7 @@ class Movie $releaseCheck = Release::query()->where('id', $arr['id'])->whereNotNull('imdbid')->exists(); if ($releaseCheck) { if ($this->echooutput) { - $this->colorCli->climate()->info('Release already has IMDB ID, skipping'); + $this->colorCli->info('Release already has IMDB ID, skipping'); } continue; @@ -1379,7 +1379,7 @@ class Movie $this->colorCli->header('Failed to find IMDB IDs for '.count($failedIDs).' releases:'); foreach ($failedReleases as $release) { - $this->colorCli->climate()->error("ID: {$release->id} - {$release->searchname}"); + $this->colorCli->error("ID: {$release->id} - {$release->searchname}"); } } @@ -1621,7 +1621,7 @@ class Movie Cache::put($cacheKey, $match['imdbid'], now()->addDays(7)); if ($this->echooutput) { - $this->colorCli->climate()->info("Found local match: {$match['title']} ({$match['imdbid']})"); + $this->colorCli->info("Found local match: {$match['title']} ({$match['imdbid']})"); } return $match['imdbid']; diff --git a/Blacklight/Music.php b/Blacklight/Music.php index 2e566a6f1..35c024646 100755 --- a/Blacklight/Music.php +++ b/Blacklight/Music.php @@ -422,7 +422,7 @@ class Music $newname = $album['name'].' ('.$album['year'].')'; if ($this->echooutput) { - $this->colorCli->climate()->info('Looking up: '.$newname); + $this->colorCli->info('Looking up: '.$newname); } // Do a local lookup first diff --git a/Blacklight/NNTP.php b/Blacklight/NNTP.php index 0c13e6b82..69c9db407 100755 --- a/Blacklight/NNTP.php +++ b/Blacklight/NNTP.php @@ -223,7 +223,7 @@ class NNTP extends \Net_NNTP_Client ': '. $cError; - return $this->throwError($this->colorCli->climate()->error($message)); + return $this->throwError($this->colorCli->error($message)); } // If we are connected, try to authenticate. @@ -261,7 +261,7 @@ class NNTP extends \Net_NNTP_Client $userName. ' ('.$aError.')'; - return $this->throwError($this->colorCli->climate()->error($message)); + return $this->throwError($this->colorCli->error($message)); } } } @@ -285,7 +285,7 @@ class NNTP extends \Net_NNTP_Client // If we somehow got out of the loop, return an error. $message = 'Unable to connect to '.$this->_currentServer.$enc; - return $this->throwError($this->colorCli->climate()->error($message)); + return $this->throwError($this->colorCli->error($message)); } /** @@ -609,7 +609,7 @@ class NNTP extends \Net_NNTP_Client } else { $message = 'Wrong Identifier type, array, int or string accepted. This type of var was passed: '.gettype($identifiers); - return $this->throwError($this->colorCli->climate()->error($message)); + return $this->throwError($this->colorCli->error($message)); } if ($aConnected === true) { @@ -759,7 +759,7 @@ class NNTP extends \Net_NNTP_Client $message = "Code {$data->code}: {$data->message}\nSkipping group: {$group}"; if ($this->_echo) { - $this->colorCli->climate()->error($message); + $this->colorCli->error($message); } $nntp->doQuit(); } @@ -921,7 +921,7 @@ class NNTP extends \Net_NNTP_Client if (! empty($deComp)) { $bytesReceived = \strlen($data); if ($this->_echo && $bytesReceived > 10240) { - $this->colorCli->climate()->primaryOver( + $this->colorCli->primaryOver( 'Received '.round($bytesReceived / 1024). 'KB from group ('.$this->group().').' ); @@ -934,7 +934,7 @@ class NNTP extends \Net_NNTP_Client } $message = 'Decompression of OVER headers failed.'; - return $this->throwError($this->colorCli->climate()->error($message), 1000); + return $this->throwError($this->colorCli->error($message), 1000); } // The buffer was not empty, so we know this was not the real ending, so reset $possibleTerm. $possibleTerm = false; @@ -952,7 +952,7 @@ class NNTP extends \Net_NNTP_Client if (empty($buffer)) { $message = 'Error fetching data from usenet server while downloading OVER headers.'; - return $this->throwError($this->colorCli->climate()->error($message), 1000); + return $this->throwError($this->colorCli->error($message), 1000); } } @@ -968,7 +968,7 @@ class NNTP extends \Net_NNTP_Client $message = 'Unspecified error while downloading OVER headers.'; - return $this->throwError($this->colorCli->climate()->error($message), 1000); + return $this->throwError($this->colorCli->error($message), 1000); } /** diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php index 9908f8634..e961db631 100755 --- a/Blacklight/NameFixer.php +++ b/Blacklight/NameFixer.php @@ -182,7 +182,7 @@ class NameFixer if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' releases to process.'); + $this->colorCLI->info(number_format($total).' releases to process.'); foreach ($releases as $rel) { $releaseRow = Release::fromQuery( @@ -212,7 +212,7 @@ class NameFixer } $this->_echoFoundCount($echo, ' NFO\'s'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -261,7 +261,7 @@ class NameFixer $total = $releases->count(); if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' file names to process.'); + $this->colorCLI->info(number_format($total).' file names to process.'); foreach ($releases as $release) { $this->reset(); @@ -272,7 +272,7 @@ class NameFixer $this->_echoFoundCount($echo, ' files'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -321,7 +321,7 @@ class NameFixer $total = $releases->count(); if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' CRC32\'s to process.'); + $this->colorCLI->info(number_format($total).' CRC32\'s to process.'); foreach ($releases as $release) { $this->reset(); @@ -332,7 +332,7 @@ class NameFixer $this->_echoFoundCount($echo, ' crc32\'s'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -379,7 +379,7 @@ class NameFixer $total = $releases->count(); if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' xxx file names to process.'); + $this->colorCLI->info(number_format($total).' xxx file names to process.'); foreach ($releases as $release) { $this->reset(); @@ -389,7 +389,7 @@ class NameFixer } $this->_echoFoundCount($echo, ' files'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -438,7 +438,7 @@ class NameFixer $total = $releases->count(); if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' srr file extensions to process.'); + $this->colorCLI->info(number_format($total).' srr file extensions to process.'); foreach ($releases as $release) { $this->reset(); @@ -448,7 +448,7 @@ class NameFixer } $this->_echoFoundCount($echo, ' files'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -494,7 +494,7 @@ class NameFixer if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' releases to process.'); + $this->colorCLI->info(number_format($total).' releases to process.'); $Nfo = new Nfo; $nzbContents = new NZBContents; @@ -508,7 +508,7 @@ class NameFixer } $this->_echoFoundCount($echo, ' files'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -560,7 +560,7 @@ class NameFixer $total = $releases->count(); if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' unique ids to process.'); + $this->colorCLI->info(number_format($total).' unique ids to process.'); foreach ($releases as $rel) { $this->checked++; $this->reset(); @@ -569,7 +569,7 @@ class NameFixer } $this->_echoFoundCount($echo, ' UID\'s'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -612,7 +612,7 @@ class NameFixer $total = $releases->count(); if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' mediainfo movie names to process.'); + $this->colorCLI->info(number_format($total).' mediainfo movie names to process.'); foreach ($releases as $rel) { $this->checked++; $this->reset(); @@ -621,7 +621,7 @@ class NameFixer } $this->_echoFoundCount($echo, ' MediaInfo\'s'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -678,7 +678,7 @@ class NameFixer $total = $releases->count(); if ($total > 0) { $this->_totalReleases = $total; - $this->colorCLI->climate()->info(number_format($total).' hash_16K to process.'); + $this->colorCLI->info(number_format($total).' hash_16K to process.'); foreach ($releases as $rel) { $this->checked++; $this->reset(); @@ -687,7 +687,7 @@ class NameFixer } $this->_echoFoundCount($echo, ' hashes'); } else { - $this->colorCLI->climate()->info('Nothing to fix.'); + $this->colorCLI->info('Nothing to fix.'); } } @@ -724,7 +724,7 @@ class NameFixer protected function _echoFoundCount(bool|int $echo, string $type): void { if ($echo === true) { - $this->colorCLI->climate()->info( + $this->colorCLI->info( PHP_EOL. number_format($this->fixed). ' releases have had their names changed out of: '. @@ -732,7 +732,7 @@ class NameFixer $type.'.' ); } else { - $this->colorCLI->climate()->info( + $this->colorCLI->info( PHP_EOL. number_format($this->fixed). ' releases could have their names changed. '. @@ -748,7 +748,7 @@ class NameFixer */ protected function _echoStartMessage(int $time, string $type): void { - $this->colorCLI->climate()->info( + $this->colorCLI->info( sprintf( 'Fixing search names %s using %s.', ($time === 1 ? 'in the past 6 hours' : 'since the beginning'), @@ -764,7 +764,7 @@ class NameFixer } if ($show === 2) { - $this->colorCLI->climate()->info( + $this->colorCLI->info( 'Renamed Releases: ['. number_format($this->fixed). '] '. @@ -1084,8 +1084,8 @@ class NameFixer $limit = 'LIMIT 1000000'; } - $this->colorCLI->climate()->info(PHP_EOL.'Match PreFiles '.$args[1].' Started at '.now()); - $this->colorCLI->climate()->info('Matching predb filename to cleaned release_files.name.'); + $this->colorCLI->info(PHP_EOL.'Match PreFiles '.$args[1].' Started at '.now()); + $this->colorCLI->info('Matching predb filename to cleaned release_files.name.'); $counter = $counted = 0; $timeStart = now(); @@ -1114,7 +1114,7 @@ class NameFixer $total = $query->count(); if ($total > 0) { - $this->colorCLI->climate()->info(PHP_EOL.number_format($total).' releases to process.'); + $this->colorCLI->info(PHP_EOL.number_format($total).' releases to process.'); foreach ($query as $row) { $success = $this->matchPreDbFiles($row, true, 1, $show); @@ -1122,12 +1122,12 @@ class NameFixer $counted++; } if ($show === 0) { - $this->colorCLI->climate()->info('Renamed Releases: ['.number_format($counted).'] '.(new ConsoleTools)->percentString(++$counter, $total)); + $this->colorCLI->info('Renamed Releases: ['.number_format($counted).'] '.(new ConsoleTools)->percentString(++$counter, $total)); } } - $this->colorCLI->climate()->info(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timeStart, true).' seconds'.'.'); + $this->colorCLI->info(PHP_EOL.'Renamed '.number_format($counted).' releases in '.now()->diffInSeconds($timeStart, true).' seconds'.'.'); } else { - $this->colorCLI->climate()->info('Nothing to do.'); + $this->colorCLI->info('Nothing to do.'); } } } diff --git a/Blacklight/ReleaseImage.php b/Blacklight/ReleaseImage.php index 6308cf8bc..ab11a34f3 100755 --- a/Blacklight/ReleaseImage.php +++ b/Blacklight/ReleaseImage.php @@ -72,7 +72,7 @@ class ReleaseImage $img = false; } catch (\Error $e) { - $this->colorCli->climate()->info($e->getMessage()); + $this->colorCli->info($e->getMessage()); $img = false; } diff --git a/Blacklight/XXX.php b/Blacklight/XXX.php index 68b788b44..e1274a58a 100755 --- a/Blacklight/XXX.php +++ b/Blacklight/XXX.php @@ -545,13 +545,13 @@ class XXX $check = $this->checkXXXInfoExists($this->currentTitle); if ($check === null) { if ($this->echoOutput) { - $this->colorCli->climate()->info('Looking up: '.$this->currentTitle); + $this->colorCli->info('Looking up: '.$this->currentTitle); } - $this->colorCli->climate()->info('Local match not found, checking web!'); + $this->colorCli->info('Local match not found, checking web!'); $idcheck = $this->updateXXXInfo($this->currentTitle); } else { - $this->colorCli->climate()->info('Local match found for XXX Movie: '.$this->currentTitle); + $this->colorCli->info('Local match found for XXX Movie: '.$this->currentTitle); $idcheck = (int) $check['id']; } } else { diff --git a/Blacklight/processing/post/AniDB.php b/Blacklight/processing/post/AniDB.php index c31e39f57..d0c4618ee 100755 --- a/Blacklight/processing/post/AniDB.php +++ b/Blacklight/processing/post/AniDB.php @@ -245,7 +245,7 @@ class AniDB // We ignore episode number 0 (Complete Series) for matching episodes but still link the title. if ($this->echooutput) { - $this->colorCli->climate()->info('Looking Up: Title: '.$title.' Episode: '.$epno); + $this->colorCli->info('Looking Up: Title: '.$title.' Episode: '.$epno); } $anidbTitle = $this->getAnidbByName($title); diff --git a/Blacklight/processing/tv/TVDB.php b/Blacklight/processing/tv/TVDB.php index f41777a65..be3a335f8 100755 --- a/Blacklight/processing/tv/TVDB.php +++ b/Blacklight/processing/tv/TVDB.php @@ -291,12 +291,12 @@ class TVDB extends TV $response = $this->client->search()->search($name, ['type' => 'series']); } catch (ResourceNotFoundException $e) { $response = false; - $this->colorCli->climate()->error('Show not found on TVDB'); + $this->colorCli->error('Show not found on TVDB'); } catch (UnauthorizedException $e) { try { $this->authorizeTvdb(); } catch (UnauthorizedException $error) { - $this->colorCli->climate()->error('Not authorized to access TVDB'); + $this->colorCli->error('Not authorized to access TVDB'); } } @@ -383,7 +383,7 @@ class TVDB extends TV try { $this->authorizeTvdb(); } catch (UnauthorizedException $error) { - $this->colorCli->climate()->error('Not authorized to access TVDB'); + $this->colorCli->error('Not authorized to access TVDB'); } } } else { @@ -431,13 +431,13 @@ class TVDB extends TV $poster = collect($poster)->where('type', 2)->sortByDesc('score')->first(); $this->posterUrl = ! empty($poster->image) ? $poster->image : ''; } catch (ResourceNotFoundException $e) { - $this->colorCli->climate()->error('Poster image not found on TVDB'); + $this->colorCli->error('Poster image not found on TVDB'); } catch (UnauthorizedException $error) { try { $this->authorizeTvdb(); } catch (UnauthorizedException $error) { - $this->colorCli->climate()->error('Not authorized to access TVDB'); + $this->colorCli->error('Not authorized to access TVDB'); } } @@ -445,9 +445,9 @@ class TVDB extends TV $imdbId = $this->client->series()->extended($show->tvdb_id); preg_match('/tt(?P\d{6,9})$/i', $imdbId->getIMDBId(), $imdb); } catch (ResourceNotFoundException $e) { - $this->colorCli->climate()->error('Show ImdbId not found on TVDB'); + $this->colorCli->error('Show ImdbId not found on TVDB'); } catch (\Exception) { - $this->colorCli->climate()->error('Error on TVDB, aborting'); + $this->colorCli->error('Error on TVDB, aborting'); } return [ diff --git a/Blacklight/processing/tv/TVMaze.php b/Blacklight/processing/tv/TVMaze.php index 1511798aa..1dc0501b0 100644 --- a/Blacklight/processing/tv/TVMaze.php +++ b/Blacklight/processing/tv/TVMaze.php @@ -105,10 +105,11 @@ class TVMaze extends TV // Get the show from TVMaze $tvMazeShow = $this->getShowInfo((string) $release['cleanname']); + $dupeCheck = false; + if (\is_array($tvMazeShow)) { $siteId = (int) $tvMazeShow['tvmaze']; // Check if we have the TVDB ID already, if we do use that Video ID, unless it is 0 - $dupeCheck = false; if ((int) $tvMazeShow['tvdb'] !== 0) { $dupeCheck = $this->getVideoIDFromSiteID('tvdb', $tvMazeShow['tvdb']); } diff --git a/composer.json b/composer.json index e2473c641..5e0e9a2e2 100644 --- a/composer.json +++ b/composer.json @@ -73,7 +73,6 @@ "laravel/tinker": "^2.10.1", "laravel/ui": "^4.6", "laravelcollective/html": "^6.4", - "league/climate": "^3.10", "leventcz/laravel-top": "^1.2", "livewire/livewire": "^3.6", "livewire/volt": "^1.6", diff --git a/composer.lock b/composer.lock index 674307535..9f5119f7d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "98e2c05b8152c21cf55c8986509cf527", + "content-hash": "7528edc3d565bc7ec9593a4fe70af488", "packages": [ { "name": "aharen/omdbapi", @@ -3970,72 +3970,6 @@ }, "time": "2025-03-21T20:56:50+00:00" }, - { - "name": "league/climate", - "version": "3.10.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/climate.git", - "reference": "237f70e1032b16d32ff3f65dcda68706911e1c74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/climate/zipball/237f70e1032b16d32ff3f65dcda68706911e1c74", - "reference": "237f70e1032b16d32ff3f65dcda68706911e1c74", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8.0", - "psr/log": "^1.0 || ^2.0 || ^3.0", - "seld/cli-prompt": "^1.0" - }, - "require-dev": { - "mikey179/vfsstream": "^1.6.12", - "mockery/mockery": "^1.6.12", - "phpunit/phpunit": "^9.5.10", - "squizlabs/php_codesniffer": "^3.10" - }, - "suggest": { - "ext-mbstring": "If ext-mbstring is not available you MUST install symfony/polyfill-mbstring" - }, - "type": "library", - "autoload": { - "psr-4": { - "League\\CLImate\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Joe Tannenbaum", - "email": "hey@joe.codes", - "homepage": "http://joe.codes/", - "role": "Developer" - }, - { - "name": "Craig Duncan", - "email": "git@duncanc.co.uk", - "homepage": "https://github.com/duncan3dc", - "role": "Developer" - } - ], - "description": "PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.", - "keywords": [ - "cli", - "colors", - "command", - "php", - "terminal" - ], - "support": { - "issues": "https://github.com/thephpleague/climate/issues", - "source": "https://github.com/thephpleague/climate/tree/3.10.0" - }, - "time": "2024-11-18T09:09:55+00:00" - }, { "name": "league/commonmark", "version": "2.7.1", @@ -8658,61 +8592,6 @@ }, "time": "2025-09-17T19:51:09+00:00" }, - { - "name": "seld/cli-prompt", - "version": "1.0.4", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/cli-prompt.git", - "reference": "b8dfcf02094b8c03b40322c229493bb2884423c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/b8dfcf02094b8c03b40322c229493bb2884423c5", - "reference": "b8dfcf02094b8c03b40322c229493bb2884423c5", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.63" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\CliPrompt\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", - "keywords": [ - "cli", - "console", - "hidden", - "input", - "prompt" - ], - "support": { - "issues": "https://github.com/Seldaek/cli-prompt/issues", - "source": "https://github.com/Seldaek/cli-prompt/tree/1.0.4" - }, - "time": "2020-12-15T21:32:01+00:00" - }, { "name": "sentry/sentry", "version": "4.17.1", diff --git a/misc/testing/PostProc/updateMovieImages.php b/misc/testing/PostProc/updateMovieImages.php index cebdb83a6..92506c00f 100644 --- a/misc/testing/PostProc/updateMovieImages.php +++ b/misc/testing/PostProc/updateMovieImages.php @@ -27,7 +27,7 @@ foreach ($itr as $filePath) { } else { $run = MovieInfo::query()->where('imdbid', '=', $hit[1])->select(['imdbid'])->get(); if ($run->count() === 0) { - $colorCli->climate()->error($filePath.' not found in db.'); + $colorCli->error($filePath.' not found in db.'); } } } @@ -41,7 +41,7 @@ foreach ($itr as $filePath) { } else { $run = MovieInfo::query()->where('imdbid', $match1[1])->select(['imdbid'])->get(); if ($run->count() === 0) { - $colorCli->climate()->error($filePath->getPathname().' not found in db.'); + $colorCli->error($filePath->getPathname().' not found in db.'); } } } @@ -60,10 +60,10 @@ $qry1 = MovieInfo::query()->where('backdrop', '=', 1)->select(['imdbid'])->get() foreach ($qry1 as $rows) { if (! is_file($path2covers.$rows['imdbid'].'-backdrop.jpg')) { MovieInfo::query()->where('backdrop', '=', 1)->where('imdbid', $rows['imdbid'])->update(['backdrop' => 0]); - $colorCli->climate()->info($path2covers.$rows['imdbid'].'-backdrop.jpg does not exist.'); + $colorCli->info($path2covers.$rows['imdbid'].'-backdrop.jpg does not exist.'); $deleted++; } } -$colorCli->climate()->info($covers.' covers set.'); -$colorCli->climate()->info($updated.' backdrops set.'); -$colorCli->climate()->info($deleted.' movies unset.'); +$colorCli->info($covers.' covers set.'); +$colorCli->info($updated.' backdrops set.'); +$colorCli->info($deleted.' movies unset.');