diff options
author | Marco Ziener <mziener@lavabit.com> | 2010-10-14 11:44:32 +0200 |
---|---|---|
committer | Marco Ziener <mziener@lavabit.com> | 2010-10-14 11:44:32 +0200 |
commit | 45c0805771f78696727741b190787d48f4f0f462 (patch) | |
tree | b2f89d61855276c51d1486eab6e5f1faecf093d0 /server | |
parent | 487a46b7a4407ac3612c840d9ead93d73c642d8a (diff) | |
download | erlang-45c0805771f78696727741b190787d48f4f0f462.tar.gz erlang-45c0805771f78696727741b190787d48f4f0f462.tar.xz erlang-45c0805771f78696727741b190787d48f4f0f462.zip |
Mer
Diffstat (limited to 'server')
-rw-r--r-- | server/media.erl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/media.erl b/server/media.erl index 851cc21..f73de20 100644 --- a/server/media.erl +++ b/server/media.erl @@ -9,7 +9,7 @@ % What is an entry in our database made of? By the way the filepath includes the filename. --record(track, {artist, title, votes, locked, filepath }). +-record(track, {title, artist, votes, locked, filepath }). % With which application do we play mp3s? @@ -24,7 +24,7 @@ player(path) -> init() -> mnesia:create_schema([node()]), mnesia:start(), - mnesia:create_table(track, [], {index, [y]}, {type, bag}, [{attributes, record_info(fields, track)}]), + mnesia:create_table(track, [{index, [y]}, {attributes, record_info(fields, track)}]), read_files(filelib:wildcard(?TESTPATTERN),0,0), io:format("Initialisation of mnesia successful.\n"). @@ -43,6 +43,7 @@ read_files([],Total,Fail) -> io:format("Total: ~w, Failed: ~w~n", [Total, Fail]) insert(Artist, Title, Filepath) -> F = fun() -> + mnesia:write(#track{artist = Artist, title = Title, votes = 0, locked = false, filepath = Filepath}) end, mnesia:transaction(F). |