totem-pl-parser r164 - in trunk: . plparse
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem-pl-parser r164 - in trunk: . plparse
- Date: Thu, 14 Aug 2008 14:05:00 +0000 (UTC)
Author: hadess
Date: Thu Aug 14 14:05:00 2008
New Revision: 164
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=164&view=rev
Log:
2008-08-14 Bastien Nocera <hadess hadess net>
* plparse/totem-pl-parser.c (totem_pl_parser_cleanup_xml),
(totem_pl_parser_parse_internal),
(totem_pl_parser_mime_type_from_data): When we get an XML file,
try to use our own indentification functions as well, to double-check
whether we have a podcast or not
* plparse/totem-pl-parser-private.h:
Add totem_pl_parser_cleanup_xml() to remove HTML comments without
spaces before the closing statement
* plparse/totem-pl-parser-podcast.c (totem_pl_parser_add_rss):
Use totem_pl_parser_cleanup_xml(), fixes parsing of podcasts at
http://www.chyz.qc.ca/ (Closes: #541405)
* plparse/totem-pl-parser-xspf.c (totem_pl_parser_write_xspf),
(parse_xspf_track): Fix some warnings
Modified:
trunk/ChangeLog
trunk/plparse/totem-pl-parser-podcast.c
trunk/plparse/totem-pl-parser-private.h
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 Thu Aug 14 14:05:00 2008
@@ -246,6 +246,7 @@
if (g_file_load_contents (file, NULL, &contents, &size, NULL, NULL) == FALSE)
return TOTEM_PL_PARSER_RESULT_ERROR;
+ totem_pl_parser_cleanup_xml (contents);
xml_parser_init (contents, size, XML_PARSER_CASE_INSENSITIVE);
if (xml_parser_build_tree_with_options (&doc, XML_PARSER_RELAXED | XML_PARSER_MULTI_TEXT) < 0) {
g_free (contents);
Modified: trunk/plparse/totem-pl-parser-private.h
==============================================================================
--- trunk/plparse/totem-pl-parser-private.h (original)
+++ trunk/plparse/totem-pl-parser-private.h Thu Aug 14 14:05:00 2008
@@ -122,7 +122,9 @@
void totem_pl_parser_add_url (TotemPlParser *parser,
const char *first_property_name,
...);
-gboolean totem_pl_parser_ignore (TotemPlParser *parser, const char *url);
+gboolean totem_pl_parser_ignore (TotemPlParser *parser,
+ const char *url);
+void totem_pl_parser_cleanup_xml (char *string);
#endif /* !TOTEM_PL_PARSER_MINI */
Modified: trunk/plparse/totem-pl-parser-xspf.c
==============================================================================
--- trunk/plparse/totem-pl-parser-xspf.c (original)
+++ trunk/plparse/totem-pl-parser-xspf.c Thu Aug 14 14:05:00 2008
@@ -111,7 +111,7 @@
func (model, &iter, &url, &title, &custom_title, user_data);
file = g_file_new_for_uri (url);
- if (totem_pl_parser_scheme_is_ignored (parser, url) != FALSE) {
+ if (totem_pl_parser_scheme_is_ignored (parser, file) != FALSE) {
g_object_unref (file);
g_free (url);
g_free (title);
@@ -217,7 +217,7 @@
goto bail;
}
- if (base_file != NULL && strstr (url, "://") == NULL)
+ if (base_file != NULL && strstr ((char *) 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 Thu Aug 14 14:05:00 2008
@@ -1354,6 +1354,28 @@
return TRUE;
}
+/**
+ * totem_pl_parser_cleanup_xml:
+ * @contents: the contents of the file
+ *
+ * Removes HTML comments from a string representing the contents of an XML file.
+ * The function modifies the string in place.
+ */
+void
+totem_pl_parser_cleanup_xml (char *contents)
+{
+ char *needle;
+
+ while ((needle = strstr (contents, "<!--")) != NULL) {
+ while (strncmp (needle, "-->", 3) != 0) {
+ *needle = ' ';
+ needle++;
+ if (*needle == '\0')
+ break;
+ }
+ }
+}
+
static gboolean
totem_pl_parser_ignore_from_mimetype (TotemPlParser *parser, const char *mimetype)
{
@@ -1484,6 +1506,7 @@
else
base_file = g_object_ref (base_file);
+ DEBUG (file, g_print ("Using %s function for '%s'\n", special_types[i].mimetype, uri));
ret = (* special_types[i].func) (parser, file, base_file, data);
g_object_unref (base_file);
@@ -1764,7 +1787,9 @@
#endif
if (mime_type != NULL &&
- (strcmp (mime_type, "text/plain") == 0 || strcmp (mime_type, "application/octet-stream") == 0)) {
+ (strcmp (mime_type, "text/plain") == 0 ||
+ strcmp (mime_type, "application/octet-stream") == 0 ||
+ strcmp (mime_type, "application/xml") == 0)) {
PlaylistIdenCallback func;
guint i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]