Skip to content

Commit

Permalink
Fix handling of logs with no detected tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
itismadness committed Dec 25, 2023
1 parent 31541a0 commit 4ef88a7
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/Logchecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ private function legacyParse()
$this->Combined = count($this->logs);
} //is_combined
foreach ($this->logs as $LogArrayKey => $Log) {
$this->Tracks[$LogArrayKey] = [];
$this->CurrLog = $LogArrayKey + 1;
if (preg_match('/Exact Audio Copy (.+) from/i', $Log, $Matches)) { //eac v1 & checksum
if ($Matches[1]) {
Expand Down Expand Up @@ -982,22 +983,28 @@ private function legacyParse()
$this->account('Range rip detected', 30);
}
$FormattedTrackListing = '';
//------ Handle individual tracks ------//
$TrackListing = '';
$TrackBodies = [];
if (!$this->Range) {
//------ Handle individual tracks ------//
preg_match('/\nTrack( +)([0-9]{1,3})([^<]+)/i', $Log, $Matches);
$TrackListing = $Matches[0];
$FullTracks = preg_split('/\nTrack( +)([0-9]{1,3})/i', $TrackListing, -1, PREG_SPLIT_DELIM_CAPTURE);
array_shift($FullTracks);
$TrackBodies = preg_split('/\nTrack( +)([0-9]{1,3})/i', $TrackListing, -1);
array_shift($TrackBodies);
//------ Range rip ------//
if (count($Matches) > 0) {
$TrackListing = $Matches[0];
$FullTracks = preg_split('/\nTrack( +)([0-9]{1,3})/i', $TrackListing, -1, PREG_SPLIT_DELIM_CAPTURE);
array_shift($FullTracks);
$TrackBodies = preg_split('/\nTrack( +)([0-9]{1,3})/i', $TrackListing, -1);
array_shift($TrackBodies);
}
} else {
preg_match('/\n( +)Filename +(.*)([^<]+)/i', $Log, $Matches);
$TrackListing = $Matches[0];
$FullTracks = preg_split('/\n( +)Filename +(.*)/i', $TrackListing, -1, PREG_SPLIT_DELIM_CAPTURE);
array_shift($FullTracks);
$TrackBodies = preg_split('/\n( +)Filename +(.*)/i', $TrackListing, -1);
array_shift($TrackBodies);
//------ Range rip ------//
preg_match('/\n( *)Filename +(.*)([^<]+)/i', $Log, $Matches);
if (count($Matches) > 0) {
$TrackListing = $Matches[0];
$FullTracks = preg_split('/\n( *)Filename +(.*)/i', $TrackListing, -1, PREG_SPLIT_DELIM_CAPTURE);
array_shift($FullTracks);
$TrackBodies = preg_split('/\n( *)Filename +(.*)/i', $TrackListing, -1);
array_shift($TrackBodies);
}
}
$Tracks = array();
foreach ($TrackBodies as $Key => $TrackBody) {
Expand Down
11 changes: 11 additions & 0 deletions tests/logs/eac/details/invalid_track_separator.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ripper": "EAC",
"version": "1.6",
"language": "en",
"combined": false,
"score": 0,
"checksum": "checksum_missing",
"details": [
"Invalid log, no tracks!"
]
}
13 changes: 13 additions & 0 deletions tests/logs/eac/details/range_rip_no_space_before_filename.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ripper": "EAC",
"version": "1.6",
"language": "en",
"combined": false,
"score": 50,
"checksum": "checksum_invalid",
"details": [
"Could not verify gap handling (-10 points)",
"Range rip detected (-30 points)",
"Test and copy was not used (-10 points)"
]
}
87 changes: 87 additions & 0 deletions tests/logs/eac/html/invalid_track_separator.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

Exact Audio Copy <span class="log1">V1.6</span> from <span class="log1">23. October 2020</span>

<span class='good'>EAC extraction logfile from <span class='log5'>5. October 2023, 12:20</span></span>

<span class="log4">Neon Plastix / Dream , On Fire</span>

<span class="log5">Used Drive </span>: <span class="good">PLDS DVD+-RW DS-8ABSH Adapter: 1 ID: 0</span>

<span class="log5">Read mode </span>: <span class="good">Secure</span>
<span class="log5">Utilize accurate stream </span>: <span class="good">Yes</span>
<span class="log5">Defeat audio cache </span>: <span class="good">Yes</span>
<span class="log5">Make use of C2 pointers </span>: <span class="good">No</span>

<span class="log5">Read offset correction </span>: <span class="good">6</span>
<span class="log5">Overread into Lead-In and Lead-Out </span>: <span class="log4">No</span>
<span class="log5">Fill up missing offset samples with silence </span>: <span class="good">Yes</span>
<span class="log5">Delete leading and trailing silent blocks </span>: <span class="good">No</span>
<span class="log5">Null samples used in CRC calculations </span>: <span class="good">Yes</span>
<span class="log5">Used interface </span>: <span class="log4">Native Win32 interface for Win NT & 2000</span>
<span class="log5">Gap handling </span>: <span class="goodish">Appended to previous user</span>

<span class="log5">Used output format </span>: <span class="log4">User Defined Encoder</span>
<span class="log5">Selected bitrate </span>: <span class="log4">1024 kBit/s</span>
<span class="log5">Quality </span>: <span class="log4">High</span>
<span class="log5">Add ID3 tag </span>: <span class="good">No</span>
<span class="log5">Command line compressor </span>: <span class="log4">Z:\opt\exact-audio-copy\Flac\flac.exe</span>
<span class="log5">Additional command line options </span>: <span class="log4">-8 -V -T "ARTIST=%artist%" -T "TITLE=%title%" -T "ALBUM=%albumtitle%" -T "DATE=%year%" -T
"userNUMBER=%usernr%" -T "GENRE=%genre%" -T "PERFORMER=%albuminterpret%" -T "COMPOSER=%composer%" %haslyrics%--tag-from-file=LYRICS="%lyricsfile%"%haslyrics% -T "ALBUMARTIST=%albumartist%" -T "DISCNUMBER=%cdnumber%" -T "TOTALDISCS=%totalcds%" -T "TOTALuserS=%numusers%" -T "COMMENT=%comment%" %source% -o %dest%</span>


<span class="log4 log5">TOC of the extracted CD</span>

user | Start | Length | Start sector | End sector
<strong>---------------------------------------------------------</strong>
1 | 0:00.00 | 3:13.29 | 0 | 14503
2 | 3:13.29 | 3:56.16 | 14504 | 32219
3 | 7:09.45 | 3:40.26 | 32220 | 48745


user 1

Filename Z:\home\LinkLucky\Music\Rips\Neon Plastix - Dream , On Fire [FLAC]\01 - Dream.wav

Pre-gap length 0:00:02.00

Peak level 99.8 %
Extraction speed 2.7 X
user quality 100.0 %
Test CRC 814CB963
Copy CRC 814CB963
user not present in AccurateRip database
Copy OK

user 2

Filename Z:\home\LinkLucky\Music\Rips\Neon Plastix - Dream , On Fire [FLAC]\02 - On Fire.wav

Pre-gap length 0:00:01.60

Peak level 99.8 %
Extraction speed 3.0 X
user quality 100.0 %
Test CRC 6C24A712
Copy CRC 6C24A712
user not present in AccurateRip database
Copy OK

user 3

Filename Z:\home\LinkLucky\Music\Rips\Neon Plastix - Dream , On Fire [FLAC]\03 - Halfway to Love.wav

Pre-gap length 0:00:02.58

Peak level 99.8 %
Extraction speed 3.3 X
user quality 100.0 %
Test CRC DDE10390
Copy CRC DDE10390
user not present in AccurateRip database
Copy OK


None of the users are present in the AccurateRip database

<span class="good">No errors occurred</span>
<span class="good">End of status report</span>
72 changes: 72 additions & 0 deletions tests/logs/eac/html/range_rip_no_space_before_filename.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Exact Audio Copy <span class="log1">V1.6</span> from <span class="log1">23. October 2020</span>

<span class='good'>EAC extraction logfile from <span class='log5'>18. September 2021, 11:48</span></span>

<span class="log4">聖飢魔II / 空の雫 (BMG, BVDR-1213)</span>

<span class="log5">Used Drive </span>: <span class="badish">_NEC DVD_RW ND-3550A Adapter: 1 ID: 0 (not found in database)</span>

<span class="log5">Read mode </span>: <span class="good">Secure</span>
<span class="log5">Utilize accurate stream </span>: <span class="good">Yes</span>
<span class="log5">Defeat audio cache </span>: <span class="good">Yes</span>
<span class="log5">Make use of C2 pointers </span>: <span class="good">No</span>

<span class="log5">Read offset correction </span>: <span class="badish">48</span>
<span class="log5">Overread into Lead-In and Lead-Out </span>: <span class="log4">No</span>
<span class="log5">Fill up missing offset samples with silence </span>: <span class="good">Yes</span>
<span class="log5">Delete leading and trailing silent blocks </span>: <span class="good">No</span>
<span class="log5">Null samples used in CRC calculations </span>: <span class="good">Yes</span>
<span class="log5">Used interface </span>: <span class="log4">Native Win32 interface for Win NT & 2000</span>

<span class="log5">Used output format </span>: <span class="log4">User Defined Encoder</span>
<span class="log5">Selected bitrate </span>: <span class="log4">1024 kBit/s</span>
<span class="log5">Quality </span>: <span class="log4">High</span>
<span class="log5">Add ID3 tag </span>: <span class="good">No</span>
<span class="log5">Command line compressor </span>: <span class="log4">C:\Program Files\Exact Audio Copy\Flac\flac.exe</span>
<span class="log5">Additional command line options </span>: <span class="log4">-V -8 -T "Date=%year%" -T "Genre=%genre%" %source%</span>


<span class="log4 log5">TOC of the extracted CD</span>

Track | Start | Length | Start sector | End sector
<strong>---------------------------------------------------------</strong>
1 | 0:00.37 | 4:58.00 | 37 | 22386
2 | 4:58.37 | 4:46.00 | 22387 | 43836
3 | 9:44.37 | 4:55.00 | 43837 | 65961


<span class="bad">Range status and errors</span>

<span class="bad">Selected range</span>

<span class="log5">Filename</span> <span class="log4 log3">C:\Dkogure\聖飢魔II - 空の雫 (BMG, BVDR-1213).wav</span>

<span class="log4">Peak level <span class="log3">100.0 %</span></span>
<span class="log4">Extraction speed <span class="log3">3.4 X</span></span>
<span class="log4">Range quality <span class="log3">99.9 %</span></span>
<span class="log4">Copy CRC <span class="log3">8CB5CC70</span></span>
<span class="good">Copy OK</span>

<span class="good">No errors occurred</span>


<span class="log4 log5">AccurateRip summary</span>

<span class="badish">Track 1 not present in database</span>
<span class="badish">Track 2 not present in database</span>
<span class="badish">Track 3 not present in database</span>

<span class="badish">None of the tracks are present in the AccurateRip database</span>

<span class="good">End of status report</span>

---- CUETools DB Plugin V2.1.6

[CTDB TOCID: nh8tQRWz5TKO_Z7CPWNNCPs3pHk-] found
Submit result: already submitted
Track | CTDB Status
1 | (2/2) Accurately ripped
2 | (2/2) Accurately ripped
3 | (1/2) Accurately ripped, or (1/2) differs in 1 samples @04:54:71

<span class='bad'>==== Log checksum 9187251CC813F706519EADCD5741514C2F7280BC14D54E2E74B2BC32B2D5C986 ====</span>
87 changes: 87 additions & 0 deletions tests/logs/eac/originals/invalid_track_separator.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

Exact Audio Copy V1.6 from 23. October 2020

EAC extraction logfile from 5. October 2023, 12:20

Neon Plastix / Dream , On Fire

Used drive : PLDS DVD+-RW DS-8ABSH Adapter: 1 ID: 0

Read mode : Secure
Utilize accurate stream : Yes
Defeat audio cache : Yes
Make use of C2 pointers : No

Read offset correction : 6
Overread into Lead-In and Lead-Out : No
Fill up missing offset samples with silence : Yes
Delete leading and trailing silent blocks : No
Null samples used in CRC calculations : Yes
Used interface : Native Win32 interface for Win NT & 2000
Gap handling : Appended to previous user

Used output format : User Defined Encoder
Selected bitrate : 1024 kBit/s
Quality : High
Add ID3 tag : No
Command line compressor : Z:\opt\exact-audio-copy\Flac\flac.exe
Additional command line options : -8 -V -T "ARTIST=%artist%" -T "TITLE=%title%" -T "ALBUM=%albumtitle%" -T "DATE=%year%" -T "userNUMBER=%usernr%" -T "GENRE=%genre%" -T "PERFORMER=%albuminterpret%" -T "COMPOSER=%composer%" %haslyrics%--tag-from-file=LYRICS="%lyricsfile%"%haslyrics% -T "ALBUMARTIST=%albumartist%" -T "DISCNUMBER=%cdnumber%" -T "TOTALDISCS=%totalcds%" -T "TOTALuserS=%numusers%" -T "COMMENT=%comment%" %source% -o %dest%


TOC of the extracted CD

user | Start | Length | Start sector | End sector
---------------------------------------------------------
1 | 0:00.00 | 3:13.29 | 0 | 14503
2 | 3:13.29 | 3:56.16 | 14504 | 32219
3 | 7:09.45 | 3:40.26 | 32220 | 48745


user 1

Filename Z:\home\LinkLucky\Music\Rips\Neon Plastix - Dream , On Fire [FLAC]\01 - Dream.wav

Pre-gap length 0:00:02.00

Peak level 99.8 %
Extraction speed 2.7 X
user quality 100.0 %
Test CRC 814CB963
Copy CRC 814CB963
user not present in AccurateRip database
Copy OK

user 2

Filename Z:\home\LinkLucky\Music\Rips\Neon Plastix - Dream , On Fire [FLAC]\02 - On Fire.wav

Pre-gap length 0:00:01.60

Peak level 99.8 %
Extraction speed 3.0 X
user quality 100.0 %
Test CRC 6C24A712
Copy CRC 6C24A712
user not present in AccurateRip database
Copy OK

user 3

Filename Z:\home\LinkLucky\Music\Rips\Neon Plastix - Dream , On Fire [FLAC]\03 - Halfway to Love.wav

Pre-gap length 0:00:02.58

Peak level 99.8 %
Extraction speed 3.3 X
user quality 100.0 %
Test CRC DDE10390
Copy CRC DDE10390
user not present in AccurateRip database
Copy OK


None of the users are present in the AccurateRip database

No errors occurred

End of status report
Loading

0 comments on commit 4ef88a7

Please sign in to comment.