aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/media.erl5
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).