totem-pl-parser r132 - in trunk: . plparse



Author: hadess
Date: Sat May 24 15:22:55 2008
New Revision: 132
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=132&view=rev

Log:
2008-05-24  Bastien Nocera  <hadess hadess net>

	* plparse/totem-pl-parser-private.h:
	* plparse/totem-pl-parser-smil.c (parse_smil_entry):
	* plparse/totem-pl-parser-wm.c (parse_asx_entry),
	(parse_asx_entryref):
	* plparse/totem-pl-parser-xspf.c (parse_xspf_track):
	Don't try to resolve absolute URIs

	* plparse/totem-pl-parser.c
	(my_g_file_info_get_mime_type_with_data),
	(totem_pl_parser_parse_internal): Revert code for the
	block device detection, the GIO code wasn't working as expected (there
	doesn't seem to be a way to detect whether a file is a block device
	using GIO)
	Also make sure we pass a base_file to parsing function, based on the
	URL to parse, if we weren't provided one

	* plparse/totem-pl-parser-podcast.c (totem_pl_parser_is_itms_feed):
	Fix bad detection of the itms URI scheme



Modified:
   trunk/ChangeLog
   trunk/plparse/totem-pl-parser-podcast.c
   trunk/plparse/totem-pl-parser-private.h
   trunk/plparse/totem-pl-parser-smil.c
   trunk/plparse/totem-pl-parser-wm.c
   trunk/plparse/totem-pl-parser-xspf.c
   trunk/plparse/totem-pl-parser.c

Modified: trunk/plparse/totem-pl-parser-podcast.c
==============================================================================
--- trunk/plparse/totem-pl-parser-podcast.c	(original)
+++ trunk/plparse/totem-pl-parser-podcast.c	Sat May 24 15:22:55 2008
@@ -717,7 +717,7 @@
 
 	url = g_file_get_uri (file);
 
-	if (g_file_has_uri_scheme (file, "itms:") != FALSE
+	if (g_file_has_uri_scheme (file, "itms") != FALSE
 	    && strstr (url, "phobos.apple.com") != NULL
 	    && strstr (url, "viewPodcast") != NULL) {
 	    	g_free (url);

Modified: trunk/plparse/totem-pl-parser-private.h
==============================================================================
--- trunk/plparse/totem-pl-parser-private.h	(original)
+++ trunk/plparse/totem-pl-parser-private.h	Sat May 24 15:22:55 2008
@@ -31,6 +31,7 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 #include <gio/gio.h>
+#include <string.h>
 #else
 #include "totem-pl-parser-mini.h"
 #endif /* !TOTEM_PL_PARSER_MINI */

Modified: trunk/plparse/totem-pl-parser-smil.c
==============================================================================
--- trunk/plparse/totem-pl-parser-smil.c	(original)
+++ trunk/plparse/totem-pl-parser-smil.c	Sat May 24 15:22:55 2008
@@ -73,7 +73,7 @@
 			if (url != NULL) {
 				GFile *resolved;
 
-				if (base_file != NULL)
+				if (base_file != NULL && strstr (url, "://") == NULL)
 					resolved = g_file_resolve_relative_path (base_file, url);
 				else
 					resolved = g_file_new_for_uri (url);

Modified: trunk/plparse/totem-pl-parser-wm.c
==============================================================================
--- trunk/plparse/totem-pl-parser-wm.c	(original)
+++ trunk/plparse/totem-pl-parser-wm.c	Sat May 24 15:22:55 2008
@@ -260,7 +260,7 @@
 		return TOTEM_PL_PARSER_RESULT_ERROR;
 
 
-	if (base_file != NULL)
+	if (base_file != NULL && strstr (url, "://") == NULL)
 		resolved = g_file_resolve_relative_path (base_file, url);
 	else
 		resolved = g_file_new_for_uri (url);
@@ -298,7 +298,7 @@
 	if (url == NULL)
 		return TOTEM_PL_PARSER_RESULT_ERROR;
 
-	if (base_file != NULL)
+	if (base_file != NULL && strstr (url, "://") == NULL)
 		resolved = g_file_resolve_relative_path (base_file, url);
 	else
 		resolved = g_file_new_for_uri (url);

Modified: trunk/plparse/totem-pl-parser-xspf.c
==============================================================================
--- trunk/plparse/totem-pl-parser-xspf.c	(original)
+++ trunk/plparse/totem-pl-parser-xspf.c	Sat May 24 15:22:55 2008
@@ -214,7 +214,7 @@
 		goto bail;
 	}
 
-	if (base_file != NULL)
+	if (base_file != NULL && strstr (url, "://") == NULL)
 		resolved = g_file_resolve_relative_path (base_file, (const char *) url);
 	else
 		resolved = g_file_new_for_uri ((const char *) url);

Modified: trunk/plparse/totem-pl-parser.c
==============================================================================
--- trunk/plparse/totem-pl-parser.c	(original)
+++ trunk/plparse/totem-pl-parser.c	Sat May 24 15:22:55 2008
@@ -639,16 +639,16 @@
 
 	/* Stat for a block device, we're screwed as far as speed
 	 * is concerned now */
-	if (g_file_has_uri_scheme (file, "file") != FALSE) {
-		GFileInfo *info;
-		info = g_file_query_info (file, G_FILE_ATTRIBUTE_UNIX_DEVICE,
-					  G_FILE_QUERY_INFO_NONE, NULL, NULL);
-		if (info != NULL && g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_DEVICE)) {
-			g_object_unref (info);
+	if (g_file_is_native (file) != FALSE) {
+		struct stat buf;
+		char *path;
+
+		path = g_file_get_path (file);
+		if (stat (path, &buf) == 0 && S_ISBLK (buf.st_mode)) {
+			g_free (path);
 			return g_strdup (BLOCK_DEVICE_TYPE);
 		}
-		if (info != NULL)
-			g_object_unref (info);
+		g_free (path);
 	}
 
 	/* Open the file. */
@@ -1477,7 +1477,14 @@
 					g_free (data);
 					return TOTEM_PL_PARSER_RESULT_IGNORED;
 				}
-				ret = (* special_types[i].func) (parser, file, base_file ? base_file : file, data);
+				if (base_file == NULL)
+					base_file = g_file_get_parent (file);
+				else
+					base_file = g_object_ref (base_file);
+
+				ret = (* special_types[i].func) (parser, file, base_file, data);
+
+				g_object_unref (base_file);
 
 				found = TRUE;
 				break;
@@ -1497,7 +1504,15 @@
 						break;
 					}
 				}
+				if (base_file == NULL)
+					base_file = g_file_get_parent (file);
+				else
+					base_file = g_object_ref (base_file);
+
 				ret = (* dual_types[i].func) (parser, file, base_file ? base_file : file, data);
+
+				g_object_unref (base_file);
+
 				found = TRUE;
 				break;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]