460b9539 |
1 | /* |
2 | * This file is part of DisOrder. |
5aff007d |
3 | * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell |
460b9539 |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
18 | * USA |
19 | */ |
20 | |
05b75f8d |
21 | #include "common.h" |
460b9539 |
22 | |
23 | #include <stddef.h> |
460b9539 |
24 | #include <stdlib.h> |
25 | #include <time.h> |
26 | |
27 | #include <disorder.h> |
28 | |
29 | static void record(const char *track, const char *what) { |
30 | const char *count; |
31 | int ncount; |
32 | char buf[64]; |
33 | |
34 | if((count = disorder_track_get_data(track, what))) |
35 | ncount = atoi(count); |
36 | else |
37 | ncount = 0; |
38 | disorder_snprintf(buf, sizeof buf, "%d", ncount + 1); |
39 | disorder_track_set_data(track, what, buf); |
40 | } |
41 | |
42 | void disorder_notify_play(const char *track, |
43 | const char *submitter) { |
44 | char buf[64]; |
45 | |
46 | if(submitter) |
47 | record(track, "requested"); |
48 | record(track, "played"); |
49 | disorder_snprintf(buf, sizeof buf, "%"PRIdMAX, (intmax_t)time(0)); |
50 | disorder_track_set_data(track, "played_time", buf); |
51 | } |
52 | |
53 | void disorder_notify_queue(const char attribute((unused)) *track, |
54 | const char attribute((unused)) *submitter) { |
55 | } |
56 | |
57 | void disorder_notify_scratch(const char *track, |
58 | const char attribute((unused)) *submitter, |
59 | const char attribute((unused)) *scratcher, |
60 | int attribute((unused)) seconds) { |
61 | record(track, "scratched"); |
62 | } |
63 | |
64 | void disorder_notify_not_scratched(const char *track, |
65 | const char attribute((unused)) *submitter) { |
66 | record(track, "unscratched"); |
67 | } |
68 | |
69 | void disorder_notify_queue_remove(const char attribute((unused)) *track, |
70 | const char attribute((unused)) *remover) { |
71 | } |
72 | |
73 | void disorder_notify_queue_move(const char attribute((unused)) *track, |
74 | const char attribute((unused)) *mover) { |
75 | } |
76 | |
77 | void disorder_notify_pause(const char attribute((unused)) *track, |
78 | const char attribute((unused)) *who) { |
79 | } |
80 | |
81 | void disorder_notify_resume(const char attribute((unused)) *track, |
82 | const char attribute((unused)) *who) { |
83 | } |
84 | |
85 | /* |
86 | Local Variables: |
87 | c-basic-offset:2 |
88 | comment-column:40 |
89 | End: |
90 | */ |