SHOUTcast server: mp3_manager module
Alain O'Dea
18 posts
|
The SHOUTcast server example uses the mp3_manager module. This module is not described in the book and its code is not provided in the book. The code from the site includes mp3_manager.erl, but it includes hard-coded paths for Joe’s own computer. How does the mp3_manager module work and what needs to be changed to make it work on Mac OS X? |
Alain O'Dea
18 posts
|
I added a function mp3_manager.erl: start() ->
{ok,[{Root, Pattern}|_]} = file:consult(mp3_manager),
Files = lib_files_find:files(Root, Pattern, true),
V = map(fun handle/1, Files),
lib_misc:dump("mp3data", V).
mp3_manager: {"/Users/alain/Music/iTunes/iTunes Music", "*.mp3"}.
I noticed after I ran the modified mp3_manager module that it creates a file called
|
Alain O'Dea
18 posts
|
Certain MP3 files will cause the Here is a simple solution. Refactor and extend unpack_song_descriptor({File, Metadata}) ->
PrintStr = get_print_str(Metadata),
L1 = ["StreamTitle='", PrintStr,
"';StreamUrl='http://localhost:3000';"],
%% io:format("L1=~p~n", [L1]),
Bin = list_to_binary(L1),
Nblocks = ((size(Bin) - 1) div 16) + 1,
NPad = Nblocks*16 - size(Bin),
Extra = lists:duplicate(NPad, 0),
Header = list_to_binary([Nblocks, Bin, Extra]),
%% Header is the SHOUTcast header
{File, PrintStr, Header}.
get_print_str({_Tag, Info}) ->
list_to_binary(make_header1(Info));
get_print_str(no) ->
<<"UNKNOWN">>.
This makes |
Joe Armstrong
5 posts
|
Excellent. The reason for dumping to a .tmp file was that I sometimes manually removed Unfortunately it proved to be rather difficult to write code that correct unpacks all ID3 tags Incidentally, I was able to make the shoutcast code in the book run with my soundbridge so I could Cheers /Joe Armstrng |
4 posts, 2 voices
