summaryrefslogtreecommitdiff
path: root/apps/plugins/favorites.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/favorites.c')
-rw-r--r--apps/plugins/favorites.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/apps/plugins/favorites.c b/apps/plugins/favorites.c
deleted file mode 100644
index d45f785d64..0000000000
--- a/apps/plugins/favorites.c
+++ /dev/null
@@ -1,46 +0,0 @@
1#include "plugin.h"
2#define FAVORITES_FILE "/favorites.m3u"
3
4PLUGIN_HEADER
5
6static struct plugin_api* rb;
7
8enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
9{
10 struct mp3entry* id3;
11 char track_path[MAX_PATH+1];
12 int fd, result, len;
13
14 rb = api;
15
16 /* If we were passed a parameter, use that as the file name,
17 else take the currently playing track */
18 if(parameter) {
19 rb->strncpy(track_path, parameter, MAX_PATH);
20 } else {
21 id3 = rb->audio_current_track();
22 if (!id3) {
23 rb->splash(HZ*2, true, "Nothing To Save");
24 return PLUGIN_OK;
25 }
26 rb->strncpy(track_path, id3->path, MAX_PATH);
27 }
28
29 track_path[MAX_PATH] = 0;
30
31 len = rb->strlen(track_path);
32
33 fd = rb->open(FAVORITES_FILE, O_CREAT|O_WRONLY|O_APPEND);
34
35 if (fd >= 0) {
36 // append the current mp3 path
37 track_path[len] = '\n';
38 result = rb->write(fd, track_path, len + 1);
39 track_path[len] = '\0';
40 rb->close(fd);
41 }
42
43 rb->splash(HZ*2, true, "Saved Favorite");
44
45 return PLUGIN_OK;
46}