changeset 653:97113126c7f9 trunk

[svn] - Fix mp3 detection properly. - Generate thumbnails for nextgen skins as well as WA2.x ones.
author nenolod
date Sun, 19 Feb 2006 18:20:51 -0800
parents 02abf3d76832
children 6c14adb859fe
files Plugins/Input/mpg123/mpg123.c audacious/skin.c audacious/skinwin.c
diffstat 3 files changed, 26 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/mpg123/mpg123.c	Sun Feb 19 18:05:14 2006 -0800
+++ b/Plugins/Input/mpg123/mpg123.c	Sun Feb 19 18:20:51 2006 -0800
@@ -366,11 +366,14 @@
 static int
 is_our_file(char *filename)
 {
-    if (!strncasecmp(filename, "http://", 7)) { 
+    gchar *ext = strrchr(filename, '.');
+
+    if (!strncasecmp(filename, "http://", 7))
 	return mpg123_detect_by_content_stream(filename);
-    }
-    else
+    else if (strncasecmp(ext, ".mp3", 7))	/* If extension ends in .mp3, let it be --nenolod */
         return (mpg123_detect_by_content(filename));
+
+    return TRUE;	/* Why? The file ends in .mp3. Lalala. */
 }
 
 static void
--- a/audacious/skin.c	Sun Feb 19 18:05:14 2006 -0800
+++ b/audacious/skin.c	Sun Feb 19 18:20:51 2006 -0800
@@ -45,7 +45,7 @@
 
 #define EXTENSION_TARGETS 7
 
-gchar *ext_targets[EXTENSION_TARGETS] = { "bmp", "xpm", "png", "svg", 
+static gchar *ext_targets[EXTENSION_TARGETS] = { "bmp", "xpm", "png", "svg", 
 	"gif", "jpg", "jpeg" };
 
 struct _SkinPixmapIdMapping {
--- a/audacious/skinwin.c	Sun Feb 19 18:05:14 2006 -0800
+++ b/audacious/skinwin.c	Sun Feb 19 18:20:51 2006 -0800
@@ -39,6 +39,10 @@
 
 #include <gdk/gdkx.h>
 
+#define EXTENSION_TARGETS 7
+
+static gchar *ext_targets[EXTENSION_TARGETS] = { "bmp", "xpm", "png", "svg",
+        "gif", "jpg", "jpeg" };
 
 #define THUMBNAIL_WIDTH  90
 #define THUMBNAIL_HEIGHT 40
@@ -82,20 +86,31 @@
     GdkPixbuf *preview = NULL;
     gchar *dec_path, *preview_path;
     gboolean is_archive = FALSE;
+    gint i = 0;
+    gchar buf[60];			/* gives us lots of room */
 
-    if (file_is_archive(path)) {
+    if (file_is_archive(path))
+    {
         if (!(dec_path = archive_decompress(path)))
             return NULL;
 
         is_archive = TRUE;
     }
-    else {
+    else
+    {
         dec_path = g_strdup(path);
     }
 
-    preview_path = find_file_recursively(dec_path, "main.bmp");
+    for (i = 0; i < EXTENSION_TARGETS; i++)
+    {
+        sprintf(buf, "main.%s", ext_targets[i]);
 
-    if (preview_path) {
+        if ((preview_path = find_file_recursively(dec_path, "main.bmp")) != NULL)
+            break;
+    }
+
+    if (preview_path)
+    {
         preview = gdk_pixbuf_new_from_file(preview_path, NULL);
         g_free(preview_path);
     }