<commit_before>#!/usr/bin/perl -w

# $Id: test_riff.pl,v 1.2 2001-12-13 11:41:48 bj Exp $

use strict;

open F, "/vol/cd/MP3/jk0001/<NAME> - Sex Machine The Very Best of <NAME>/01 - Please Please Please!.mp3" or die "open failed: $!";


my( $head, $len, $subtype );
my $buf;
my $got = 1;

$got = read( F, $buf, 12 );
($head, $len, $subtype ) = unpack( "A4lA4", $buf );
while( $got && ($got = read( F, $buf, 8 )) ){
	($head, $len ) = unpack( "A4l", $buf );
	print "head=$head, len=$len\n";

	last if $head=data;
	$got = read( F, $buf, $len );
}
close F;<commit_msg>added option to strip riff header (untested)<commit_after>#!/usr/bin/perl -w

# $Id: test_riff.pl,v 1.3 2002-04-28 11:54:41 bj Exp $

use strict;

my $f = shift;
my $o = shift;

# $f = "/vol/cd/MP3/jk0001/<NAME> - Sex Machine The Very Best of <NAME>/01 - Please Please Please!.mp3";
open F, $f or die "open '$f' failed: $!";


my( $head, $len, $subtype );
my $buf;
my $got = 1;
my $hlen = 0;

$hlen = $got = read( F, $buf, 12 );
($head, $len, $subtype ) = unpack( "A4lA4", $buf );

if( $head ne "RIFF" ){
	die "no riff file";
}

print "len: $len\n";

while( $got && ($got = read( F, $buf, 8 )) ){
	$hlen += $got;

	($head, $len ) = unpack( "A4l", $buf );
	print "head=$head, len=$len\n";

	last if $head eq "data";

	$got = read( F, $buf, $len );
	$hlen += $got;
}

print "hlen: $hlen\n";

if( ! defined $o  || -e $o ){
	close F;
	exit 0;
}

print "copy file to $o? (INTR to abort)";
$_ = <STDIN>;

open( O, ">$o" ) || die "cannot open output '$o': $!";
seek F,$hlen+1,0;
while( 0 < read( F, $buf, 10240)){
	print O $buf;
}

close(O);
close(F);

{'fraction_non_alphanumeric': 0.23617153511497824, 'fraction_numerical': 0.044748290863890615, 'mean_word_length': 3.398907103825137, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6761352', 'n_tokens_mistral': 789, 'n_tokens_neox': 720, 'n_words': 222}