mirror of
https://github.com/OPSnet/Logchecker.git
synced 2026-11-08 08:12:22 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03133c5184 | ||
|
|
afb9fc8a4f | ||
|
|
a7bbb966a0 | ||
|
|
d34e1151af |
No files matched your search
+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.9.2",
|
||||
"version": "0.9.4",
|
||||
"license": "Unlicense",
|
||||
"type": "library",
|
||||
"authors": [
|
||||
|
||||
Generated
+29
-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": "cf86be9f969915a6352efc74903d5f86",
|
||||
"content-hash": "b527204a94579c93a289c0ffaedc1a9f",
|
||||
"packages": [
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -147,16 +147,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.15.0",
|
||||
"version": "v1.17.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14"
|
||||
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
|
||||
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
|
||||
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -168,7 +168,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.15-dev"
|
||||
"dev-master": "1.17-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -215,20 +215,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-02-27T09:26:54+00:00"
|
||||
"time": "2020-05-12T16:14:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.15.0",
|
||||
"version": "v1.17.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac"
|
||||
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
|
||||
"reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c",
|
||||
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -240,7 +240,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.15-dev"
|
||||
"dev-master": "1.17-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -288,20 +288,20 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-03-09T19:04:49+00:00"
|
||||
"time": "2020-05-12T16:47:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php73",
|
||||
"version": "v1.15.0",
|
||||
"version": "v1.17.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php73.git",
|
||||
"reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7"
|
||||
"reference": "a760d8964ff79ab9bf057613a5808284ec852ccc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7",
|
||||
"reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a760d8964ff79ab9bf057613a5808284ec852ccc",
|
||||
"reference": "a760d8964ff79ab9bf057613a5808284ec852ccc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -310,7 +310,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.15-dev"
|
||||
"dev-master": "1.17-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -360,7 +360,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-02-27T09:26:54+00:00"
|
||||
"time": "2020-05-12T16:47:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
@@ -1046,16 +1046,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "0.12.19",
|
||||
"version": "0.12.25",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "054f6d76b12ba9a6c13a5a8d5fcdf51219615f4d"
|
||||
"reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/054f6d76b12ba9a6c13a5a8d5fcdf51219615f4d",
|
||||
"reference": "054f6d76b12ba9a6c13a5a8d5fcdf51219615f4d",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9619551d68b2d4c0d681a8df73f3c847c798ee64",
|
||||
"reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1098,7 +1098,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-04-19T20:35:10+00:00"
|
||||
"time": "2020-05-10T20:36:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@@ -1354,16 +1354,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "8.5.4",
|
||||
"version": "8.5.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "8474e22d7d642f665084ba5ec780626cbd1efd23"
|
||||
"reference": "63dda3b212a0025d380a745f91bdb4d8c985adb7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8474e22d7d642f665084ba5ec780626cbd1efd23",
|
||||
"reference": "8474e22d7d642f665084ba5ec780626cbd1efd23",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/63dda3b212a0025d380a745f91bdb4d8c985adb7",
|
||||
"reference": "63dda3b212a0025d380a745f91bdb4d8c985adb7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1443,7 +1443,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-04-23T04:39:42+00:00"
|
||||
"time": "2020-05-22T13:51:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/code-unit-reverse-lookup",
|
||||
|
||||
+17
-11
@@ -3,6 +3,7 @@
|
||||
namespace OrpheusNET\Logchecker;
|
||||
|
||||
use OrpheusNET\Logchecker\Check\Ripper;
|
||||
use OrpheusNET\Logchecker\Exception\UnknownLanguageException;
|
||||
use OrpheusNET\Logchecker\Exception\UnknownRipperException;
|
||||
use OrpheusNET\Logchecker\Parser\EAC\Translator;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
@@ -366,17 +367,22 @@ class Logchecker
|
||||
{
|
||||
if ($this->ripper === Ripper::EAC) {
|
||||
$translator = new Translator();
|
||||
$lang = $translator->getLanguage($this->log);
|
||||
if ($lang['code'] !== 'en') {
|
||||
$this->language = $lang['code'];
|
||||
$this->account(
|
||||
"Translated log from {$lang['name']} ({$lang['name_english']}) to English.",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true
|
||||
);
|
||||
$this->log = $translator->translate($this->log, $lang['code']);
|
||||
try {
|
||||
$lang = $translator->getLanguage($this->log);
|
||||
if ($lang['code'] !== 'en') {
|
||||
$this->language = $lang['code'];
|
||||
$this->account(
|
||||
"Translated log from {$lang['name']} ({$lang['name_english']}) to English.",
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true
|
||||
);
|
||||
$this->log = $translator->translate($this->log, $lang['code']);
|
||||
}
|
||||
} catch (UnknownLanguageException $exc) {
|
||||
$this->language = 'en';
|
||||
$this->account('Could not determine language. Assuming English.', false, false, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ class Translator
|
||||
file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR . 'master.json'),
|
||||
true
|
||||
);
|
||||
|
||||
foreach ($languages as $code => $lang) {
|
||||
foreach ($lang['eac_strings'] as $eac_string) {
|
||||
if (preg_match('/' . preg_quote($eac_string, "/") . '/ui', $log) === 1) {
|
||||
|
||||
@@ -41,6 +41,12 @@ class Util
|
||||
if ($results['charset'] !== 'utf-8' && $results['confidence'] > 0.7) {
|
||||
// $log = mb_convert_encoding($log, 'UTF-8', $results['charset']);
|
||||
$log = iconv($results['charset'], 'UTF-8', $log);
|
||||
} elseif ($results['charset'] !== 'utf-8' && $results['confidence'] > 0.3) {
|
||||
// If we've got a poor confidence on our decoding, we just use a generic
|
||||
// ISO-8859-1 as that covers a decent range of things that people would
|
||||
// inadvertently re-encode a log into. I seriously cannot express how
|
||||
// much I hate how EAC does not use always UTF-8.
|
||||
$log = iconv('ISO-8859-1', 'UTF-8', $log);
|
||||
}
|
||||
}
|
||||
return $log;
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace OrpheusNET\Logchecker\Parser\EAC;
|
||||
|
||||
use FilesystemIterator;
|
||||
use OrpheusNET\Logchecker\Exception\UnknownLanguageException;
|
||||
use OrpheusNET\Logchecker\Util;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TranslatorTest extends TestCase
|
||||
@@ -51,4 +52,33 @@ class TranslatorTest extends TestCase
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function englishLogProvider()
|
||||
{
|
||||
return array_map(
|
||||
function ($file) {
|
||||
return [$file];
|
||||
},
|
||||
array_filter(
|
||||
scandir(implode(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', 'logs', 'eac', 'originals'])),
|
||||
function ($file) {
|
||||
return substr($file, 0, 2) === 'en';
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider englishLogProvider
|
||||
*/
|
||||
public function testEnglishLanguage(string $file)
|
||||
{
|
||||
$logPath = implode(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', 'logs', 'eac', 'originals', $file]);
|
||||
$log = file_get_contents($logPath);
|
||||
$log = Util::decodeEncoding($log, $logPath);
|
||||
$langDetails = Translator::getLanguage($log);
|
||||
$this->assertSame('en', $langDetails['code']);
|
||||
$this->assertSame('English', $langDetails['name']);
|
||||
$this->assertSame('English', $langDetails['name_english']);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,194 @@
|
||||
EAC extraction logfile from 20. November 2006, 20:20 for CD
|
||||
Banco del Mutuo Soccorso / Seguendo le Tracce
|
||||
|
||||
Used drive : _NEC DVD+-RW ND-6450A Adapter: 1 ID: 0
|
||||
Read mode : Secure with NO C2, accurate stream, disable cache
|
||||
Read offset correction : 594
|
||||
Overread into Lead-In and Lead-Out : No
|
||||
|
||||
Used output format : Internal WAV Routines
|
||||
44.100 Hz; 16 Bit; Stereo
|
||||
|
||||
Other options :
|
||||
Fill up missing offset samples with silence : Yes
|
||||
Delete leading and trailing silent blocks : No
|
||||
Installed external ASPI interface
|
||||
|
||||
|
||||
Track 1
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\01R.I.P. (english version).wav
|
||||
|
||||
Pre-gap length 0:00:02.00
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC EC43BAD3
|
||||
Copy CRC EC43BAD3
|
||||
Copy OK
|
||||
|
||||
Track 2
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\02L'albero del pane.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC 70584B1D
|
||||
Copy CRC 70584B1D
|
||||
Copy OK
|
||||
|
||||
Track 3
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\03La danza dei grandi rettili.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC 4E17BAEF
|
||||
Copy CRC 4E17BAEF
|
||||
Copy OK
|
||||
|
||||
Track 4
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\04Passaggio.wav
|
||||
|
||||
Peak level 44.4 %
|
||||
Track quality 100.0 %
|
||||
Test CRC D76BE99A
|
||||
Copy CRC D76BE99A
|
||||
Copy OK
|
||||
|
||||
Track 5
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\05Non mi rompete.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC 826A9F81
|
||||
Copy CRC 826A9F81
|
||||
Copy OK
|
||||
|
||||
Track 6
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\06Dopo... niente più è lo stesso.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC CFB6C6BA
|
||||
Copy CRC CFB6C6BA
|
||||
Copy OK
|
||||
|
||||
Track 7
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\07Traccia II.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC D7BAF9A2
|
||||
Copy CRC D7BAF9A2
|
||||
Copy OK
|
||||
|
||||
Track 8
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\08Metamorfosi.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC BBB2254A
|
||||
Copy CRC BBB2254A
|
||||
Copy OK
|
||||
|
||||
No errors occured
|
||||
|
||||
|
||||
End of status report
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
EAC extraction logfile from 20. November 2006, 21:08 for CD
|
||||
Banco del Mutuo Soccorso / Seguendo le Tracce
|
||||
|
||||
Used drive : _NEC DVD+-RW ND-6450A Adapter: 1 ID: 0
|
||||
Read mode : Secure with NO C2, accurate stream, disable cache
|
||||
Read offset correction : 594
|
||||
Overread into Lead-In and Lead-Out : No
|
||||
|
||||
Used output format : C:\Programmi\FLAC\flac.exe (User Defined Encoder)
|
||||
320 kBit/s
|
||||
Additional command line options : -V --replay-gain -8 -T "artist=%a" -T "title=%t" -T "album=%g" -T "date=%y" -T "tracknumber=%n" -T "genre=%m" %s
|
||||
|
||||
Other options :
|
||||
Fill up missing offset samples with silence : Yes
|
||||
Delete leading and trailing silent blocks : No
|
||||
Installed external ASPI interface
|
||||
|
||||
|
||||
Track 1
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\01R.I.P. (english version).wav
|
||||
|
||||
Pre-gap length 0:00:02.00
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC EC43BAD3
|
||||
Copy CRC EC43BAD3
|
||||
Copy OK
|
||||
|
||||
Track 2
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\02L'albero del pane.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC 70584B1D
|
||||
Copy CRC 70584B1D
|
||||
Copy OK
|
||||
|
||||
Track 3
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\03La danza dei grandi rettili.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC 4E17BAEF
|
||||
Copy CRC 4E17BAEF
|
||||
Copy OK
|
||||
|
||||
Track 4
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\04Passaggio.wav
|
||||
|
||||
Peak level 44.4 %
|
||||
Track quality 100.0 %
|
||||
Test CRC D76BE99A
|
||||
Copy CRC D76BE99A
|
||||
Copy OK
|
||||
|
||||
Track 5
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\05Non mi rompete.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC 826A9F81
|
||||
Copy CRC 826A9F81
|
||||
Copy OK
|
||||
|
||||
Track 6
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\06Dopo... niente più è lo stesso.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC CFB6C6BA
|
||||
Copy CRC CFB6C6BA
|
||||
Copy OK
|
||||
|
||||
Track 7
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\07Traccia II.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC D7BAF9A2
|
||||
Copy CRC D7BAF9A2
|
||||
Copy OK
|
||||
|
||||
Track 8
|
||||
Filename C:\Documents and Settings\user\Documenti\file flac\08Metamorfosi.wav
|
||||
|
||||
Peak level 97.7 %
|
||||
Track quality 100.0 %
|
||||
Test CRC BBB2254A
|
||||
Copy CRC BBB2254A
|
||||
Copy OK
|
||||
|
||||
No errors occured
|
||||
|
||||
|
||||
End of status report
|
||||
Reference in new issue
Block a user