Kaynağa Gözat

Make whipper log output transparent

tags/v0.8.0
itismadness 6 yıl önce
ebeveyn
işleme
aacc02cb61
4 değiştirilmiş dosya ile 260 ekleme ve 24 silme
  1. +0
    -1
      .travis.yml
  2. +2
    -1
      composer.json
  3. +232
    -11
      composer.lock
  4. +26
    -11
      src/Logchecker.php

+ 0
- 1
.travis.yml Dosyayı Görüntüle

@@ -19,7 +19,6 @@ matrix:
- php: nightly

before_install:
- yes | pecl install yaml
- composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress

script:


+ 2
- 1
composer.json Dosyayı Görüntüle

@@ -19,7 +19,8 @@
"php": ">=7",
"ext-mbstring": "*",
"ext-yaml": "*",
"symfony/console": "^3.4|^4.1"
"symfony/console": "^3.4",
"symfony/yaml": "^3.4"
},
"bin": ["bin/logchecker"]
}

+ 232
- 11
composer.lock Dosyayı Görüntüle

@@ -4,24 +4,72 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e55e86b08121ef02ee55eeb9438df815",
"content-hash": "16f9f1b41df5e24d17703651ea707cb5",
"packages": [
{
"name": "psr/log",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2018-11-20T15:27:04+00:00"
},
{
"name": "symfony/console",
"version": "v4.1.8",
"version": "v3.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "c74f4d1988dfcd8760273e53551694da32b056d0"
"reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/c74f4d1988dfcd8760273e53551694da32b056d0",
"reference": "c74f4d1988dfcd8760273e53551694da32b056d0",
"url": "https://api.github.com/repos/symfony/console/zipball/8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb",
"reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"php": "^5.5.9|>=7.0.8",
"symfony/debug": "~2.8|~3.0|~4.0",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
@@ -30,11 +78,11 @@
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.4|~4.0",
"symfony/config": "~3.3|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/event-dispatcher": "~3.4|~4.0",
"symfony/event-dispatcher": "~2.8|~3.0|~4.0",
"symfony/lock": "~3.4|~4.0",
"symfony/process": "~3.4|~4.0"
"symfony/process": "~3.3|~4.0"
},
"suggest": {
"psr/log-implementation": "For using the console logger",
@@ -45,7 +93,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
"dev-master": "3.4-dev"
}
},
"autoload": {
@@ -72,7 +120,121 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2018-11-26T14:00:40+00:00"
"time": "2018-11-26T12:48:07+00:00"
},
{
"name": "symfony/debug",
"version": "v4.1.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "f9eea0cff99d14f97d69b24b17164098ece3fd32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/f9eea0cff99d14f97d69b24b17164098ece3fd32",
"reference": "f9eea0cff99d14f97d69b24b17164098ece3fd32",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"psr/log": "~1.0"
},
"conflict": {
"symfony/http-kernel": "<3.4"
},
"require-dev": {
"symfony/http-kernel": "~3.4|~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2018-11-11T19:51:29+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/polyfill-mbstring",
@@ -132,6 +294,65 @@
"shim"
],
"time": "2018-09-21T13:07:52+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.4.19",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "291e13d808bec481eab83f301f7bff3e699ef603"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/291e13d808bec481eab83f301f7bff3e699ef603",
"reference": "291e13d808bec481eab83f301f7bff3e699ef603",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/polyfill-ctype": "~1.8"
},
"conflict": {
"symfony/console": "<3.4"
},
"require-dev": {
"symfony/console": "~3.4|~4.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2018-11-11T19:48:54+00:00"
}
],
"packages-dev": [],


+ 26
- 11
src/Logchecker.php Dosyayı Görüntüle

@@ -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";


Yükleniyor…
İptal
Kaydet