From 69c37e13acd820ef48f949afc795bf01d3690ae1 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 13 Oct 2010 10:51:46 +0200 Subject: code cleanup --- id3v2.erl | 16 ++++++++-------- media.erl | 13 +++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/id3v2.erl b/id3v2.erl index 297f8e9..196288a 100644 --- a/id3v2.erl +++ b/id3v2.erl @@ -168,7 +168,7 @@ parse_v2_frame(<<"TLEN">>, _Size, RawContent, _Flags, _Version) -> {tlen, parse_length(RawContent)}; parse_v2_frame(<<"TLE">>, _Size, RawContent, _Flags, _Version) -> {tlen, parse_length(RawContent)}; -parse_v2_frame(_Other, _, _, _, _Version) -> +parse_v2_frame(_Other, _, _, _, _Version) -> ignored. parse_length(RawContent) -> @@ -182,7 +182,7 @@ parse_length(RawContent) -> finalize_v2_frames(Frames) -> lists:reverse([F || F <- Frames, F /= ignored]). - + @@ -252,16 +252,16 @@ extract_v2_string(Binary) -> Str = string:strip(binary_to_list(Bin)), list_to_binary(Str). -decode_v2_string(<<0:8, Rest/binary>>) -> +decode_v2_string(<<0:8, Rest/binary>>) -> unicode:characters_to_binary(Rest, latin1); -decode_v2_string(<<1:8, BOM:2/binary, Rest/binary>>) -> +decode_v2_string(<<1:8, BOM:2/binary, Rest/binary>>) -> {Encoding, _} = unicode:bom_to_encoding(BOM), unicode:characters_to_binary(Rest, Encoding); -decode_v2_string(<<2:8, Rest/binary>>) -> +decode_v2_string(<<2:8, Rest/binary>>) -> unicode:characters_to_binary(Rest, {utf16, big}); -decode_v2_string(<<3:8, Rest/binary>>) -> +decode_v2_string(<<3:8, Rest/binary>>) -> unicode:characters_to_binary(Rest, utf8); -decode_v2_string(Other) -> +decode_v2_string(Other) -> unicode:characters_to_binary(Other, latin1). @@ -433,7 +433,7 @@ read_files([FN|Rest], Total, Fail) -> {ok, Props} -> ?DBG({?GV(trck, Props), ?GV(tit2, Props)}), read_files(Rest, Total+1, Fail); - not_found -> + not_found -> read_files(Rest, Total+1, Fail+1) end; read_files([], Total, Fail) -> diff --git a/media.erl b/media.erl index 13e84c3..a761f64 100644 --- a/media.erl +++ b/media.erl @@ -25,7 +25,7 @@ init() -> mnesia:start(), mnesia:create_table(track, [{attributes, record_info(fields, track)}]), io:format("Initialisation of mnesia successful.\n"). - + % Basic insertion of entrys into the database. Some entries are left out because they are 0 or false. insert(Artist, Title, Filepath) -> @@ -36,14 +36,11 @@ insert(Artist, Title, Filepath) -> % We want to query in order to simplify the next calls. ask(Artist, Title) -> - F = fun() -> - mnesia:match_object({track, Artist, Title, '_', '_', '_'}) - end, - {atomic, Results} = mnesia:transaction(F), + F = fun() -> + mnesia:match_object({track, Artist, Title, '_', '_', '_'}) + end, + {atomic, Results} = mnesia:transaction(F), Results. % We want to play mp3s from our database. play(Artist, Title) -> io:format("blub"). - - - -- cgit v1.2.3