Mercurial > audlegacy
changeset 1413:878c7f8d0a8c trunk
[svn] - filepopup albumart stuff, via hansmi
author | nenolod |
---|---|
date | Sun, 16 Jul 2006 08:14:08 -0700 |
parents | c6ac6c61a6fd |
children | ff637a82e85f |
files | ChangeLog audacious/glade/prefswin.glade audacious/main.c audacious/main.h audacious/prefswin.c audacious/ui_fileinfo.c |
diffstat | 6 files changed, 409 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Jul 15 17:27:49 2006 -0700 +++ b/ChangeLog Sun Jul 16 08:14:08 2006 -0700 @@ -1,3 +1,12 @@ +2006-07-16 00:27:49 +0000 William Pitcock <nenolod@nenolod.net> + revision [1738] + - i think this works + + + Changes: Modified: + +1 -1 trunk/Plugins/Input/wma/libffwma/Makefile.in + + 2006-07-16 00:03:07 +0000 Tony Vroon <chainsaw@gentoo.org> revision [1736] Bolt on libmms versions of byteswap macros and bring yet more files in (mmsh.c & mms.h).
--- a/audacious/glade/prefswin.glade Sat Jul 15 17:27:49 2006 -0700 +++ b/audacious/glade/prefswin.glade Sun Jul 16 08:14:08 2006 -0700 @@ -2351,19 +2351,72 @@ <property name="right_padding">0</property> <child> - <widget class="GtkCheckButton" id="checkbutton10"> + <widget class="GtkHBox" id="hbox9"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Toggles popup information window for the pointed entry in the playlist. The window shows title of song, name of album, genre, year of publish, track number, track length, and artwork.</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Show popup information for playlist entries</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="realize" handler="on_show_filepopup_for_tuple_realize" after="yes" last_modification_time="Thu, 29 Jun 2006 08:45:52 GMT"/> - <signal name="toggled" handler="on_show_filepopup_for_tuple_toggled" last_modification_time="Thu, 29 Jun 2006 08:46:11 GMT"/> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkVBox" id="vbox34"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkCheckButton" id="checkbutton10"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Toggles popup information window for the pointed entry in the playlist. The window shows title of song, name of album, genre, year of publish, track number, track length, and artwork.</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Show popup information for playlist entries</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="realize" handler="on_show_filepopup_for_tuple_realize" after="yes" last_modification_time="Thu, 29 Jun 2006 08:45:52 GMT"/> + <signal name="toggled" handler="on_show_filepopup_for_tuple_toggled" last_modification_time="Thu, 29 Jun 2006 08:46:11 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="filepopup_for_tuple_settings_button"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Edit settings for popup information</property> + <property name="relief">GTK_RELIEF_HALF</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_filepopup_for_tuple_settings_clicked" last_modification_time="Fri, 14 Jul 2006 23:49:34 GMT"/> + + <child> + <widget class="GtkImage" id="image8"> + <property name="visible">True</property> + <property name="stock">gtk-properties</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> </widget> </child> </widget> @@ -4115,4 +4168,208 @@ </child> </widget> +<widget class="GtkWindow" id="filepopup_for_tuple_settings"> + <property name="border_width">12</property> + <property name="title" translatable="yes">Popup Information Settings</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">True</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + <signal name="delete_event" handler="gtk_widget_hide_on_delete" last_modification_time="Sat, 15 Jul 2006 15:29:02 GMT"/> + + <child> + <widget class="GtkVBox" id="vbox35"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkLabel" id="label85"> + <property name="visible">True</property> + <property name="label" translatable="yes">While searching for the album's cover, Audacious looks for certain words in the filename. You can specify those words in the lists below, separated using commas.</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkTable" id="table12"> + <property name="visible">True</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">4</property> + <property name="column_spacing">4</property> + + <child> + <widget class="GtkEntry" id="filepopup_settings_cover_name_exclude"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label87"> + <property name="visible">True</property> + <property name="label" translatable="yes">Include:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label88"> + <property name="visible">True</property> + <property name="label" translatable="yes">Exclude:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="filepopup_settings_cover_name_include"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">True</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHButtonBox" id="hbuttonbox10"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkButton" id="filepopup_settings_cancel"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_filepopup_settings_cancel_clicked" last_modification_time="Sun, 16 Jul 2006 12:46:13 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkButton" id="filepopup_settings_ok"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_filepopup_settings_ok_clicked" last_modification_time="Sat, 15 Jul 2006 15:31:39 GMT"/> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> +</widget> + </glade-interface>
--- a/audacious/main.c Sat Jul 15 17:27:49 2006 -0700 +++ b/audacious/main.c Sun Jul 16 08:14:08 2006 -0700 @@ -203,6 +203,8 @@ 3000, /* audio buffer size */ FALSE, /* whether or not to postpone format detection on initial add */ TRUE, /* show filepopup for tuple */ + NULL, /* words identifying covers */ + NULL, /* words that might not show up in cover names */ }; typedef struct bmp_cfg_boolent_t { @@ -345,6 +347,8 @@ {"generic_title_format", &cfg.gentitle_format, TRUE}, {"chardet_detector", &cfg.chardet_detector, TRUE}, {"chardet_fallback", &cfg.chardet_fallback, TRUE}, + {"cover_name_include", &cfg.cover_name_include, TRUE}, + {"cover_name_exclude", &cfg.cover_name_exclude, TRUE}, }; static gint ncfgsent = G_N_ELEMENTS(bmp_strents); @@ -552,6 +556,12 @@ if (!cfg.eqpreset_extension) cfg.eqpreset_extension = g_strdup(EQUALIZER_DEFAULT_PRESET_EXT); + + if (!cfg.cover_name_include) + cfg.cover_name_include = g_strdup(""); + + if (!cfg.cover_name_exclude) + cfg.cover_name_exclude = g_strdup("back"); }
--- a/audacious/main.h Sat Jul 15 17:27:49 2006 -0700 +++ b/audacious/main.h Sun Jul 16 08:14:08 2006 -0700 @@ -112,6 +112,7 @@ gint output_buffer_size; gboolean playlist_detect; gboolean show_filepopup_for_tuple; + gchar *cover_name_include, *cover_name_exclude; }; typedef struct _BmpConfig BmpConfig;
--- a/audacious/prefswin.c Sat Jul 15 17:27:49 2006 -0700 +++ b/audacious/prefswin.c Sun Jul 16 08:14:08 2006 -0700 @@ -90,6 +90,7 @@ TitleFieldTag; static GtkWidget *prefswin = NULL; +static GtkWidget *filepopup_settings = NULL; static GtkWidget *category_treeview = NULL; static GtkWidget *category_notebook = NULL; GtkWidget *filepopupbutton = NULL; @@ -2012,14 +2013,63 @@ static void on_show_filepopup_for_tuple_realize(GtkToggleButton * button, gpointer data) { + GladeXML *xml = prefswin_get_xml(); + GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); + gtk_toggle_button_set_active(button, cfg.show_filepopup_for_tuple); filepopupbutton = (GtkWidget *)button; + + gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); } static void on_show_filepopup_for_tuple_toggled(GtkToggleButton * button, gpointer data) { + GladeXML *xml = prefswin_get_xml(); + GtkWidget *settings_button = glade_xml_get_widget(xml, "filepopup_for_tuple_settings_button"); + cfg.show_filepopup_for_tuple = gtk_toggle_button_get_active(button); + + gtk_widget_set_sensitive(settings_button, cfg.show_filepopup_for_tuple); +} + +static void +on_filepopup_for_tuple_settings_clicked(GtkButton *button, gpointer data) +{ + GladeXML *xml = prefswin_get_xml(); + GtkEntry *cover_name_include = + (GtkEntry*)glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); + GtkEntry *cover_name_exclude = + (GtkEntry*)glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); + + gtk_entry_set_text(cover_name_include, cfg.cover_name_include); + gtk_entry_set_text(cover_name_exclude, cfg.cover_name_exclude); + + gtk_widget_show(filepopup_settings); +} + +static void +on_filepopup_settings_ok_clicked(GtkButton *button, gpointer data) +{ + GladeXML *xml = prefswin_get_xml(); + GtkEntry *cover_name_include = + (GtkEntry*)glade_xml_get_widget(xml, "filepopup_settings_cover_name_include"); + GtkEntry *cover_name_exclude = + (GtkEntry*)glade_xml_get_widget(xml, "filepopup_settings_cover_name_exclude"); + + g_free(cfg.cover_name_include); + cfg.cover_name_include = g_strdup(gtk_entry_get_text(cover_name_include)); + + g_free(cfg.cover_name_exclude); + cfg.cover_name_exclude = g_strdup(gtk_entry_get_text(cover_name_exclude)); + + gtk_widget_hide(filepopup_settings); +} + +static void +on_filepopup_settings_cancel_clicked(GtkButton *button, gpointer data) +{ + gtk_widget_hide(filepopup_settings); } /* FIXME: complete the map */ @@ -2094,8 +2144,13 @@ FUNC_MAP_ENTRY(on_audio_format_det_cb_realize) FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_realize) FUNC_MAP_ENTRY(on_show_filepopup_for_tuple_toggled) + FUNC_MAP_ENTRY(on_filepopup_for_tuple_settings_clicked) FUNC_MAP_ENTRY(on_continue_playback_on_startup_realize) FUNC_MAP_ENTRY(on_continue_playback_on_startup_toggled) + + /* Filepopup settings */ + FUNC_MAP_ENTRY(on_filepopup_settings_ok_clicked) + FUNC_MAP_ENTRY(on_filepopup_settings_cancel_clicked) FUNC_MAP_END void @@ -2319,6 +2374,10 @@ gtk_label_set_markup( GTK_LABEL(widget) , aud_version_string->str ); g_string_free( aud_version_string , TRUE ); + + /* Create window for filepopup settings */ + filepopup_settings = glade_xml_get_widget(xml, "filepopup_for_tuple_settings"); + gtk_window_set_transient_for(GTK_WINDOW(filepopup_settings), GTK_WINDOW(prefswin)); } void
--- a/audacious/ui_fileinfo.c Sat Jul 15 17:27:49 2006 -0700 +++ b/audacious/ui_fileinfo.c Sun Jul 16 08:14:08 2006 -0700 @@ -342,6 +342,62 @@ gtk_widget_show(fileinfo_win); } +static gboolean +cover_name_filter(const gchar *name, const gchar *filter, const gboolean ret_on_empty) +{ + gboolean result = FALSE; + gchar **splitted; + gchar *current; + gchar *lname; + gint i; + + if (!filter || strlen(filter) == 0) { + return ret_on_empty; + } + + splitted = g_strsplit(filter, ",", 0); + + lname = g_strdup(name); + g_strdown(lname); + + for (i = 0; !result && (current = splitted[i]); i++) { + gchar *stripped = g_strstrip(g_strdup(current)); + g_strdown(stripped); + + result = result || strstr(lname, stripped); + + g_free(stripped); + } + + g_free(lname); + g_strfreev(splitted); + + return result; +} + +/* Check wether it's an image we want */ +static gboolean +is_front_cover_image(const gchar *name) +{ + char *ext; + + ext = strrchr(name, '.'); + if (!ext) { + /* No file extension */ + return FALSE; + } + + if (g_strcasecmp(ext, ".jpg") != 0 && + g_strcasecmp(ext, ".jpeg") != 0 && + g_strcasecmp(ext, ".png") != 0) { + /* No recognized file extension */ + return FALSE; + } + + return cover_name_filter(name, cfg.cover_name_include, TRUE) && + !cover_name_filter(name, cfg.cover_name_exclude, FALSE); +} + gchar* fileinfo_recursive_get_image(const gchar* path, gint depth) { @@ -359,11 +415,12 @@ while (f) { gchar *newpath = g_strdup_printf("%s/%s", path, f); - - /* ok. why did I not have strcasestr, thought glib had that one */ - if ((strstr(f,".jpg") || strstr(f,".jpeg") || strstr(f,".png") || strstr(f,".JPG") || strstr(f,".JPEG") || strstr(f,".PNG")) && !strstr(f,"back") && !strstr(f,"Back") && !strstr(f,"BACK")) + + if (is_front_cover_image(f)) { - /* We found a suitable file in the current directory, use that. The string will be freed by the caller */ + /* We found a suitable file in the current + * directory, use that. The string will be + * freed by the caller */ return newpath; } else