aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Ziener <mziener@lavabit.com>2010-10-13 12:01:28 +0200
committerMarco Ziener <mziener@lavabit.com>2010-10-13 12:01:28 +0200
commit68f420b2468d4881c66548321c46307f7ce5c5fc (patch)
tree0c9e2fe5b846e23e8ab82bddd44d7e45f31b181a
parent69c37e13acd820ef48f949afc795bf01d3690ae1 (diff)
downloaderlang-68f420b2468d4881c66548321c46307f7ce5c5fc.tar.gz
erlang-68f420b2468d4881c66548321c46307f7ce5c5fc.tar.xz
erlang-68f420b2468d4881c66548321c46307f7ce5c5fc.zip
Changes
-rw-r--r--id3v2.erl4
-rw-r--r--media.erl21
2 files changed, 21 insertions, 4 deletions
diff --git a/id3v2.erl b/id3v2.erl
index 196288a..fc49183 100644
--- a/id3v2.erl
+++ b/id3v2.erl
@@ -421,7 +421,7 @@ v1genre(_) -> "Unknown".
%% Tests
%% ------------------------------------------------------------
--define(TESTPATTERN, "/media/everything/music/The Roots/Things Fall Apart/*.mp3").
+-define(TESTPATTERN, "./ac/*.mp3").
test() ->
Start = now(),
@@ -431,7 +431,7 @@ test() ->
read_files([FN|Rest], Total, Fail) ->
case read_file(FN) of
{ok, Props} ->
- ?DBG({?GV(trck, Props), ?GV(tit2, Props)}),
+ ?DBG({?GV(tpe1, Props), ?GV(tit2, Props)}),
read_files(Rest, Total+1, Fail);
not_found ->
read_files(Rest, Total+1, Fail+1)
diff --git a/media.erl b/media.erl
index a761f64..644d533 100644
--- a/media.erl
+++ b/media.erl
@@ -1,5 +1,5 @@
-module(media).
--export([init/0,insert/3, ask/2]).
+-export([init/0,insert/3, ask/2, all/0]).
% Since we are not willing to calculate and deliver all the id3 tags everytime they are requested,
% we try to get something persistent with mnesia.
@@ -42,5 +42,22 @@ ask(Artist, Title) ->
{atomic, Results} = mnesia:transaction(F),
Results.
+% Just in case the client is interested in everything we got.
+
+all() ->
+ F = fun() ->
+ mnesia:match({track, '_','_','_','_','_'})
+ end,
+ {atomic, Results} = mnesia:transaction(F),
+ Results.
+
% We want to play mp3s from our database.
-play(Artist, Title) -> io:format("blub").
+
+play(Artist, Title, Callback) ->
+ [Head|_] = ask(Artist, Title),
+ {_, artist, title, _, _, fp} = Head,
+ Port = erlang:open_port({spawn, Cmd}, [exit_status]),
+ re
+
+% We want to execute commands locally
+