Fix echoing of cli messages (most of them)

This commit is contained in:
DariusIII
2018-02-14 14:07:12 +01:00
parent bf9092ede6
commit 05b0c894dd
22 changed files with 117 additions and 115 deletions
+3 -3
View File
@@ -152,7 +152,7 @@ class Backfill
$dMessage = 'Backfilling completed in '.number_format(microtime(true) - $allTime, 2).' seconds.';
if ($this->_echoCLI) {
ColorCLI::doEcho(ColorCLI::primary($dMessage));
ColorCLI::doEcho(ColorCLI::primary($dMessage), true);
}
} else {
$dMessage = 'No groups specified. Ensure groups are added to database for updating.';
@@ -190,7 +190,7 @@ class Backfill
'. Otherwise the group is dead, you must disable it.';
if ($this->_echoCLI) {
ColorCLI::doEcho(ColorCLI::error($dMessage));
ColorCLI::doEcho(ColorCLI::error($dMessage), true);
}
return;
@@ -259,7 +259,7 @@ class Backfill
'. Our oldest article is article '.
number_format($groupArr['first_record']).
'.'
)
), true
);
}
+6 -6
View File
@@ -995,7 +995,7 @@ class Binaries
ColorCLI::debug(
'Sending '.round(\strlen($partsQuery) / 1024, 2).
' KB of'.($this->multiGroup ? ' MGR' : '').' parts to MySQL'
)
), true
);
}
if (\strlen($partsQuery) === \strlen($partsCheck) ? true : $this->_pdo->queryExec(rtrim($partsQuery, ','))) {
@@ -1068,7 +1068,7 @@ class Binaries
'Received '.\count($this->headersReceived).
' articles of '.number_format($this->last - $this->first + 1).' requested, '.
$this->headersBlackListed.' blacklisted, '.$this->notYEnc.' not yEnc.'
)
), true
);
}
@@ -1090,7 +1090,7 @@ class Binaries
ColorCLI::primaryOver(' for part repair, ').
ColorCLI::alternateOver(number_format($currentMicroTime - $this->startLoop, 2).'s').
ColorCLI::primary(' total.')
);
, true);
}
}
@@ -1328,7 +1328,7 @@ class Binaries
$currentPost = $tempPost;
if ($this->_debug) {
ColorCLI::doEcho(ColorCLI::debug('Postdate retried '.$attempts.' time(s).'));
ColorCLI::doEcho(ColorCLI::debug('Postdate retried '.$attempts.' time(s).'), true);
}
} while ($attempts++ <= 20);
@@ -1375,7 +1375,7 @@ class Binaries
ColorCLI::doEcho(
ColorCLI::primary(
'Searching for an approximate article number for group '.$data['group'].' '.$days.' days back.'
)
), true
);
}
@@ -1436,7 +1436,7 @@ class Binaries
ColorCLI::primary(
PHP_EOL.'Found article #'.$wantedArticle.' which has a date of '.date('r', $articleTime).
', vs wanted date of '.date('r', $goalTime).'. Difference from goal is '.Carbon::createFromTimestamp($goalTime)->diffInDays(Carbon::createFromTimestamp($articleTime)).'days.'
)
), true
);
}
+10 -10
View File
@@ -421,7 +421,7 @@ class Books
{
if ($res instanceof \Traversable && $res->count() > 0) {
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header("\nProcessing ".$res->count().' book release(s) for categories id '.$categoryID));
ColorCLI::doEcho(ColorCLI::header("\nProcessing ".$res->count().' book release(s) for categories id '.$categoryID), true);
}
$bookId = -2;
@@ -439,7 +439,7 @@ class Books
if ($bookInfo !== false) {
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::headerOver('Looking up: ').ColorCLI::primary($bookInfo));
ColorCLI::doEcho(ColorCLI::headerOver('Looking up: ').ColorCLI::primary($bookInfo), true);
}
// Do a local lookup first
@@ -448,7 +448,7 @@ class Books
if ($bookCheck === false && \in_array($bookInfo, $this->failCache, false)) {
// Lookup recently failed, no point trying again
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.').PHP_EOL);
ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.'), true);
}
$bookId = -2;
} elseif ($bookCheck === false) {
@@ -478,7 +478,7 @@ class Books
}
}
} elseif ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header('No book releases to process for categories id '.$categoryID));
ColorCLI::doEcho(ColorCLI::header('No book releases to process for categories id '.$categoryID), true);
}
}
@@ -506,7 +506,7 @@ class Books
if (preg_match('/^([a-z0-9] )+$|ArtofUsenet|ekiosk|(ebook|mobi).+collection|erotica|Full Video|ImwithJamie|linkoff org|Mega.+pack|^[a-z0-9]+ (?!((January|February|March|April|May|June|July|August|September|O(c|k)tober|November|De(c|z)ember)))[a-z]+( (ebooks?|The))?$|NY Times|(Book|Massive) Dump|Sexual/i', $releasename)) {
if ($this->echooutput) {
ColorCLI::doEcho(
ColorCLI::headerOver('Changing category to misc books: ').ColorCLI::primary($releasename)
ColorCLI::headerOver('Changing category to misc books: ').ColorCLI::primary($releasename), true
);
}
Release::query()->where('id', $releaseID)->update(['categories_id' => Category::BOOKS_UNKNOWN]);
@@ -517,7 +517,7 @@ class Books
if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}(a|b|c)?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun( |e|$)|Jul( |y|$)|Aug( |ust|$)|Sep( |tember|$)|O(c|k)t( |ober|$)|Nov( |ember|$)|De(c|z)( |ember|$))/ui', $releasename) && ! preg_match('/Part \d+/i', $releasename)) {
if ($this->echooutput) {
ColorCLI::doEcho(
ColorCLI::headerOver('Changing category to magazines: ').ColorCLI::primary($releasename)
ColorCLI::headerOver('Changing category to magazines: ').ColorCLI::primary($releasename), true
);
}
Release::query()->where('id', $releaseID)->update(['categories_id' => Category::BOOKS_MAGAZINES]);
@@ -672,13 +672,13 @@ class Books
if ($bookId && $bookId !== -2) {
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header('Added/updated book: '));
ColorCLI::doEcho(ColorCLI::header('Added/updated book: '), true);
if ($book['author'] !== '') {
ColorCLI::doEcho(ColorCLI::alternateOver(' Author: ').ColorCLI::primary($book['author']));
ColorCLI::doEcho(ColorCLI::alternateOver(' Author: ').ColorCLI::primary($book['author']), true);
}
echo ColorCLI::alternateOver(' Title: ').ColorCLI::primary(' '.$book['title']);
if ($book['genre'] !== 'null') {
ColorCLI::doEcho(ColorCLI::alternateOver(' Genre: ').ColorCLI::primary(' '.$book['genre']));
ColorCLI::doEcho(ColorCLI::alternateOver(' Genre: ').ColorCLI::primary(' '.$book['genre']), true);
}
}
@@ -689,7 +689,7 @@ class Books
ColorCLI::header('Nothing to update: ').
ColorCLI::header($book['author'].
' - '.
$book['title'])
$book['title']), true
);
}
}
+6 -7
View File
@@ -420,7 +420,7 @@ class Console
ColorCLI::alternateOver(' Platform: ').
ColorCLI::primary($con['platform']).
ColorCLI::alternateOver(' Genre: ').
ColorCLI::primary($con['consolegenre'])
ColorCLI::primary($con['consolegenre']), true
);
}
}
@@ -812,7 +812,7 @@ class Console
$releaseCount = $res->count();
if ($res instanceof \Traversable && $releaseCount > 0) {
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header('Processing '.$releaseCount.' console release(s).'));
ColorCLI::doEcho(ColorCLI::header('Processing '.$releaseCount.' console release(s).'), true);
}
foreach ($res as $arr) {
@@ -829,7 +829,7 @@ class Console
$gameInfo['title'].
' ('.
$gameInfo['platform'].')'
)
), true
);
}
@@ -839,7 +839,7 @@ class Console
if ($gameCheck === null && \in_array($gameInfo['title'].$gameInfo['platform'], $this->failCache, false)) {
// Lookup recently failed, no point trying again
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.').PHP_EOL);
ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.'), true);
}
$gameId = -2;
} elseif ($gameCheck === null) {
@@ -853,8 +853,7 @@ class Console
if ($this->echooutput) {
ColorCLI::doEcho(
ColorCLI::headerOver('Found Local: ').
ColorCLI::primary("{$gameCheck['title']} - {$gameCheck['platform']}").
PHP_EOL
ColorCLI::primary("{$gameCheck['title']} - {$gameCheck['platform']}"), true
);
}
$gameId = $gameCheck['id'];
@@ -873,7 +872,7 @@ class Console
}
}
} elseif ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header('No console releases to process.'));
ColorCLI::doEcho(ColorCLI::header('No console releases to process.'), true);
}
}
+7 -7
View File
@@ -589,12 +589,12 @@ class Games
$game['review'] = (string) $this->_gameResults->deck;
}
} else {
ColorCLI::doEcho(ColorCLI::notice('GiantBomb returned no valid results'));
ColorCLI::doEcho(ColorCLI::notice('GiantBomb returned no valid results'), true);
return false;
}
} else {
ColorCLI::doEcho(ColorCLI::notice('GiantBomb found no valid results'));
ColorCLI::doEcho(ColorCLI::notice('GiantBomb found no valid results'), true);
return false;
}
@@ -702,7 +702,7 @@ class Games
ColorCLI::alternateOver(' Title: ').
ColorCLI::primary($game['title']).
ColorCLI::alternateOver(' Source: ').
ColorCLI::primary($this->_classUsed)
ColorCLI::primary($this->_classUsed), true
);
}
if ($game['cover'] === 1) {
@@ -715,7 +715,7 @@ class Games
if ($this->echoOutput) {
ColorCLI::doEcho(
ColorCLI::headerOver('Nothing to update: ').
ColorCLI::primary($game['title'].' (PC)')
ColorCLI::primary($game['title'].' (PC)'), true
);
}
}
@@ -747,7 +747,7 @@ class Games
if ($res instanceof \Traversable && $res->rowCount() > 0) {
if ($this->echoOutput) {
ColorCLI::doEcho(ColorCLI::header('Processing '.$res->rowCount().' games release(s).'));
ColorCLI::doEcho(ColorCLI::header('Processing '.$res->rowCount().' games release(s).'), true);
}
foreach ($res as $arr) {
@@ -760,7 +760,7 @@ class Games
if ($this->echoOutput) {
ColorCLI::doEcho(
ColorCLI::headerOver('Looking up: ').
ColorCLI::primary($gameInfo['title'].' (PC)')
ColorCLI::primary($gameInfo['title'].' (PC)'), true
);
}
@@ -793,7 +793,7 @@ class Games
}
} else {
if ($this->echoOutput) {
ColorCLI::doEcho(ColorCLI::header('No games releases to process.'));
ColorCLI::doEcho(ColorCLI::header('No games releases to process.'), true);
}
}
}
+25 -25
View File
@@ -620,7 +620,7 @@ class Movie
public function updateMovieInfo($imdbId): bool
{
if ($this->echooutput && $this->service !== '') {
ColorCLI::doEcho(ColorCLI::primary('Fetching IMDB info from TMDB/IMDB/Trakt/OMDB using IMDB id: '.$imdbId));
ColorCLI::doEcho(ColorCLI::primary('Fetching IMDB info from TMDB/IMDB/Trakt/OMDB using IMDB id: '.$imdbId), true);
}
// Check TMDB for IMDB info.
@@ -744,7 +744,7 @@ class Movie
$mov['year'].
') - '.
$mov['imdbid']
)
), true
);
}
@@ -905,15 +905,15 @@ class Movie
} catch (RequestException $e) {
if ($e->hasResponse()) {
if ($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on IMDB server'));
ColorCLI::doEcho(ColorCLI::notice('Data not available on IMDB server'), true);
} elseif ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('IMDB service unavailable'));
ColorCLI::doEcho(ColorCLI::notice('IMDB service unavailable'), true);
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from IMDB, http error reported: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from IMDB, http error reported: '.$e->getCode()), true);
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()), true);
}
if (isset($buffer) && $buffer !== false) {
@@ -1064,7 +1064,7 @@ class Movie
if ($imdbID !== false) {
$this->service = $service;
if ($this->echooutput && $this->service !== '') {
ColorCLI::doEcho(ColorCLI::headerOver($service.' found IMDBid: ').ColorCLI::primary('tt'.$imdbID));
ColorCLI::doEcho(ColorCLI::headerOver($service.' found IMDBid: ').ColorCLI::primary('tt'.$imdbID), true);
}
Release::query()->where('id', $id)->update(['imdbid' => $imdbID]);
@@ -1124,7 +1124,7 @@ class Movie
$this->traktTv = new TraktTv(['Settings' => $this->pdo]);
}
if ($this->echooutput && $movieCount > 1) {
ColorCLI::doEcho(ColorCLI::header('Processing '.$movieCount.' movie releases.'));
ColorCLI::doEcho(ColorCLI::header('Processing '.$movieCount.' movie releases.'), true);
}
// Loop over releases.
@@ -1341,15 +1341,15 @@ class Movie
} catch (RequestException $e) {
if ($e->hasResponse()) {
if ($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on Google search'));
ColorCLI::doEcho(ColorCLI::notice('Data not available on Google search'), true);
} elseif ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('Google service unavailable'));
ColorCLI::doEcho(ColorCLI::notice('Google service unavailable'), true);
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from Google, http error reported: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from Google, http error reported: '.$e->getCode()), true);
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()), true);
}
// Make sure we got some data.
@@ -1391,15 +1391,15 @@ class Movie
} catch (RequestException $e) {
if ($e->hasResponse()) {
if ($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on Bing search'));
ColorCLI::doEcho(ColorCLI::notice('Data not available on Bing search'), true);
} elseif ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('Bing search service unavailable'));
ColorCLI::doEcho(ColorCLI::notice('Bing search service unavailable'), true);
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from Bing search , http error reported: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from Bing search , http error reported: '.$e->getCode()), true);
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()), true);
}
if (! empty($buffer)) {
@@ -1450,17 +1450,17 @@ class Movie
} catch (RequestException $e) {
if ($e->hasResponse()) {
if ($e->getCode() === 999) {
ColorCLI::doEcho(ColorCLI::notice('Banned from Yahoo search'));
ColorCLI::doEcho(ColorCLI::notice('Banned from Yahoo search'), true);
} elseif ($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on Yahoo search'));
ColorCLI::doEcho(ColorCLI::notice('Data not available on Yahoo search'), true);
} elseif ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('Yahoo search service unavailable'));
ColorCLI::doEcho(ColorCLI::notice('Yahoo search service unavailable'), true);
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from Yahoo search, http error reported: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from Yahoo search, http error reported: '.$e->getCode()), true);
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()), true);
}
if (! empty($buffer)) {
@@ -1493,15 +1493,15 @@ class Movie
} catch (RequestException $e) {
if ($e->hasResponse()) {
if ($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on DuckDuckGo search'));
ColorCLI::doEcho(ColorCLI::notice('Data not available on DuckDuckGo search'), true);
} elseif ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('DuckDuckGo search service unavailable'));
ColorCLI::doEcho(ColorCLI::notice('DuckDuckGo search service unavailable'), true);
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from DuckDuckGo search , http error reported: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from DuckDuckGo search , http error reported: '.$e->getCode()), true);
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Runtime error: '.$e->getCode()), true);
}
if (! empty($buffer)) {
+6 -6
View File
@@ -536,7 +536,7 @@ class Music
ColorCLI::alternateOver(' Title: ').
ColorCLI::primary($mus['title']).
ColorCLI::alternateOver(' Year: ').
ColorCLI::primary($mus['year'])
ColorCLI::primary($mus['year']), true
);
}
$mus['cover'] = $ri->saveImage($musicId, $mus['coverurl'], $this->imgSavePath, 250, 250);
@@ -555,7 +555,7 @@ class Music
' ('.
$mus['year'].
')'
)
), true
);
}
}
@@ -666,7 +666,7 @@ class Music
ColorCLI::doEcho(
ColorCLI::header(
'Processing '.$res->count().' music release(s).'
)
), true
);
}
@@ -678,7 +678,7 @@ class Music
$newname = $album['name'].' ('.$album['year'].')';
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::headerOver('Looking up: ').ColorCLI::primary($newname));
ColorCLI::doEcho(ColorCLI::headerOver('Looking up: ').ColorCLI::primary($newname), true);
}
// Do a local lookup first
@@ -687,7 +687,7 @@ class Music
if ($musicCheck === null && \in_array($album['name'].$album['year'], $this->failCache, false)) {
// Lookup recently failed, no point trying again
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.').PHP_EOL);
ColorCLI::doEcho(ColorCLI::headerOver('Cached previous failure. Skipping.'), true);
}
$albumId = -2;
} elseif ($musicCheck === null && $local === false) {
@@ -719,7 +719,7 @@ class Music
}
} else {
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header('No music releases to process.'));
ColorCLI::doEcho(ColorCLI::header('No music releases to process.'), true);
}
}
}
+2 -2
View File
@@ -280,7 +280,7 @@ class Nfo
'Processing '.$nfoCount.
' NFO(s), starting at '.$this->nzbs.
' * = hidden NFO, + = NFO, - = no NFO, f = download failed.'
)
), true
);
if ($this->echo) {
@@ -315,7 +315,7 @@ class Nfo
foreach ($nfoStats as $row) {
$outString .= ', '.$row['status'].' = '.number_format($row['count']);
}
ColorCLI::doEcho(ColorCLI::header($outString.'.'));
ColorCLI::doEcho(ColorCLI::header($outString.'.'), true);
}
}
+4 -4
View File
@@ -72,16 +72,16 @@ class ReleaseImage
$img = (new ImageManager())->make($imgLoc);
} catch (NotReadableException $e) {
if ($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on server'));
ColorCLI::doEcho(ColorCLI::notice('Data not available on server'), true);
} elseif ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('Service unavailable'));
ColorCLI::doEcho(ColorCLI::notice('Service unavailable'), true);
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data, server responded with code: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data, server responded with code: '.$e->getCode()), true);
}
return false;
} catch (ImageException $e) {
ColorCLI::doEcho(ColorCLI::notice('Image error: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Image error: '.$e->getCode()), true);
return false;
}
+3 -3
View File
@@ -86,7 +86,7 @@ class Steam
}
if ($res === false) {
ColorCLI::doEcho(ColorCLI::notice('Steam did not return game data'));
ColorCLI::doEcho(ColorCLI::notice('Steam did not return game data'), true);
}
return false;
@@ -105,7 +105,7 @@ class Steam
$bestMatch = false;
if (empty($searchTerm)) {
ColorCLI::doEcho(ColorCLI::notice('Search term cannot be empty'));
ColorCLI::doEcho(ColorCLI::notice('Search term cannot be empty'), true);
return $bestMatch;
}
@@ -136,7 +136,7 @@ class Steam
}
}
if ($bestMatch === false) {
ColorCLI::doEcho(ColorCLI::notice('Steam search returned no valid results'));
ColorCLI::doEcho(ColorCLI::notice('Steam search returned no valid results'), true);
}
return $bestMatch;
+1 -1
View File
@@ -605,7 +605,7 @@ class Tmux
return true;
}
ColorCLI::doEcho(ColorCLI::info('Tmux scripts are not running!'));
ColorCLI::doEcho(ColorCLI::info('Tmux scripts are not running!'), true);
return false;
}
+9 -9
View File
@@ -494,14 +494,14 @@ class XXX
$this->whichclass = 'aebn';
$mov = new AEBN();
$mov->cookie = $this->cookie;
ColorCLI::doEcho(ColorCLI::info('Checking AEBN for movie info'));
ColorCLI::doEcho(ColorCLI::info('Checking AEBN for movie info'), true);
$res = $mov->processSite($movie);
if ($res === false) {
$this->whichclass = 'pop';
$mov = new Popporn();
$mov->cookie = $this->cookie;
ColorCLI::doEcho(ColorCLI::info('Checking PopPorn for movie info'));
ColorCLI::doEcho(ColorCLI::info('Checking PopPorn for movie info'), true);
$res = $mov->processSite($movie);
}
@@ -509,14 +509,14 @@ class XXX
$this->whichclass = 'adm';
$mov = new ADM();
$mov->cookie = $this->cookie;
ColorCLI::doEcho(ColorCLI::info('Checking ADM for movie info'));
ColorCLI::doEcho(ColorCLI::info('Checking ADM for movie info'), true);
$res = $mov->processSite($movie);
}
if ($res === false) {
$this->whichclass = 'ade';
$mov = new ADE();
ColorCLI::doEcho(ColorCLI::info('Checking ADE for movie info'));
ColorCLI::doEcho(ColorCLI::info('Checking ADE for movie info'), true);
$res = $mov->processSite($movie);
}
@@ -524,7 +524,7 @@ class XXX
$this->whichclass = 'hotm';
$mov = new Hotmovies();
$mov->cookie = $this->cookie;
ColorCLI::doEcho(ColorCLI::info('Checking HotMovies for movie info'));
ColorCLI::doEcho(ColorCLI::info('Checking HotMovies for movie info'), true);
$res = $mov->processSite($movie);
}
@@ -550,7 +550,7 @@ class XXX
default:
$fromstr = '';
}
ColorCLI::doEcho(ColorCLI::primary('Fetching XXX info from: '.$fromstr));
ColorCLI::doEcho(ColorCLI::primary('Fetching XXX info from: '.$fromstr), true);
}
$res = $mov->getAll();
} else {
@@ -629,7 +629,7 @@ class XXX
if ($this->echooutput) {
ColorCLI::doEcho(
ColorCLI::headerOver(($xxxID !== false ? 'Added/updated XXX movie: '.ColorCLI::primary($mov['title']) : 'Nothing to update for XXX movie: '.ColorCLI::primary($mov['title'])))
);
, true);
}
return $xxxID;
@@ -664,7 +664,7 @@ class XXX
if ($movieCount > 0) {
if ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header('Processing '.$movieCount.' XXX releases.'));
ColorCLI::doEcho(ColorCLI::header('Processing '.$movieCount.' XXX releases.'), true);
}
// Loop over releases.
@@ -695,7 +695,7 @@ class XXX
->update(['xxxinfo_id' => $idcheck]);
}
} elseif ($this->echooutput) {
ColorCLI::doEcho(ColorCLI::header('No xxx releases to process.'));
ColorCLI::doEcho(ColorCLI::header('No xxx releases to process.'), true);
}
}
+4 -4
View File
@@ -217,7 +217,7 @@ class Forking extends \fork_daemon
ColorCLI::header(
'Multi-processing for '.$this->workType.' finished in '.(microtime(true) - $startTime).
' seconds at '.date(DATE_RFC2822).'.'.PHP_EOL
)
), true
);
}
}
@@ -311,7 +311,7 @@ class Forking extends \fork_daemon
ColorCLI::header(
'Multi-processing started at '.date(DATE_RFC2822).' for '.$this->workType.' with '.$this->_workCount.
' job(s) to do using a max of '.$this->maxProcesses.' child process(es).'
)
), true
);
}
@@ -320,7 +320,7 @@ class Forking extends \fork_daemon
} else {
if (NN_ECHOCLI) {
ColorCLI::doEcho(
ColorCLI::header('No work to do!')
ColorCLI::header('No work to do!'), true
);
}
}
@@ -1114,7 +1114,7 @@ class Forking extends \fork_daemon
'Process ID #'.$pid.' has completed.'.PHP_EOL.
'There are '.($this->forked_children_count - 1).' process(es) still active with '.
(--$this->_workCount).' job(s) left in the queue.'.PHP_EOL
)
), true
);
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ class ForkingImportNZB extends Forking
ColorCLI::header(
'Multi-processing for import finished in '.(microtime(true) - $startTime).
' seconds at '.date(DATE_RFC2822).'.'.PHP_EOL
)
), true
);
}
}
+5 -5
View File
@@ -165,17 +165,17 @@ class TraktAPI
} catch (RequestException $e) {
if ($e->hasResponse()) {
if ($e->getCode() === 404) {
ColorCLI::doEcho(ColorCLI::notice('Data not available on TraktTV server'));
ColorCLI::doEcho(ColorCLI::notice('Data not available on TraktTV server'), true);
} elseif ($e->getCode() === 503) {
ColorCLI::doEcho(ColorCLI::notice('TraktTV service unavailable'));
ColorCLI::doEcho(ColorCLI::notice('TraktTV service unavailable'), true);
} elseif ($e->getCode() === 401) {
ColorCLI::doEcho(ColorCLI::notice('Unauthorized - OAuth must be provided for TraktTV'));
ColorCLI::doEcho(ColorCLI::notice('Unauthorized - OAuth must be provided for TraktTV'), true);
} else {
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from TraktTV, server responded with code: '.$e->getCode()));
ColorCLI::doEcho(ColorCLI::notice('Unable to fetch data from TraktTV, server responded with code: '.$e->getCode()), true);
}
}
} catch (\RuntimeException $e) {
ColorCLI::doEcho(ColorCLI::notice('Unknown error occurred!'));
ColorCLI::doEcho(ColorCLI::notice('Unknown error occurred!'), true);
}
if ($json !== null && $json !== false) {
+12 -12
View File
@@ -333,7 +333,7 @@ class ProcessReleases
$this->initiateTableNames($groupID);
if ($this->echoCLI) {
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Calculating collection sizes (in bytes).'));
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Calculating collection sizes (in bytes).'), true);
}
// Get the total size in bytes of the collection for collections where filecheck = 2.
$checked = $this->pdo->queryExec(
@@ -360,7 +360,7 @@ class ProcessReleases
ColorCLI::doEcho(
ColorCLI::primary(
$checked->rowCount().' collections set to filecheck = 3(size calculated)'
)
), true
);
ColorCLI::doEcho(ColorCLI::primary($this->consoleTools->convertTime(time() - $startTime)), true);
}
@@ -380,7 +380,7 @@ class ProcessReleases
ColorCLI::doEcho(
ColorCLI::header(
'Process Releases -> Delete collections smaller/larger than minimum size/file count from group/site setting.'
)
), true
);
}
@@ -526,7 +526,7 @@ class ProcessReleases
$returnCount = $duplicate = 0;
if ($this->echoCLI) {
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Create releases from complete collections.'));
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Create releases from complete collections.'), true);
}
$this->pdo->ping(true);
@@ -727,7 +727,7 @@ class ProcessReleases
$this->formFromNamesQuery();
if ($this->echoCLI) {
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Create the NZB, delete collections/binaries/parts.'));
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Create the NZB, delete collections/binaries/parts.'), true);
}
$releases = $this->pdo->queryDirect(
@@ -769,7 +769,7 @@ class ProcessReleases
number_format($nzbCount).' NZBs created/Collections deleted in '.
$totalTime.' seconds.'.PHP_EOL.
'Total time: '.ColorCLI::primary($this->consoleTools->convertTime($totalTime)).PHP_EOL
)
), true
);
}
@@ -832,7 +832,7 @@ class ProcessReleases
ColorCLI::info(
"\nPost-processing is not running inside the Process Releases class.\n".
'If you are using tmux or screen they might have their own scripts running Post-processing.'
)
), true
);
}
}
@@ -1039,7 +1039,7 @@ class ProcessReleases
number_format($deletedCount).
' parts/binaries/collection rows in '.
$this->consoleTools->convertTime($fourthQuery - $startTime).PHP_EOL
)
), true
);
}
}
@@ -1163,7 +1163,7 @@ class ProcessReleases
// Delete old releases and finished collections.
if ($this->echoCLI) {
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Delete old releases and passworded releases.'));
ColorCLI::doEcho(ColorCLI::header('Process Releases -> Delete old releases and passworded releases.'), true);
}
// Releases past retention.
@@ -1387,7 +1387,7 @@ class ProcessReleases
? ', '.number_format($completionDeleted).' under '.$this->completion.'% completion.'
: '.'
)
)
), true
);
$totalDeleted = (
@@ -1400,7 +1400,7 @@ class ProcessReleases
ColorCLI::primary(
'Removed '.number_format($totalDeleted).' releases in '.
$this->consoleTools->convertTime(time() - $startTime)
)
), true
);
}
}
@@ -1686,7 +1686,7 @@ class ProcessReleases
);
if ($this->echoCLI && \is_object($obj) && $obj->rowCount()) {
ColorCLI::doEcho(
ColorCLI::primary('Deleted '.$obj->rowCount().' broken/stuck collections.')
ColorCLI::primary('Deleted '.$obj->rowCount().' broken/stuck collections.'), true
);
}
}
+1 -1
View File
@@ -263,7 +263,7 @@ class AniDB
ColorCLI::alternateOver(' Episode #: ').
ColorCLI::primary($cleanArr['epno']).
ColorCLI::alternateOver(' Episode Title: ').
ColorCLI::primary($updatedAni['episode_title'])
ColorCLI::primary($updatedAni['episode_title']), true
);
$matched = true;