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



Author: hadess
Date: Wed Aug 27 09:46:39 2008
New Revision: 181
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=181&view=rev

Log:
2008-08-27  Bastien Nocera  <hadess hadess net>

	* plparse/totem-pl-parser-podcast.c (totem_pl_parser_add_itpc),
	(totem_pl_parser_add_zune):
	* plparse/totem-pl-parser-podcast.h:
	* plparse/totem-pl-parser.c (totem_pl_parser_parse_internal):
	Add support for zune:// and zcast:// URLs (Closes: #549032)



Modified:
   trunk/ChangeLog
   trunk/plparse/totem-pl-parser-podcast.c
   trunk/plparse/totem-pl-parser-podcast.h
   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	Wed Aug 27 09:46:39 2008
@@ -284,11 +284,15 @@
 			  gpointer data)
 {
 	TotemPlParserResult ret;
-	char *new_url;
+	char *url, *new_url, *uri_scheme;
 	GFile *new_file;
 
-	new_url = g_file_get_uri (file);
-	memcpy (new_url, "http", 4);
+	url = g_file_get_uri (file);
+	uri_scheme = g_file_get_uri_scheme (file);
+	new_url = g_strdup_printf ("http%s", url + strlen (uri_scheme));
+	g_free (url);
+	g_free (uri_scheme);
+
 	new_file = g_file_new_for_uri (new_url);
 	g_free (new_url);
 
@@ -299,6 +303,40 @@
 	return ret;
 }
 
+TotemPlParserResult
+totem_pl_parser_add_zune (TotemPlParser *parser,
+			  GFile *file,
+			  GFile *base_file,
+			  gpointer data)
+{
+	TotemPlParserResult ret;
+	char *url, *new_url;
+	GFile *new_file;
+
+	url = g_file_get_uri (file);
+	if (g_str_has_prefix (url, "zune://subscribe/?") == FALSE) {
+		g_free (url);
+		return TOTEM_PL_PARSER_RESULT_UNHANDLED;
+	}
+
+	new_url = strchr (url + strlen ("zune://subscribe/?"), '=');
+	if (new_url == NULL) {
+		g_free (url);
+		return TOTEM_PL_PARSER_RESULT_UNHANDLED;
+	}
+	/* Skip over the '=' */
+	new_url++;
+
+	new_file = g_file_new_for_uri (new_url);
+	g_free (url);
+
+	ret = totem_pl_parser_add_rss (parser, new_file, base_file, data);
+
+	g_object_unref (new_file);
+
+	return ret;
+}
+
 /* Atom docs:
  * http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.4.1
  * http://tools.ietf.org/html/rfc4287

Modified: trunk/plparse/totem-pl-parser-podcast.h
==============================================================================
--- trunk/plparse/totem-pl-parser-podcast.h	(original)
+++ trunk/plparse/totem-pl-parser-podcast.h	Wed Aug 27 09:46:39 2008
@@ -55,6 +55,10 @@
 					      GFile *file,
 					      GFile *base_file,
 					      gpointer data);
+TotemPlParserResult totem_pl_parser_add_zune (TotemPlParser *parser,
+					      GFile *file,
+					      GFile *base_file,
+					      gpointer data);
 TotemPlParserResult totem_pl_parser_add_itms (TotemPlParser *parser,
 					      GFile *file,
 					      GFile *base_file,

Modified: trunk/plparse/totem-pl-parser.c
==============================================================================
--- trunk/plparse/totem-pl-parser.c	(original)
+++ trunk/plparse/totem-pl-parser.c	Wed Aug 27 09:46:39 2008
@@ -1422,11 +1422,18 @@
 	}
 
 	/* Fix up itpc, see http://www.apple.com/itunes/store/podcaststechspecs.html,
-	 * as well as feed:// as used by Firefox 3 */
-	if (g_file_has_uri_scheme (file, "itpc") != FALSE || g_file_has_uri_scheme (file, "feed") != FALSE) {
-		DEBUG(file, g_print ("URL '%s' is getting special cased for ITPC/FEED parsing\n", uri));
+	 * feed:// as used by Firefox 3,
+	 * as well as zcast:// as used by ZENCast */
+	if (g_file_has_uri_scheme (file, "itpc") != FALSE
+	    || g_file_has_uri_scheme (file, "feed") != FALSE
+	    || g_file_has_uri_scheme (file, "zcast") != FALSE) {
+		DEBUG(file, g_print ("URL '%s' is getting special cased for ITPC/FEED/ZCAST parsing\n", uri));
 		return totem_pl_parser_add_itpc (parser, file, base_file, NULL);
 	}
+	if (g_file_has_uri_scheme (file, "zune") != FALSE) {
+		DEBUG(file, g_print ("URL '%s' is getting special cased for ZUNE parsing\n", uri));
+		return totem_pl_parser_add_zune (parser, file, base_file, NULL);
+	}
 	/* Try itms Podcast references, see itunes.py in PenguinTV */
 	if (totem_pl_parser_is_itms_feed (file) != FALSE) {
 	    	DEBUG(file, g_print ("URL '%s' is getting special cased for ITMS parsing\n", uri));



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