User:Mjb/Winamp & SHOUTcast

Winamp playlist regeneration on Windows
Every day, I want to:
 * 1) Regenerate a UTF-8-encoded playlist, picking up any changes made on my file system
 * 2) Load the new playlist in Winamp

I used to have a clever Python script for this purpose, but installing Python on Windows is an awfully steep prequisite. As it turns out, a single Windows command-shell command does the trick. This all goes on one line:

cmd.exe /C "chcp 65001 && dir Z:\music /b /s | findstr /e /l ".mp3 .flac .m4a .wav .wma .ogg .mp2" | findstr /e /l /v ".lnk" > playlist.m3u8" && start /b playlist.m3u8

Here's an explanation:
 * = if the previous command completed without error, do what comes next.
 * = pipe the text output of the previous command as input to the next.
 * &hellip; = put the output of the previous command into the designated file.
 * &hellip; = open a command shell window and run the quoted command(s).
 * = set the active code page to UTF-8
 * &hellip; = recursively list the files in the given folder(s), only listing their full paths.
 * &hellip; = output only lines ending with any of these literal strings.
 * &hellip; = output lines not ending with any of these literal strings.
 * &hellip; = open the designated file as a background process (no window).

To get it to run every day, you need to add it to the Task Scheduler, where you also tell it what directory to run from (i.e. where you want the playlist file to go, if you didn't specify a path in the command line). You access the Task Scheduler GUI through the Management Console or with a command-line command (schtasks), the syntax of which is too painful to deal with. Just use the GUI.

SHOUTcast stream transcoding
In 2008, I was looking into offering a low-bitrate MP3 version of an audio stream by connecting to it as a client, transcoding it, and feeding it to another server.

I didn't get very far in my research, but did find several options for grabbing a stream to a file on Unix:

mpg123 -b 4096 -s streamURL > out.mp3 gnetcat -l -p 8081 streamIP streamPort | lame --mp3input -b 64 - out.mp3 mpg123 -b 4096 -s streamURL | lame --mp3input -b 64 - out.mp3

And then there was also fIcy: an icecast/shoutcast stream grabber suite.

I don't remember if I tried any of these. The idea, though, was that if I could send the data to a file, the file could actually be a named pipe into icecast or something. However it didn't occur to me that I'd probably lose the protocol data (stream info and song titles). So it was starting to look like the only real option was going to be streamTranscoder, last updated in 2004.