Skip to content

Instantly share code, notes, and snippets.

@anazawa
Last active December 11, 2015 23:08
Show Gist options
  • Select an option

  • Save anazawa/4674134 to your computer and use it in GitHub Desktop.

Select an option

Save anazawa/4674134 to your computer and use it in GitHub Desktop.
『基本から学ぶフランス語』語研、音声教材のダウンロード http://www.goken-net.co.jp/audio/420/420_index.htm
curl -O "http://www.goken-net.co.jp/audio/audio_data/420-[001-115]-115.mp3"
1〜59 が disc 1、60~115 が disc 2 にあたる。
しかしながら、書籍に記載されているトラックとファイルの番号が対応していない。
while ( my $mp3 = <*.mp3> ) {
my ( $no ) = $mp3 =~ /^\d\d\d\-(\d\d\d)-\d\d\d/;
my $wav = sprintf "disc%d/%d.wav", $no < 60 ? (1, $no) : (2, $no-59);
printf "[%03d/115] Converting '$mp3' to '$wav'\n", $no;
system 'lame', '--decode', $mp3, $wav;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment