mp3_to_dl

来自「A MP3 Player Source Code, Enjoy it!」· 代码 · 共 25 行

TXT
25
字号
#! /usr/bin/perl# convert a MP3 file into a text-only format that may be download# to the MP3 player's memory-only playback program.  The format is# just uuencoded data in 4096 byte blocks, with the word "end" after# the last line.$ARGV[0] && $ARGV[1] || die "Usage: mp3_to_dl input.mp3 output.txt\n";open(FIN, "$ARGV[0]") || die "Unable to read $ARGV[0]\n";open(FOUT, ">$ARGV[1]") || die "Unable to write $ARGV[1]\n";$len = -s $ARGV[0];$block = 30;while ($len > 0) {	$num = 4096 - read(FIN, $data, 4096);	$data .= pack("x$num") if $num > 0;	print FOUT pack('u', $data);	$len -= 4096;}print FOUT "end\n";close FIN;close FOUT;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?