q. I've just downloaded the latest HVSC archive. I want to file the songs under my usual mixed audio collection that is sorted in artist-name/title format but I don't wish to disrupt the HVSC directory structure. I think creating symlinks from the C64Music/letter/lastname_firstname directories to audio/lastname, firstname might do it. However this, as you appreciate, would be a massive headache to do manually. So how could I automate it? With a script I assume, but what should I put in it? I'm a bloody stump with scripts.
a. ???
Labels: bash scripting, file manipulation
q. Help. I've just installed/repaired Procmail. It's filtering incoming mail correctly but how can I run it on an established mailbox/maildir?
a. Try: cat * | formail -s procmail inside the maildir if you are using one. Or if you use mailbox (mbox) format use: formail -s procmail < path/mbox.
Personally I've found this takes forever (give or take a few minutes). The process possibly runs at a low priority. If there is a way to speed it up, then let me know.
Labels: file manipulation, mail
q. I want to rename a dir of mp3s to add a 1 to the start of each filename. What's the best/easiest way to go about it?
a. Either of the following solutions should do it:
ls *.mp3 | (while read; do mv "$REPLY" "1${REPLY}"; done) (ta: petemc)
rename 's/(.*)/1$1/' * (ta: dw)
Labels: bash scripting, file manipulation
q. How do I convert streaming real audio to mp3?
a. If possible download the .ram file by right-clicking on the audio link and selecting save-as, and open it in a text editor of some kind. Even less from the command line should do. eg: less stream.ram. Then paste the full contents (which should be an address beginning with rtsp://) to mplayer. eg: mplayer -ao pcm:file=output.wav rtsp://input.address/file . mplayer should then just play the stream silently and output the sound to a wave file called output.wav. This may take a while depending on the length of the audio stream. There may be a way to speed this up I don't know about yet.
Once it is done you should be able to run: lame output.wav to make an mp3. You can also stipulate the bitrate on the command line eg: lame -b64 output.wav if you want a lower bitrate file since real-audio streams are usually of low quality anyway encoding at 128 or higher is usually just a waste of diskspace. Ultimately you'll want an mp3 the same size or smaller than the source RealMedia file.
Labels: file manipulation
q. How do I easily convert realaudio to mp3 on linux?
a. I've found the following works quite well. You need to have mplayer installed with the correct win32 codecs on your system (On my system they are kept in /usr/lib/win32/). You likely won't get these with your distro for licensing reasons but http://www.mplayerhq.hu/MPlayer/releases/codecs/ will have them. For realaudio you really only need those codecs but you might want to grab the 'all' or 'essential' package if you use mplayer regularly. Then it's a case of: mplayer -ao pcm -aofile output.wav input.ra to change the file to a wave., and then lame output.wav to encode to mp3. This should work with ra or rm. In the case of some audio streams like the BBC's listen again streams you may find you need to edit the wave file using a wave editor of some kind to remove excess chatter from the start and end of the file. The BBC automate these recordings so there is usually the end of the previous program or the start of the next on the streams.
Labels: file manipulation