Mercurial > audlegacy-plugins
changeset 2850:587b3657990d
xiph now updates the streams as well; i am aware of gui crashing when adding xiph streams, but tomorrow is another lovely day
author | Calin Crisan ccrisan@gmail.com |
---|---|
date | Tue, 29 Jul 2008 00:20:31 +0300 |
parents | 3ba1579e37a5 |
children | 7a000caead28 |
files | src/streambrowser/gui/streambrowser_win.c src/streambrowser/streambrowser.c src/streambrowser/xiph.c src/streambrowser/xiph.h |
diffstat | 4 files changed, 33 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/streambrowser/gui/streambrowser_win.c Mon Jul 28 23:44:00 2008 +0300 +++ b/src/streambrowser/gui/streambrowser_win.c Tue Jul 29 00:20:31 2008 +0300 @@ -420,9 +420,9 @@ } /* single click triggers a refresh of the selected item */ else { + // todo: separate single from double click somehow tree_view_button_pressed = TRUE; - } - + } return FALSE; }
--- a/src/streambrowser/streambrowser.c Mon Jul 28 23:44:00 2008 +0300 +++ b/src/streambrowser/streambrowser.c Tue Jul 29 00:20:31 2008 +0300 @@ -366,12 +366,11 @@ else { /* shoutcast */ if (strncmp(data->streamdir->name, SHOUTCAST_NAME, strlen(SHOUTCAST_NAME)) == 0) { - printf("DAAAA!\n"); shoutcast_streaminfo_fetch(data->category, data->streaminfo); } /* xiph */ else if (strncmp(data->streamdir->name, XIPH_NAME, strlen(XIPH_NAME)) == 0) { - //xiph_category_fetch(data->category); + xiph_streaminfo_fetch(data->category, data->streaminfo); } } @@ -476,7 +475,7 @@ } if (strlen(streaminfo->url) > 0) { - aud_playlist_add(aud_playlist_get_active(), streaminfo->url); + aud_playlist_add(aud_playlist_get_active(), streaminfo->url); debug("stream '%s' added\n", streaminfo->url); } }
--- a/src/streambrowser/xiph.c Mon Jul 28 23:44:00 2008 +0300 +++ b/src/streambrowser/xiph.c Tue Jul 29 00:20:31 2008 +0300 @@ -28,10 +28,12 @@ typedef struct { + gchar name[DEF_STRING_LEN]; gchar url[DEF_STRING_LEN]; gchar current_song[DEF_STRING_LEN]; gchar genre[DEF_STRING_LEN]; + } xiph_entry_t; @@ -39,8 +41,10 @@ static int xiph_entry_count = 0; typedef struct { + gchar *name; gchar *match_string; + } xiph_category_t; /* inspired from streamtuner's xiph plugin */ @@ -62,14 +66,34 @@ }; -// todo: call refresh_streamdir() more often to refresh the current track static void refresh_streamdir(); /* returns true if any of the words in string1 is present in string2 */ static gboolean genre_match(gchar *string1, gchar *string2); +gboolean xiph_streaminfo_fetch(category_t *category, streaminfo_t *streaminfo) +{ + int entryno; + + refresh_streamdir(); + + /* find the corresponding xiph entry */ + for (entryno = 0; entryno < xiph_entry_count; entryno++) { + if (strcmp(xiph_entries[entryno].name, streaminfo->name) == 0) { + strcpy(streaminfo->name, xiph_entries[entryno].name); + strcpy(streaminfo->url, xiph_entries[entryno].url); + strcpy(streaminfo->current_track, xiph_entries[entryno].current_song); + + break; + } + } + + return TRUE; +} gboolean xiph_category_fetch(category_t *category) { + refresh_streamdir(); + int entryno, categoryno; int xiph_category_count = sizeof(xiph_categories) / sizeof(xiph_category_t); xiph_category_t *xiph_category = NULL; @@ -139,8 +163,10 @@ static void refresh_streamdir() { /* free any previously fetched streamdir data */ - if (xiph_entries != NULL) + if (xiph_entries != NULL) { free(xiph_entries); + xiph_entries = NULL; + } xiph_entry_count = 0; debug("xiph: fetching streaming directory file '%s'\n", XIPH_STREAMDIR_URL);
--- a/src/streambrowser/xiph.h Mon Jul 28 23:44:00 2008 +0300 +++ b/src/streambrowser/xiph.h Tue Jul 29 00:20:31 2008 +0300 @@ -29,6 +29,7 @@ #define XIPH_TEMP_FILENAME "file:///tmp/xiph_yp.xml" +gboolean xiph_streaminfo_fetch(category_t *category, streaminfo_t *streaminfo); gboolean xiph_category_fetch(category_t *category); streamdir_t* xiph_streamdir_fetch();