Skip to content

Instantly share code, notes, and snippets.

@shoorick
Created December 4, 2013 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoorick/7785185 to your computer and use it in GitHub Desktop.
Save shoorick/7785185 to your computer and use it in GitHub Desktop.
Split big pseudo zip-archive from prostopleer.com into small mp3 files.
#!/usr/bin/perl -0777 -n
=head1 DESCRIPTION
Split big pseudo zip-archive from prostopleer.com into small mp3 files.
=head1 USAGE
./split-prostopleer.pl big-pseudo.zip
=head1 SEE ALSO
L<< https://gist.github.com/shoorick/7785185 >>
=head1 AUTHOR
Alexander Sapozhnikov
L<< http://shoorick.ru/ >>
L<< E<lt>shoorick@cpan.orgE<gt> >>
=cut
binmode(STDIN);
my $divisor = "ID3\x04\x00";
my @chunks = split $divisor;
shift @chunks;
my $i = 1;
foreach my $chunk ( @chunks ) {
open(my $fh, '>', sprintf('%02d.mp3', $i++))
or die "cannot open for writing: $!";
print $fh $divisor, $chunk;
close $fh;
}
@shoorick
Copy link
Author

shoorick commented Dec 4, 2013

in Russian

Разбивает большие файлы *.zip с сайта ProstoPleer.com (на самом деле не являющиеся ZIP-архивами) на отдельные MP3-файлы.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment