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



Author: hadess
Date: Sat Feb 23 16:32:48 2008
New Revision: 56
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=56&view=rev

Log:
2008-02-23  Bastien Nocera  <hadess hadess net>

	* plparse/test-parser.c (test_duration): Add test for the duration
	being passed as a "float" (minutes.seconds), as used in
	http://www.stephenfry.com/podcasts/rss.xml
	* plparse/totem-pl-parser.c (totem_pl_parser_parse_internal),
	(totem_pl_parser_parse_duration): Fix test above, fix crash
	when my_gnome_vfs_get_mime_type_with_data returns a NULL mime-type
	(Closes: #518242)



Modified:
   trunk/ChangeLog
   trunk/plparse/test-parser.c
   trunk/plparse/totem-pl-parser.c

Modified: trunk/plparse/test-parser.c
==============================================================================
--- trunk/plparse/test-parser.c	(original)
+++ trunk/plparse/test-parser.c	Sat Feb 23 16:32:48 2008
@@ -146,6 +146,7 @@
 	test_duration_real ("00:00:00.01", 1);
 	test_duration_real ("01:00:01.01", 3601);
 	test_duration_real ("01:00.01", 60);
+	test_duration_real ("24.59", 1499);
 }
 
 #define DATE_BUFSIZE 512

Modified: trunk/plparse/totem-pl-parser.c
==============================================================================
--- trunk/plparse/totem-pl-parser.c	(original)
+++ trunk/plparse/totem-pl-parser.c	Sat Feb 23 16:32:48 2008
@@ -1578,7 +1578,7 @@
 					g_free (mimetype);
 					mimetype = my_gnome_vfs_get_mime_type_with_data (url, &data, parser);
 					/* If it's _still_ a text/plain, we don't want it */
-					if (strcmp (mimetype, "text/plain") == 0) {
+					if (mimetype == NULL || strcmp (mimetype, "text/plain") == 0) {
 						g_free (mimetype);
 						mimetype = NULL;
 						break;
@@ -1748,6 +1748,10 @@
 		D(g_print ("Used 00:00 format\n"));
 		return minutes * 60 + seconds;
 	}
+	if (sscanf (duration, "%d.%d", &minutes, &seconds) == 2) {
+		D(g_print ("Used broken float format (00.00)\n"));
+		return minutes * 60 + seconds;
+	}
 	/* PLS files format */
 	if (sscanf (duration, "%d", &seconds) == 1) {
 		D(g_print ("Used PLS format\n"));



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