title
Products            Buy            Support Forum            Professional            About            Codec Central
 
Results 1 to 12 of 12

Thread: Manual access to AR database.

  1. #1

    Join Date
    Aug 2012
    Posts
    7

    Manual access to AR database.

    Hi!

    I have some flac albums that does not have any of cue or log file.
    But i want to check it with accuraterip database. I can try to manually find discID with freedb or simmilar and remake cue file. While this is quite easy, i do not know how to access AccurateRip DataBase to check which ID is the good one (in one database you can find few albums on the same name).

    My technique is to CRC first or second track and look for it in database. I use morituri to to do CRC and verify. It takes quite long time to CRC whole album (it is quite old script).

    I use linux, btw.

    Regards.

  2. #2
    dBpoweramp Guru
    Join Date
    Nov 2007
    Location
    Florida, USA
    Posts
    5,730

    Re: Manual access to AR database.

    why not just check these albums with PerfectTunes. This will do what you want in terms of checking for AR matches after the fact.

  3. #3

    Join Date
    Aug 2012
    Posts
    7

    Re: Manual access to AR database.

    I use linux. Whole work i do on home server. It is about 200GB of flac's at '-8' compression. It will take some time and i like to have my laptop with me. I can provide scripts to automate process, so i need 'manual' access.

    I wont use windows software.

  4. #4
    dBpoweramp Guru
    Join Date
    Feb 2007
    Posts
    792

    Re: Manual access to AR database.

    'windows software' is a loosely determined word. If you refuse to try PerfectTunes, I take it that WINE'd exe's are a no-no.

    CUETools is written in .NET. It is open source. Maybe you can get it running under Mono. It is open source. It offers cross-pressing verification against ARv1 sums, but not ARv2.
    It took inspiration from a .pl script called ARCue.

    Edit: CUETools uses Visual C++ Runtime too.
    Last edited by Porcus; 08-22-2012 at 08:46 AM.

  5. #5

    Join Date
    Aug 2012
    Posts
    7

    Re: Manual access to AR database.

    No, there is no problem with using windows software (open-source or not), I just prefer something more linux or at last text-based.

    Anyway, do You know software, where i can insert only discid to get checksums?
    Or i miss something?

  6. #6
    dBpoweramp Guru
    Join Date
    Feb 2007
    Posts
    792

    Re: Manual access to AR database.

    Quote Originally Posted by e-San View Post
    software, where i can insert only discid to get checksums?
    'discid' -- if you mean the CDDB / FreeDB ID, then it isn't sufficiently fine-grained and is prone to collisions. It is an 8 hexadecimals string; the AccurateRip ID is totaltracks-8 hexadecimals-8 more hexadecimals-CDDB ID-tracknumber. But as dBpoweramp is the only (?) application using this particular tag, I don't think you will find that tag-to-lookup feature in any application. The applications I mentioned, computes it from track lengths, but it sometimes gets wrong; the standard pregap is 2 seconds, and if it isn't 2 seconds then you need a cuesheet to correct it. That's what e.g. CUETools does.

  7. #7

    Join Date
    Aug 2012
    Posts
    7

    Re: Manual access to AR database.

    I use gnudb.org, so it shall be discid.

    I use morituri to calculate album's checksums.
    Some of does not work (ie. not in db), so i change discid. And hope my half-automate CUE works.
    But morituri AGAIN calculates totaltracks-8 hexadecimals-8 checksums.

  8. #8
    dBpoweramp Guru
    Join Date
    Feb 2007
    Posts
    792

    Re: Manual access to AR database.

    All right. Wasn't aware of morituri. I suppose most penguinists will wine up dBpoweramp or EAC or maybe foobar2000 if they want AccurateRip.

    Myself I reluctantly chose a Windows platform because I wanted to use dBpoweramp for ripping and foobar2000 for playback, and not to mention that at that time it was hard to get my 200 CD changer work with anything but XP Media Center Edition ... I even chose my laptop for that OS, lucky me that XP-based computers were getting discounted as the dreaded Vista was being pushed out in the market.

  9. #9

    Join Date
    Aug 2012
    Posts
    7

    Re: Manual access to AR database.

    All right. Wasn't aware of morituri. I suppose most penguinists will wine up dBpoweramp or EAC or maybe foobar2000 if they want AccurateRip.
    Yeah, i know, my problem is quite speciffic. Wine is not good enought for me in that case.

    But if You can tell me with what software i can download info from accuraterip database (with CUE or simple DiscID) without calculating AR CRC - even windows software, i belive it would be enought for me...

    200 CD changer work with anything but XP Media Center Edition
    Hard to belive, but i can image.

  10. #10
    dBpoweramp Guru
    Join Date
    Feb 2007
    Posts
    792

    Re: Manual access to AR database.

    Quote Originally Posted by e-San View Post
    But if You can tell me with what software i can download info from accuraterip database (with CUE or simple DiscID) without calculating AR CRC - even windows software, i belive it would be enought for me...
    Each AccurateRip disc ID has some url of the form http://www.accuraterip.com/accurater...7-6409b909.bin , where the part between dBAR- and .bin is taken from the AccurateRip ID. The .bin file is not human readable. Both CUETools and Morituri have -- somewhere in the code -- the algorithms for looking up, and CUETools can generate from CUEsheet. You cannot use 'simple DiscID' if by that you mean the CDDB ID, because that does not have sufficient precision. You can use the files themselves, if pregaps are of standard length (2 seconds) -- that's what CUETools does if it doesn't have a cuesheet.
    Last edited by Porcus; 08-28-2012 at 06:54 AM.

  11. #11

    Join Date
    Aug 2012
    Posts
    7

    Re: Manual access to AR database.

    I am trying to analyse ARCue.pl software.

    In most cases You are right. But with one not - it is not very dificult to get addresses and decode bin files:
    Code:
     	* Calculate the three disc ids used by AR
    	my ($discId1, $discId2, $cddbDiscId) = (0, 0, 0);
    
    	{
    		use integer;
    
    		for (my $trackNo = 0; $trackNo <= $trackCount; $trackNo++) {
    			my $trackOffset = $trackOffsets[$trackNo];
    
    			$discId1 += $trackOffset;
    			$discId2 += ($trackOffset ? $trackOffset : 1) * ($trackNo + 1);
    			if ($trackNo < $trackCount) {
    				$cddbDiscId = $cddbDiscId + sumDigits(int($trackOffset/75) + 2);
    			}
    		}
    
    		$cddbDiscId = (($cddbDiscId % 255) << 24) + ((int($trackOffsets[$trackCount]/75) - int($trackOffsets[0]/75)) << 8) + $trackCount;
    
    		$discId1 &= 0xFFFFFFFF;
    		$discId2 &= 0xFFFFFFFF;
    		$cddbDiscId &= 0xFFFFFFFF;
    	}
    Code:
      print "Checking AccurateRip database\n\n";
    
    	* See if we can find the disc in the database
    	my $arUrl = sprintf("http://www.accuraterip.com/accuraterip/%.1x/%.1x/%.1x/dBAR-%.3d-%.8x-%.8x-%.8x.bin", 
    		$discId1 & 0xF, $discId1>>4 & 0xF, $discId1>>8 & 0xF, $trackCount, $discId1, $discId2, $cddbDiscId);
    
    	my $arDiscNotInDb = 0;
    	my $arNetworkFailed = 0;
    
    	my $response = $lwpUserAgent->get($arUrl);
    
    	if (!$response->is_success) {
    		if ($response->status_line =~ m/^404/) {
    			$arDiscNotInDb = 1;
    		}else{
    			$arNetworkFailed = $response->status_line;
    		}
    	}
    
    	* Extract CRCs from response data
    	my $arCrcCount = 0;
    	my @arTrackConfidences = ();
    	my @arTrackCRCs = ();
    
    	if (!($arDiscNotInDb || $arNetworkFailed)) {
    		my $arCrcData = $response->content;
    		my $ptr = 0;
    
    		while ($ptr < length($arCrcData)) {
    			my ($chunkTrackCount, $chunkDiscId1, $chunkDiscId2, $chunkCddbDiscId);
    
    			* Force perl to interpret these values as signed integers
    			{
    				use integer;
    
    				$chunkTrackCount = unpack("c",substr($arCrcData,$ptr,1));
    				$chunkDiscId1 = unpack("V",substr($arCrcData,$ptr+1,4)) + 0;
    				$chunkDiscId2 = unpack("V",substr($arCrcData,$ptr+5,4)) + 0;
    	 			$chunkCddbDiscId = unpack("V",substr($arCrcData,$ptr+9,4)) + 0;
    			}
    
    			$ptr +=13;
    
    			if ( $chunkTrackCount != $trackCount
    				|| $chunkDiscId1 != $discId1
    				|| $chunkDiscId2 != $discId2
    				|| $chunkCddbDiscId != $cddbDiscId ) {
    
    				croak("Track count or Disc IDs don't match.");
    			}
    
    			* How if it flagged that a track is not in the database?
    			for (my $track = 0; $track < $trackCount; $track++) {
    				my ($trackConfidence, $trackCrc);
    
    				* Force perl to interpret these values as signed integers
    				{
    					use integer;
    
    					$trackConfidence = unpack("c",substr($arCrcData,$ptr,1));
    					$trackCrc = unpack("V",substr($arCrcData,$ptr+1,4)) + 0;
    					$ptr += 9;
    				}
    
    				if ($arCrcCount == 0){
    					$arTrackConfidences[$track] = [];
    					$arTrackCRCs[$track] = [];
    				}
    
    				$arTrackConfidences[$track]->[$arCrcCount] = $trackConfidence;
    				$arTrackCRCs[$track]->[$arCrcCount] = $trackCrc;
    			}
    			$arCrcCount++;
    		}
    	}
    Code:
    printf "Track\tRipping Status\t\t[Disc ID: %08x-%08x]\n\n", $discId1, $cddbDiscId;
    
    	* Calculate a CRC for each track
    	my @trackCRCs = ();
    	my ($accuratelyRipped, $notAccuratelyRipped, $notInDatabase) = (0, 0, 0);
    	for (my $trackNo = 0; $trackNo < $trackCount; $trackNo++) {
    		seek($FH, $dataOffset + $trackOffsets[$trackNo] * 2352, 0);
    
    		my ($frame, $CRC);
    		$CRC = 0;
    		for (my $frameNo = 0; $frameNo < $trackLengths[$trackNo]; $frameNo++) {
    			if (read($FH, $frame, 2352) != 2352) { croak ("read failed.") };
    
    			{
    				use integer;
    				$CRC += processFrame($frame, $frameNo, $trackLengths[$trackNo], $trackNo == 0, $trackNo == $trackCount - 1);
    			}
    		}
    
    		{
    			use integer;
    			$trackCRCs[$trackNo] = $CRC & 0xFFFFFFFF;
    		}
    
    
    		if ($arDiscNotInDb) {
    			printf " %d\tTrack not present in database.    [%08x]\n", 
    				$trackNo + 1, $trackCRCs[$trackNo];
    
    			 $notInDatabase++;
    		}	elsif ($arNetworkFailed) {
    			printf " %d\t    [%08x]\n", 
    				$trackNo + 1, $trackCRCs[$trackNo];
    
    		} else {
    
    			my $foundCrc = 0;
    			my $foundCrcMatch = 0;
    
    			for (my $arCrcNo=0; $arCrcNo < $arCrcCount; $arCrcNo++) {
    				if ($arTrackConfidences[$trackNo]->[$arCrcNo] != 0){
    					$foundCrc = 1;
    
    					if ($arTrackCRCs[$trackNo]->[$arCrcNo] == $trackCRCs[$trackNo]) {
    						printf " %d\tAccurately Ripped    (confidence %d)     [%08x]\n", 
    							$trackNo + 1, $arTrackConfidences[$trackNo]->[$arCrcNo], $arTrackCRCs[$trackNo]->[$arCrcNo];
    
    						$accuratelyRipped++;
    
    						$foundCrcMatch = 1;
    						last;
    					}
    				}
    			}
    			if (!$foundCrc) {
    					printf " %d\tTrack not present in database.    [%08x]\n", 
    					$trackNo + 1, $trackCRCs[$trackNo];
    
    				$notInDatabase++;
    			}elsif (!$foundCrcMatch) {
    				printf " %d\t** Rip not accurate **   (confidence %d)     [%08x] [%08x]\n", 
    					$trackNo + 1, $arTrackConfidences[$trackNo]->[0], $arTrackCRCs[$trackNo]->[0], $trackCRCs[$trackNo];
    
    				$notAccuratelyRipped++;
    			}
    		}
    	}
    
    	print "\n_______________________\n\n";
    
    	if ($arDiscNotInDb) {
    			print "Disc not present in AccurateRip database.\n";
    	} elsif ($arNetworkFailed) {
    			print "Failed to get $arUrl : " . $arNetworkFailed . "\n";
    	} elsif ($accuratelyRipped == $trackCount) {
    		print "All Tracks Accurately Ripped.\n";
    	} else {
    		if ($notAccuratelyRipped >= 3) {
    			 print "Your CD disc is possibly a different pressing to the one(s) stored in AccurateRip.\n"
    		}
    
    		printf "Track(s) Accurately Ripped: %d\n", $accuratelyRipped;
    		printf "**** Track(s) Not Ripped Accurately: %d ****\n", $notAccuratelyRipped;
    		printf "Track(s) Not in Database: %d\n", $notInDatabase;
    	}
    
    	print "\n\n\n";
    }
    I will try to modify somehow this script...

  12. #12

    Join Date
    Aug 2012
    Posts
    7

    Re: Manual access to AR database.

    ARFlac.pl looks like doing the job and it is for linux.
    It is better and faster.

    This topic can be tagged as Solved.

    Regards and thanks for helping.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •