mirror of
https://github.com/OPSnet/Logchecker.git
synced 2026-11-09 03:59:52 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7be957b343 | ||
|
|
09bfa6a98b | ||
|
|
ddbc042897 | ||
|
|
3f81c3a91d | ||
|
|
04d6d9cbef | ||
|
|
752ec6af0a | ||
|
|
594add313f | ||
|
|
fb05ef7b26 | ||
|
|
e462fdef45 | ||
|
|
b38c25a13d |
No files matched your search
+11
-2
@@ -1,9 +1,10 @@
|
||||
language: php
|
||||
sudo: true
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pip
|
||||
- $HOME/.composer/cache
|
||||
|
||||
php:
|
||||
@@ -19,11 +20,19 @@ matrix:
|
||||
- php: nightly
|
||||
|
||||
before_install:
|
||||
- composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress
|
||||
- sudo apt-get install python3
|
||||
- wget https://bootstrap.pypa.io/get-pip.py
|
||||
- sudo python3 get-pip.py
|
||||
|
||||
install:
|
||||
- composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress
|
||||
- pip3 install --user chardet xld_logchecker eac_logchecker
|
||||
|
||||
script:
|
||||
- bin/logchecker --version
|
||||
- bin/logchecker --help
|
||||
- bin/logchecker tests/logs/wgdbcm.log
|
||||
- bin/logchecker tests/logs/xld_perfect.log
|
||||
|
||||
before_deploy:
|
||||
- php -d phar.readonly=0 bin/compile
|
||||
|
||||
@@ -33,7 +33,7 @@ file. Download this file, and then it can executed via CLI by running `php logch
|
||||
Alternatively, if you `chmod +x logchecker.phar`, it can be executed directly by doing `./logchecker.phar`.
|
||||
|
||||
To install it globally, run:
|
||||
```
|
||||
```bash
|
||||
mv logchecker.phar /usr/local/bin/logchecker
|
||||
chmod +x /usr/local/bin/logchecker
|
||||
```
|
||||
@@ -75,7 +75,7 @@ Details :
|
||||
```
|
||||
|
||||
### Code
|
||||
```
|
||||
```php
|
||||
<?php
|
||||
|
||||
$logchecker = new OrpheusNET\Logchecker\Logchecker();
|
||||
@@ -90,8 +90,12 @@ $ composer require orpheusnet/logchecker
|
||||
```
|
||||
|
||||
### Usage
|
||||
```
|
||||
use OrpheusNET\Logchecker\Logchecker();
|
||||
```php
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
use OrpheusNET\Logchecker\Logchecker;
|
||||
|
||||
$logchecker = new Logchecker();
|
||||
$logchecker->new_file('/path/to/log/file');
|
||||
@@ -109,9 +113,9 @@ print("\nLog Text:\n{$log_text}");
|
||||
|
||||
To build your own phar, you can checkout this repository, and then
|
||||
run the `bin/compile` script. To do this, run the following commands:
|
||||
```
|
||||
```bash
|
||||
git clone https://github.com/OPSnet/Logchecker
|
||||
cd Logchecker
|
||||
composer install
|
||||
php -d phar.readonly=0 /bin/compile
|
||||
php -d phar.readonly=0 bin/compile
|
||||
```
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "orpheusnet/logchecker",
|
||||
"description": "Logchecker for validating logs generated from supported ripping programs (like EAC and XLD)",
|
||||
"version": "0.8.1",
|
||||
"version": "0.8.3",
|
||||
"license": "Unlicense",
|
||||
"type": "library",
|
||||
"authors": [
|
||||
|
||||
Generated
+32
-29
@@ -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": [],
|
||||
|
||||
@@ -44,4 +44,4 @@ for ($i = 1; $i < $rows->length; $i++) {
|
||||
|
||||
file_put_contents(__DIR__.'/../src/offsets.txt', implode("\n", $offsets));
|
||||
|
||||
print("Updating ".count($offsets)." drives\n");
|
||||
print("Updating ".count($offsets)." drives\n");
|
||||
@@ -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'));
|
||||
|
||||
|
||||
+39
-13
@@ -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";
|
||||
}
|
||||
@@ -439,10 +453,14 @@ class Logchecker {
|
||||
$GoodString = 'OK';
|
||||
}
|
||||
|
||||
$CommandExists = Util::commandExists($Command);
|
||||
$Out = shell_exec("{$Command} {$this->LogPath}");
|
||||
if (Util::strposArray($Out, $BadStrings) !== false || strpos($Out, $GoodString) === false) {
|
||||
$this->Checksum = false;
|
||||
if (Util::commandExists($Command)) {
|
||||
$Out = shell_exec("{$Command} ".escapeshellarg($this->LogPath));
|
||||
if ($Out == null || Util::strposArray($Out, $BadStrings) !== false || strpos($Out, $GoodString) === false) {
|
||||
$this->Checksum = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->account("Could not find {$Command}, checksum not validated.", false, false, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1020,7 +1038,7 @@ class Logchecker {
|
||||
$MatchedDrives[$i] = ['drives' => [], 'offsets' => []];
|
||||
}
|
||||
|
||||
foreach ($this->AllDrives as [$Drive, $Offset]) {
|
||||
foreach ($this->AllDrives as list($Drive, $Offset)) {
|
||||
$Distance = levenshtein($Drive, $DriveName);
|
||||
if ($Distance < 5) {
|
||||
$MatchedDrives[$Distance]['drives'][] = $Drive;
|
||||
@@ -1460,6 +1478,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
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user