chiark / gitweb /
Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/disorder
[disorder] / plugins / notify.c
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
5aff007d 3 * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
460b9539 4 *
e7eb3a27 5 * This program is free software: you can redistribute it and/or modify
460b9539 6 * it under the terms of the GNU General Public License as published by
e7eb3a27 7 * the Free Software Foundation, either version 3 of the License, or
460b9539 8 * (at your option) any later version.
9 *
e7eb3a27
RK
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
460b9539 15 * You should have received a copy of the GNU General Public License
e7eb3a27 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 17 */
132a5a4a
RK
18/** @file plugins/notify.c
19 * @brief Standard notify plugin
20 *
21 * The arrangements here are not very satisfactory - you wanted to be
22 * able to replace the plugin but still keep its features. So you
23 * wanted a list of plugins really.
24 */
460b9539 25
05b75f8d 26#include "common.h"
460b9539 27
28#include <stddef.h>
460b9539 29#include <stdlib.h>
30#include <time.h>
31
32#include <disorder.h>
33
34static void record(const char *track, const char *what) {
35 const char *count;
36 int ncount;
37 char buf[64];
38
39 if((count = disorder_track_get_data(track, what)))
40 ncount = atoi(count);
41 else
42 ncount = 0;
43 disorder_snprintf(buf, sizeof buf, "%d", ncount + 1);
44 disorder_track_set_data(track, what, buf);
45}
46
47void disorder_notify_play(const char *track,
48 const char *submitter) {
49 char buf[64];
50
51 if(submitter)
52 record(track, "requested");
53 record(track, "played");
54 disorder_snprintf(buf, sizeof buf, "%"PRIdMAX, (intmax_t)time(0));
55 disorder_track_set_data(track, "played_time", buf);
56}
57
58void disorder_notify_queue(const char attribute((unused)) *track,
59 const char attribute((unused)) *submitter) {
60}
61
62void disorder_notify_scratch(const char *track,
63 const char attribute((unused)) *submitter,
64 const char attribute((unused)) *scratcher,
65 int attribute((unused)) seconds) {
66 record(track, "scratched");
67}
68
69void disorder_notify_not_scratched(const char *track,
70 const char attribute((unused)) *submitter) {
71 record(track, "unscratched");
72}
73
74void disorder_notify_queue_remove(const char attribute((unused)) *track,
75 const char attribute((unused)) *remover) {
76}
77
78void disorder_notify_queue_move(const char attribute((unused)) *track,
79 const char attribute((unused)) *mover) {
80}
81
82void disorder_notify_pause(const char attribute((unused)) *track,
83 const char attribute((unused)) *who) {
84}
85
86void disorder_notify_resume(const char attribute((unused)) *track,
87 const char attribute((unused)) *who) {
88}
89
90/*
91Local Variables:
92c-basic-offset:2
93comment-column:40
94End:
95*/