Esmeralda: noch was...

Beitrag lesen

Folgendes stammt nicht aus meiner Feder, könnte aber interessant sein:
(Ich habe es leicht abgewandelt)

----------------
#!/usr/bin/perl

use Getopt::Std;
use MP3::Info;

%options=();
getopts('unh', %options);

if($options{h}){&usage()}
if(!$options{n}){
    use CDDB;
}

@files=<*.mp3>;

my ($totsecs,$totid,$i,$totfrm,$sstring,$sstring2);

my @tks;
$i=0;
$totsecs=2;
$totfrm=150;
$sstring='150 ';
$sstring2='150+';

foreach $file (@files){

my $info=get_mp3info($file);
    my ($id);
    my $secs=60*$info->{MM};
    $secs+=$info->{SS};
    $totsecs+=$secs;
    print "$file: $secs";

push(@tks, $secs);

if($i==0){
        print "150 ";
$test[0] = 150;
        $totfrm+=$secs*75;
    }else{
        print "$totfrm ";
$test[$i] = $totsecs*75;
        $sstring.="$totfrm ";
        $sstring2.="$totfrm+";
        $totfrm+=$secs*75;
        print ": ", $tks[$i-1]*75;
    }

while ($secs > 0){
        $id+=($secs % 10);
        $secs /= 10;
    }
    print ": $id\n";
    $totid+=$id;
    $i++;
}
chomp $sstring;

print "\ntotal secs: $totsecs\n";
print "total tracks: $i\n";
print "totid=$totid\n";
$cddbid=((($totid % 0xFF) << 24) | (($totsecs) << 8) | $#files+1);
#$cddbid= sprintf ("%08x", $cddbid), "\n";
$cddbid= sprintf ("%08x", $cddbid);

print "ID: ".$cddbid."\n";
for ($j=0;$j<=$i;$j++)
        {
                print $test[$j]."\n";
        }

if(!$options{n}){
    my $cddb= new CDDB( Host => 'freedb.org',
                        Port => 888
                        ) or die $!;

my @discs = $cddb->get_discs($cddbid, "$i ".$sstring, $totsecs);
    foreach my $disc (@discs) {
        my ($genre, $cddb_id, $title) = @$disc;
        if($cddb_id){
            print "$genre, $cddb_id, $title\n";
        }
    }
}

if($options{u}){
    print "http://cddb.celestial.com/~cddb/cddb.cgi?cmd=cddb+query+$cddbid+";
    print "$i+${sstring2}$totsecs&hello=blah+my.host.com+fads+2&proto=1\n";
#    my $disc_info = $cddb->get_disc_details($genre, $cddb_id);
}

sub usage {

print <<EOF;
Usage: mp3ascd.pl [options]

Where [options] is zero or more of the following:

-u  Print out a URL that will perform a cddb lookup.
    -n  Do not query cddb server, or import CDDB module.
    -h  Display this help screen.

EOF
    exit(0);
}
----------------

Man gehe in ein Verzeichnis, in dem vermutlicherweise eine komplette Platte lungert und rufe das Script auf...
Das Gerät meldet, ob und welche PLatte das sein könnte.

---

Langsam wird aus diesem Gepuzzel, daß ich hier veranstaltet habe, vielleicht ersichtlich, worum es geht...

Frage ist nur noch, wer sich mit Fasttrack auskennt oder besser Socketprogrammierung.