Compare commits

..
10 Commits
7 changed files with 336 additions and 1411 deletions

No files matched your search

+2 -1
View File
@@ -1,2 +1,3 @@
.idea/
vendor/
vendor/
logchecker.phar
+40
View File
@@ -0,0 +1,40 @@
language: php
sudo: true
dist: trusty
cache:
directories:
- $HOME/.composer/cache
php:
- 7.0
- 7.1
- 7.2
- 7.3
- nightly
matrix:
fast_finish: true
allow_failures:
- php: nightly
before_install:
- composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress
script:
- bin/logchecker --version
- bin/logchecker --help
before_deploy:
- php -d phar.readonly=0 bin/compile
deploy:
provider: releases
api_key:
secure: jlvbD7nzOz/8vssSI75loBMJE9OosAofTu1IDMc3bfxfRaPT6c2duebJF7Bm0VCTGYWK3Wc+19wwyLpCMoueUUEtKqi6RGIUQyboQvbSEe/cje7/9PgqmFstV8LdBLNOwRVj01YcmGw/iMVc+GxPTtDZtcwVU9bzlMCwXFAlggeId0Qw6KgxN+wTbm+oS3zrIh+TnWhgeWhmMYn0/UAEUEQCsYDI+UJjGWStWdpdJqdMhidg5GQyVtomFg82ZjIw+ywYGMGgq38S4PMRBLoqbxuWs++9LPblWboxtktb4+U0xUMdHfrv/r94b8+nI2SJ1xzzUKTXS/glkk0lJAovSYew6jJiu+gsejiNyR89WNgRGwnWAUA8ZBptrM2b3sxLuZ6RuxQXP3TMpxhQQE/3aodOrACPOHa8uuct0JAj/a2p0WCIj4r76McHrXTjFzDPsbdxD1GwOQmFJGqY5EV7Vez6q++Erp/64JEZJk9/jieTv0arLe76VZPQcZ6TB488tH699MvK7Gg1cc4114FbKIEZrOKF2FOrMAZJ3husjELN0zJYeRPZUy6Y7A2PAWsqfdswlxjP9IxuDFVE/3TW8O1sVItWo4+SSkKTILzsC0qgxVL2lW9WDmyka8U5T2SAa8ye/RRZ3FJYugep49wjUsfLraRdA+Lj7KQXSaMlFa8=
file: logchecker.phar
skip_cleanup: true
on:
tags: true
repo: OPSnet/Logchecker
php: '7.2'
Executable
+60
View File
@@ -0,0 +1,60 @@
#!/usr/bin/env php
<?php
$phar_file = 'logchecker.phar';
if (file_exists($phar_file)) {
unlink($phar_file);
}
$phar = new Phar(__DIR__.'/../'.$phar_file, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, $phar_file);
$phar->startBuffering();
$base_dir = realpath(__DIR__.'/../');
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(__DIR__.'/../src'), RecursiveDirectoryIterator::SKIP_DOTS));
foreach ($it as $entry) {
$phar->addFile($entry->getPathName(), str_replace($base_dir, '', $entry->getPathName()));
}
$vendor = [
'composer',
'psr',
'symfony'
];
foreach ($vendor as $dir) {
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(__DIR__.'/../vendor/'.$dir), RecursiveDirectoryIterator::SKIP_DOTS));
foreach ($it as $entry) {
$phar->addFile($entry->getPathName(), str_replace($base_dir, '', $entry->getPathName()));
}
}
$phar->addFile(realpath(__DIR__.'/../vendor/autoload.php'), 'vendor/autoload.php');
$phar->addFile(realpath(__DIR__.'/../composer.json'), 'composer.json');
$phar->addFile(realpath(__DIR__.'/../LICENSE.md'), 'LICENSE.md');
$phar->addFile(realpath(__DIR__.'/../README.md'), 'README.md');
$bin_file = file_get_contents(__DIR__.'/logchecker');
$bin_file = preg_replace('{^#!/usr/bin/env php\s*}', '', $bin_file);
$phar->addFromString('bin/logchecker', $bin_file);
$stub = <<<PHP
#!/usr/bin/env php
<?php
Phar::mapPhar('{$phar_file}');
require 'phar://{$phar_file}/bin/logchecker';
__HALT_COMPILER();
PHP;
$phar->setStub($stub);
$phar->stopBuffering();
//$phar->compress(Phar::GZ);
echo "{$phar_file} generated...";
+4 -6
View File
@@ -1,7 +1,7 @@
{
"name": "orpheusnet/logchecker",
"description": "Logchecker for validating logs generated from supported ripping programs (like EAC and XLD)",
"version": "0.7.0",
"version": "0.8.0",
"license": "Unlicense",
"type": "library",
"authors": [
@@ -18,11 +18,9 @@
"require": {
"php": ">=7",
"ext-mbstring": "*",
"ext-yaml": "*",
"symfony/console": "^4.1"
},
"require-dev": {
"phpunit/phpunit": "^6|^7"
"symfony/console": "^3.4",
"symfony/debug": "^3.4",
"symfony/yaml": "^3.4"
},
"bin": ["bin/logchecker"]
}
Generated
+203 -1392
View File
File diff suppressed because it is too large. Load diff
+26 -11
View File
@@ -2,6 +2,9 @@
namespace OrpheusNET\Logchecker;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Yaml\Exception\ParseException;
/*******************************************************************
* Automated EAC/XLD log checker *
********************************************************************/
@@ -142,7 +145,6 @@ class Logchecker {
$this->convert_encoding();
}
catch (\Exception $exc) {
$this->Checksum = false;
$this->Score = 0;
$this->account('Could not detect log encoding, log is corrupt.');
return $this->return_parse();
@@ -157,17 +159,21 @@ class Logchecker {
}
private function whipper_parse() {
$Yaml = @yaml_parse($this->Log);
if ($Yaml === false) {
$this->Score = 0;
$this->account('Could not parse whipper log.');
try {
$Yaml = Yaml::parse($this->Log);
}
catch (ParseException $exception) {
$this->account('Could not parse whipper log.', 100);
return $this->return_parse();
}
if (!empty($Yaml['SHA-256 hash'])) {
$Hash = $Yaml['SHA-256 hash'];
$lines = explode("\n", trim($this->Log));
$Slice = array_slice($lines, 0, count($lines)-1);
$Lines = explode("\n", trim($this->Log));
$Slice = array_slice($Lines, 0, count($Lines)-1);
$this->Checksum = strtolower(hash('sha256', implode("\n", $Slice))) === strtolower($Hash);
unset($Slice);
unset($Lines);
$Class = $this->Checksum ? 'good' : 'bad';
$Yaml['SHA-256 hash'] = "<span class='{$Class}'>{$Hash}</span>";
}
@@ -223,6 +229,7 @@ class Logchecker {
$Yaml['Ripping phase information']['Defeat audio cache'] = "<span class='{$Class}'>{$Value}</span>";
foreach ($Yaml['Tracks'] as $Key => $Track) {
$Yaml['Tracks'][$Key]['Peak level'] = sprintf('%.6f', $Track['Peak level']);
$Class = 'good';
if ($Track['Test CRC'] !== $Track['Copy CRC']) {
$Class = 'bad';
@@ -233,15 +240,22 @@ class Logchecker {
$Yaml['Tracks'][$Key]['Copy CRC'] = "<span class='{$Class}'>{$Track['Copy CRC']}</span>";
}
$this->Log = "Log created by: {$Yaml['Log created by']}\nLog creation date: {$Yaml['Log creation date']}\n\n";
$CreationDate = gmdate("Y-m-d\TH:i:s\Z", $Yaml['Log creation date']);
$this->Log = "Log created by: {$Yaml['Log created by']}\nLog creation date: {$CreationDate}\n\n";
$this->Log .= "Ripping phase information:\n";
foreach ($Yaml['Ripping phase information'] as $Key => $Value) {
if (is_bool($Value)) {
$Value = ($Value) ? 'Yes' : 'No';
}
$this->Log .= " {$Key}: {$Value}\n";
}
$this->Log .= "\n";
$this->Log .= "CD metadata:\n";
foreach ($Yaml['CD metadata'] as $Key => $Value) {
if (is_bool($Value)) {
$Value = ($Value) ? 'Yes' : 'No';
}
$this->Log .= " {$Key}: {$Value}\n";
}
$this->Log .= "\n";
@@ -254,7 +268,6 @@ class Logchecker {
}
$this->Log .= "\n";
}
$this->Log .= "\n";
$this->Log .= "Tracks:\n";
foreach ($Yaml['Tracks'] as $Key => $Track) {
@@ -267,16 +280,18 @@ class Logchecker {
}
}
else {
if (is_bool($Value)) {
$Value = ($Value) ? 'Yes' : 'No';
}
$this->Log .= " {$KKey}: {$Value}\n";
}
}
$this->Log .= "\n";
}
$this->Log .= "\n";
$this->Log .= "Conclusive status report:\n";
foreach ($Yaml['Conclusive status report'] as $Key => $Value) {
$this->Log .= "{$Key}: {$Value}\n";
$this->Log .= " {$Key}: {$Value}\n";
}
$this->Log .= "\n";
$this->Log .= "SHA-256 hash: {$Yaml['SHA-256 hash']}\n";
+1 -1
View File
@@ -19,6 +19,6 @@ class LogcheckerConsole extends Application {
$analyze_command
]);
$this->setDefaultCommand($analyze_command->getName());
$this->setDefaultCommand($analyze_command->getName(), true);
}
}