Compare commits

...
6 Commits
6 changed files with 74 additions and 45 deletions

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ before_install:
install:
- composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress
- pip3 install --user xld_logchecker eac_logchecker
- pip3 install --user chardet xld_logchecker eac_logchecker
script:
- bin/logchecker --version
+1 -1
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.8.2",
"version": "0.8.4",
"license": "Unlicense",
"type": "library",
"authors": [
Generated
+32 -29
View File
@@ -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": "165e83b0ccad187ade7bf2a38820cb4c",
"content-hash": "9ad854c65da76498f6a2af058812e332",
"packages": [
{
"name": "psr/log",
@@ -55,16 +55,16 @@
},
{
"name": "symfony/console",
"version": "v3.4.19",
"version": "v3.4.28",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb"
"reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb",
"reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb",
"url": "https://api.github.com/repos/symfony/console/zipball/8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6",
"reference": "8e1d1e406dd31727fa70cd5a99cda202e9d6a5c6",
"shasum": ""
},
"require": {
@@ -76,6 +76,9 @@
"symfony/dependency-injection": "<3.4",
"symfony/process": "<3.3"
},
"provide": {
"psr/log-implementation": "1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.3|~4.0",
@@ -85,7 +88,7 @@
"symfony/process": "~3.3|~4.0"
},
"suggest": {
"psr/log-implementation": "For using the console logger",
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/lock": "",
"symfony/process": ""
@@ -120,20 +123,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2018-11-26T12:48:07+00:00"
"time": "2019-05-09T08:42:51+00:00"
},
{
"name": "symfony/debug",
"version": "v3.4.19",
"version": "v3.4.28",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d"
"reference": "671fc55bd14800668b1d0a3708c3714940e30a8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/2016b3eec2e49c127dd02d0ef44a35c53181560d",
"reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d",
"url": "https://api.github.com/repos/symfony/debug/zipball/671fc55bd14800668b1d0a3708c3714940e30a8c",
"reference": "671fc55bd14800668b1d0a3708c3714940e30a8c",
"shasum": ""
},
"require": {
@@ -176,20 +179,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2018-11-11T19:48:54+00:00"
"time": "2019-05-18T13:32:47+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19"
"reference": "82ebae02209c21113908c229e9883c419720738a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
"reference": "82ebae02209c21113908c229e9883c419720738a",
"shasum": ""
},
"require": {
@@ -201,7 +204,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
"dev-master": "1.11-dev"
}
},
"autoload": {
@@ -234,20 +237,20 @@
"polyfill",
"portable"
],
"time": "2018-08-06T14:22:27+00:00"
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.10.0",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
"reference": "fe5e94c604826c35a32fa832f35bd036b6799609"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
"reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609",
"reference": "fe5e94c604826c35a32fa832f35bd036b6799609",
"shasum": ""
},
"require": {
@@ -259,7 +262,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
"dev-master": "1.11-dev"
}
},
"autoload": {
@@ -293,20 +296,20 @@
"portable",
"shim"
],
"time": "2018-09-21T13:07:52+00:00"
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.4.19",
"version": "v3.4.28",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "291e13d808bec481eab83f301f7bff3e699ef603"
"reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/291e13d808bec481eab83f301f7bff3e699ef603",
"reference": "291e13d808bec481eab83f301f7bff3e699ef603",
"url": "https://api.github.com/repos/symfony/yaml/zipball/212a27b731e5bfb735679d1ffaac82bd6a1dc996",
"reference": "212a27b731e5bfb735679d1ffaac82bd6a1dc996",
"shasum": ""
},
"require": {
@@ -352,7 +355,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2018-11-11T19:48:54+00:00"
"time": "2019-03-25T07:48:46+00:00"
}
],
"packages-dev": [],
+2
View File
@@ -28,6 +28,8 @@ class AnalyzeCommand extends Command {
$logchecker = new Logchecker();
$logchecker->new_file($filename);
list($score, $details, $checksum, $log_text) = $logchecker->parse();
$output->writeln('Ripper : ' . $logchecker->get_ripper());
$output->writeln('Version : ' . $logchecker->get_version());
$output->writeln('Score : ' . $score);
$output->writeln('Checksum: ' . ($checksum ? 'true' : 'false'));
+37 -13
View File
@@ -167,6 +167,17 @@ class Logchecker {
return $this->return_parse();
}
$this->RIPPER = 'whipper';
$this->Version = explode(" ", $Yaml['Log created by'])[1];
// Releases before this used octal numbers for tracks in the log which
// gets messed up in parsing and we lose track data (e.g. tracks 08 and
// 09 get merged into one entry).
if (empty($this->Version) || version_compare('0.7.3', $this->Version) === 1) {
$this->account('Logs must be produced by whipper 0.7.3+', 100);
return $this->return_parse();
}
if (!empty($Yaml['SHA-256 hash'])) {
$Hash = $Yaml['SHA-256 hash'];
$Lines = explode("\n", trim($this->Log));
@@ -217,15 +228,18 @@ class Logchecker {
}
$DefeatCache = $Yaml['Ripping phase information']['Defeat audio cache'];
if ($DefeatCache) {
$Value = 'Yes';
$Class = 'good';
if (is_string($DefeatCache)) {
$Value = (strtolower($DefeatCache) === 'yes') ? 'Yes' : 'No';
$Class = (strtolower($DefeatCache) === 'yes') ? 'good' : 'bad';
}
else {
$Value = 'No';
$Class = 'bad';
$this->account('"Defeat audio cache" should be yes', 10);
$Value = ($DefeatCache === true) ? 'true' : 'false';
$Class = ($DefeatCache === true) ? 'good' : 'bad';
}
if ($Class === 'bad') {
$this->account('"Defeat audio cache" should be Yes/true', 10);
}
$Yaml['Ripping phase information']['Defeat audio cache'] = "<span class='{$Class}'>{$Value}</span>";
foreach ($Yaml['Tracks'] as $Key => $Track) {
@@ -245,7 +259,7 @@ class Logchecker {
$this->Log .= "Ripping phase information:\n";
foreach ($Yaml['Ripping phase information'] as $Key => $Value) {
if (is_bool($Value)) {
$Value = ($Value) ? 'Yes' : 'No';
$Value = ($Value) ? 'true' : 'false';
}
$this->Log .= " {$Key}: {$Value}\n";
}
@@ -254,7 +268,7 @@ class Logchecker {
$this->Log .= "CD metadata:\n";
foreach ($Yaml['CD metadata'] as $Key => $Value) {
if (is_bool($Value)) {
$Value = ($Value) ? 'Yes' : 'No';
$Value = ($Value) ? 'true' : 'false';
}
$this->Log .= " {$Key}: {$Value}\n";
}
@@ -498,7 +512,7 @@ class Logchecker {
'accurate_stream_eac_pre99'
), $Log, 1, $EAC_ac_stream_pre99);
if (!$EAC_ac_stream && !$EAC_ac_stream_pre99 && !$this->NonSecureMode && $EAC) {
$this->account('Could not verify accurate stream');
$this->account('Could not verify accurate stream', 20);
}
$Log = preg_replace_callback('/Defeat audio cache( +): (Yes|No)/i', array(
$this,
@@ -1140,18 +1154,20 @@ class Logchecker {
function accurate_stream($Matches)
{
if ($Matches[2] == 'Yes') {
$Class = 'goodish';
$Class = 'good';
} else {
$Class = 'badish';
$Class = 'bad';
$this->account('"Utilize accurate stream" should be yes', 20);
}
return '<span class="log5">Utilize accurate stream' . $Matches[1] . '</span>: <span class="' . $Class . '">' . $Matches[2] . '</span>';
}
function accurate_stream_eac_pre99($Matches)
{
if (strtolower($Matches[1]) != 'no ') {
$Class = 'goodish';
$Class = 'good';
} else {
$Class = 'badish';
$Class = 'bad';
$this->account('"accurate stream" should be yes', 20);
}
return ', <span class="' . $Class . '">' . $Matches[1] . 'accurate stream</span>';
}
@@ -1464,6 +1480,14 @@ class Logchecker {
);
}
function get_ripper() {
return $this->RIPPER;
}
function get_version() {
return $this->Version;
}
public static function get_accept_values() {
return ".txt,.TXT,.log,.LOG";
}
+1 -1
View File
@@ -3,7 +3,7 @@
namespace OrpheusNET\Logchecker;
class Util {
public static function commandExists($cmd) {
public static function commandExists(string $cmd) {
$where = substr(strtolower(PHP_OS), 0, 3) === 'win' ? 'where' : 'command -v';
exec("{$where} {$cmd} 2>/dev/null", $output, $return_var);