Mercurial > audlegacy-plugins
comparison src/streambrowser/bookmarks.c @ 2891:c27da2c06805
initial code for bookmarks
author | Calin Crisan ccrisan@gmail.com |
---|---|
date | Tue, 12 Aug 2008 23:49:32 +0200 |
parents | |
children | 113454baecf8 |
comparison
equal
deleted
inserted
replaced
2890:5e97b55f87cf | 2891:c27da2c06805 |
---|---|
1 /* | |
2 * Audacious Streambrowser Plugin | |
3 * | |
4 * Copyright (c) 2008 Calin Crisan <ccrisan@gmail.com> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; under version 3 of the License. | |
9 * | |
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 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with this program. If not, see <http://www.gnu.org/licenses>. | |
17 */ | |
18 | |
19 | |
20 #include <string.h> | |
21 #include <glib.h> | |
22 #include <audacious/plugin.h> | |
23 | |
24 #include "streambrowser.h" | |
25 #include "bookmarks.h" | |
26 | |
27 | |
28 static bookmark_t *bookmarks; | |
29 static int bookmarks_count; | |
30 | |
31 gboolean bookmarks_streaminfo_fetch(category_t *category, streaminfo_t *streaminfo) | |
32 { | |
33 } | |
34 | |
35 gboolean bookmarks_category_fetch(streamdir_t *streamdir, category_t *category) | |
36 { | |
37 debug("bookmarks: filling category '%s'\n", category->name); | |
38 | |
39 /* free/remove any existing streaminfos in this category */ | |
40 while (streaminfo_get_count(category) > 0) | |
41 streaminfo_remove(category, streaminfo_get_by_index(category, 0)); | |
42 | |
43 int i; | |
44 /* find bookmarks that match this category */ | |
45 for (i = 0; i < bookmarks_count; i++) | |
46 if (strcmp(bookmarks[i].streamdir_name, streamdir->name) == 0 && | |
47 strcmp(bookmarks[i].category_name, category->name) == 0) { | |
48 | |
49 debug("bookmarks: adding stream info for '%s/%d'\n", streamdir->name, category->name); | |
50 | |
51 streaminfo_t *streaminfo = streaminfo_new(bookmarks[i].name, bookmarks[i].playlist_url, bookmarks[i].url, ""); | |
52 streaminfo_add(category, streaminfo); | |
53 | |
54 debug("bookmarks: stream info added\n"); | |
55 } | |
56 | |
57 return TRUE; | |
58 } | |
59 | |
60 streamdir_t* bookmarks_streamdir_fetch(bookmark_t *bms, int count) | |
61 { | |
62 bookmarks = bms; | |
63 bookmarks_count = count; | |
64 | |
65 streamdir_t *streamdir = streamdir_new(BOOKMARKS_NAME); | |
66 | |
67 debug("bookmarks: creating streaming directory for bookmarks\n"); | |
68 | |
69 category_t *category = category_new("Shoutcast"); | |
70 category_add(streamdir, category); | |
71 | |
72 category = category_new("Xiph"); | |
73 category_add(streamdir, category); | |
74 | |
75 debug("bookmarks: streaming directory successfuly created\n"); | |
76 | |
77 return streamdir; | |
78 } | |
79 |