# HG changeset patch # User nenolod # Date 1150343387 25200 # Node ID 502b369314c17ab65b91bc999ce316c7530e8102 # Parent a5d5f404b933bdf1ae71b7ec994424ddca0fea05 [svn] - InputPlugin class: + get_song_tuple(gchar *filename); + set_song_tuple(TitleInput *tuple); - input_get_song_tuple() utility function to retrieve a songtuple/generic tuple diff -r a5d5f404b933 -r 502b369314c1 ChangeLog --- a/ChangeLog Wed Jun 14 19:03:23 2006 -0700 +++ b/ChangeLog Wed Jun 14 20:49:47 2006 -0700 @@ -1,3 +1,12 @@ +2006-06-15 02:03:23 +0000 William Pitcock + revision [1374] + - attach a TitleInput tuple to the PlaylistEntry class. + + + Changes: Modified: + +7 -1 trunk/audacious/playlist.h + + 2006-06-15 01:46:43 +0000 William Pitcock revision [1372] - Add TitleInput.length member. diff -r a5d5f404b933 -r 502b369314c1 audacious/input.c --- a/audacious/input.c Wed Jun 14 19:03:23 2006 -0700 +++ b/audacious/input.c Wed Jun 14 20:49:47 2006 -0700 @@ -491,6 +491,43 @@ g_free(filename_proxy); } +TitleInput * +input_get_song_tuple(const gchar * filename) +{ + InputPlugin *ip = NULL; + TitleInput *input; + GList *node; + gchar *tmp = NULL, *ext; + gchar *filename_proxy; + + if (filename == NULL) + return NULL; + + filename_proxy = g_strdup(filename); + + for (node = get_input_list(); node != NULL; node = g_list_next(node)) { + ip = INPUT_PLUGIN(node->data); + if (input_is_enabled(ip->filename) && ip->is_our_file(filename_proxy)) + break; + } + + if (ip && node && ip->get_song_tuple) + input = ip->get_song_tuple(filename_proxy); + else { + input = bmp_title_input_new(); + + tmp = g_strdup(filename); + if ((ext = strrchr(tmp, '.'))) + *ext = '\0'; + + input->file_name = g_path_get_basename(tmp); + input->file_ext = ext ? ext + 1 : NULL; + input->file_path = tmp; + } + + return input; +} + static void input_general_file_info_box(const gchar * filename, InputPlugin * ip) { diff -r a5d5f404b933 -r 502b369314c1 audacious/input.h --- a/audacious/input.h Wed Jun 14 19:03:23 2006 -0700 +++ b/audacious/input.h Wed Jun 14 20:49:47 2006 -0700 @@ -41,6 +41,7 @@ InputVisType input_get_vis_type(); void free_vis_data(void); InputPlugin *input_check_file(const gchar * filename, gboolean show_warning); +TitleInput *input_get_song_tuple(const gchar * filename); void input_play(gchar * filename); void input_stop(void); void input_pause(void); diff -r a5d5f404b933 -r 502b369314c1 audacious/plugin.h --- a/audacious/plugin.h Wed Jun 14 19:03:23 2006 -0700 +++ b/audacious/plugin.h Wed Jun 14 20:49:47 2006 -0700 @@ -32,7 +32,7 @@ #include - +#include "libaudacious/titlestring.h" #define INPUT_PLUGIN(x) ((InputPlugin *)(x)) #define OUTPUT_PLUGIN(x) ((OutputPlugin *)(x)) @@ -152,6 +152,9 @@ void (*file_info_box) (gchar * filename); OutputPlugin *output; + + TitleInput *(*get_song_tuple) (gchar * filename); + void (*set_song_tuple) (TitleInput * tuple); }; struct _GeneralPlugin {