[xiph-cvs] cvs commit: BlueberryArmageddon blueberry_armageddon

Monty xiphmont at xiph.org
Mon Apr 1 11:46:50 PST 2002



xiphmont    02/04/01 11:46:50

  Modified:    .        blueberry_armageddon
  Log:
  requery discs with MSF 0 2 0 if first try doesn't yield a CDDB entry

Revision  Changes    Path
1.2       +53 -19    BlueberryArmageddon/blueberry_armageddon

Index: blueberry_armageddon
===================================================================
RCS file: /usr/local/cvsroot/BlueberryArmageddon/blueberry_armageddon,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- blueberry_armageddon	2002/04/01 07:58:39	1.1
+++ blueberry_armageddon	2002/04/01 19:46:49	1.2
@@ -390,29 +390,63 @@
         my at temp=@{$discs[0]};
       
         if(!defined(@discs)|| $#discs<0 || !defined(@temp[1])){
-	    Status("Album Loaded; no CDDB entry");
-	    for(my$i=1;$i<=$tracks;$i++){
-		$trackname[$i]="";
-	    }
-	    $artist="";
-	    $album="";
-	}else{
-	    my ($genre, $cddb_id, $title) = @{$discs[0]};
-	    $title=~/(.+)\s\/\s(.+)/;
-	    $artist=$1;
-	    $album=$2;
-	    $artist=~s/\//:/g;
-	    $album=~s/\//:/g;
-	    my $disc_info     = $cddb->get_disc_details($genre, $cddb_id);
 
-	    for(my$i=0;$i<$tracks;$i++){
-		$trackname[$i+1]=$disc_info->{"ttitles"}[$i];
-		$trackname[$i+1]=~s/\//:/g;
+	    # CDDB protocol is stupidly designed in many ways, but one
+	    # of the biggest is that matching depends on the offset of
+	    # the first track... which is neither deterministic from
+	    # CDROM drive to CDROM drive, nor a well defined concept
+	    # in the RedBook spec.  Even worse, it appears that much
+	    # CDROM software always reports it as MSF 0 2 0 regardless
+	    # of what it is, and thus CDDB often has the offset for
+	    # the whole disc fucked up.
+	    
+	    # retry with 1 0 2 0
+	    
+	    $toc[0]="1 0 2 0";
+	    
+	    # perform cddb query
+	    $cddb->DESTROY();
+	    $cddb = new CDDB() or die $!;
+	    Status("Requerying database");
+	    $toplevel->update();
+	    @discs = $cddb->get_discs_by_toc(@toc);
+	    
+	    @temp=@{$discs[0]};
+	    
+	    if(!defined(@discs)|| $#discs<0 || !defined(@temp[1])){
+
+
+		Status("Album Loaded; no CDDB entry");
+		for(my$i=1;$i<=$tracks;$i++){
+		    $trackname[$i]="";
+		}
+		$artist="";
+		$album="";
+
+		$cddb->DESTROY();
+		
+		AlbumUpdate();
+		$window_go->configure(-state=>"normal");
+		$window_check->configure(-state=>"normal");
+		return;
             }
+	}
 
-	    Recheck();
-	    Status("Album Loaded");
+	my ($genre, $cddb_id, $title) = @{$discs[0]};
+	$title=~/(.+)\s\/\s(.+)/;
+	$artist=$1;
+	$album=$2;
+	$artist=~s/\//:/g;
+	$album=~s/\//:/g;
+	my $disc_info     = $cddb->get_disc_details($genre, $cddb_id);
+	
+	for(my$i=0;$i<$tracks;$i++){
+	    $trackname[$i+1]=$disc_info->{"ttitles"}[$i];
+		$trackname[$i+1]=~s/\//:/g;
         }
+	
+	Recheck();
+	Status("Album Loaded");
         $cddb->DESTROY();
 
         AlbumUpdate();

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list