totem-pl-parser r118 - in trunk: . plparse
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: totem-pl-parser r118 - in trunk: . plparse
- Date: Thu, 8 May 2008 16:53:54 +0100 (BST)
Author: hadess
Date: Thu May 8 15:53:54 2008
New Revision: 118
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=118&view=rev
Log:
2008-05-08 Bastien Nocera <hadess hadess net>
* plparse/totem-pl-parser-pls.c
(totem_pl_parser_add_pls_with_contents):
Fix usage of totem_pl_parser_base_url(), and remove last use
of gnome-vfs
* configure.in: Remove gnome-vfs dependency (Closes: #512581)
Still a lot of bugs, but we're starting again
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/plparse/totem-pl-parser-pls.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Thu May 8 15:53:54 2008
@@ -35,8 +35,7 @@
AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
# Requirements
-GLIB_REQS=2.13.4
-GNOMEVFS_REQS=2.16.0
+GLIB_REQS=2.16.3
DBUS_REQS=0.61
# Before making a release, the PLPARSER_LT_VERSION string should be modified.
@@ -77,7 +76,7 @@
AM_CONDITIONAL(HAVE_HAL, test x"$with_hal" = xyes)
dnl Check for packages for building libtotem-plparser.la
-PKG_CHECK_MODULES(TOTEM_PLPARSER, [glib-2.0 >= $GLIB_REQS gtk+-2.0 libxml-2.0 gnome-vfs-2.0 >= $GNOMEVFS_REQS gnome-vfs-module-2.0 camel-1.2 gio-2.0])
+PKG_CHECK_MODULES(TOTEM_PLPARSER, [glib-2.0 >= $GLIB_REQS gtk+-2.0 libxml-2.0 gnome-vfs-module-2.0 camel-1.2 gio-2.0])
PKG_CHECK_MODULES([TOTEM_PLPARSER_MINI], [gnome-vfs-2.0 gnome-vfs-module-2.0 gio-2.0])
Modified: trunk/plparse/totem-pl-parser-pls.c
==============================================================================
--- trunk/plparse/totem-pl-parser-pls.c (original)
+++ trunk/plparse/totem-pl-parser-pls.c Thu May 8 15:53:54 2008
@@ -121,10 +121,11 @@
TotemPlParserResult
totem_pl_parser_add_pls_with_contents (TotemPlParser *parser,
GFile *file,
- GFile *base_file,
+ GFile *_base_file,
const char *contents)
{
TotemPlParserResult retval = TOTEM_PL_PARSER_RESULT_UNHANDLED;
+ GFile *base_file;
char **lines;
int i, num_entries;
char *split_char, *playlist_title;
@@ -183,10 +184,16 @@
goto bail;
}
+ /* Base? */
+ if (_base_file == NULL)
+ base_file = g_file_get_parent (file);
+ else
+ base_file = g_object_ref (_base_file);
+
retval = TOTEM_PL_PARSER_RESULT_SUCCESS;
for (i = 1; i <= num_entries; i++) {
- char *file, *title, *genre, *length;
+ char *file_str, *title, *genre, *length;
char *file_key, *title_key, *genre_key, *length_key;
gint64 length_num;
@@ -197,7 +204,7 @@
/* Genre is our own little extension */
genre_key = g_strdup_printf ("genre%d", i);
- file = totem_pl_parser_read_ini_line_string (lines, (const char*)file_key, dos_mode);
+ file_str = totem_pl_parser_read_ini_line_string (lines, (const char*)file_key, dos_mode);
title = totem_pl_parser_read_ini_line_string (lines, (const char*)title_key, dos_mode);
genre = totem_pl_parser_read_ini_line_string (lines, (const char*)genre_key, dos_mode);
length = totem_pl_parser_read_ini_line_string (lines, (const char*)length_key, dos_mode);
@@ -207,8 +214,7 @@
g_free (genre_key);
g_free (length_key);
- if (file == NULL)
- {
+ if (file_str == NULL) {
g_free (title);
g_free (genre);
g_free (length);
@@ -224,41 +230,39 @@
if (length != NULL)
length_num = totem_pl_parser_parse_duration (length, parser->priv->debug);
- if (strstr (file, "://") != NULL || file[0] == G_DIR_SEPARATOR) {
- if (length_num < 0 || totem_pl_parser_parse_internal (parser, file, NULL) != TOTEM_PL_PARSER_RESULT_SUCCESS) {
+ if (strstr (file_str, "://") != NULL || file_str[0] == G_DIR_SEPARATOR) {
+ GFile *target;
+
+ target = g_file_new_for_commandline_arg (file_str);
+ if (length_num < 0 || totem_pl_parser_parse_internal (parser, target, NULL) != TOTEM_PL_PARSER_RESULT_SUCCESS) {
totem_pl_parser_add_url (parser,
- TOTEM_PL_PARSER_FIELD_URL, file,
+ TOTEM_PL_PARSER_FIELD_URL, file_str,
TOTEM_PL_PARSER_FIELD_TITLE, title,
TOTEM_PL_PARSER_FIELD_GENRE, genre,
TOTEM_PL_PARSER_FIELD_DURATION, length,
TOTEM_PL_PARSER_FIELD_BASE_FILE, base_file, NULL);
}
+ g_object_unref (target);
} else {
- char *base;
+ GFile *target;
- /* Try with a base */
- base = totem_pl_parser_base_url (file);
+ target = g_file_get_child_for_display_name (base_file, file_str, NULL);
- if (length_num < 0 || totem_pl_parser_parse_internal (parser, file, base) != TOTEM_PL_PARSER_RESULT_SUCCESS) {
- char *escaped, *uri;
+ if (length_num < 0 || totem_pl_parser_parse_internal (parser, target, base_file) != TOTEM_PL_PARSER_RESULT_SUCCESS) {
- escaped = gnome_vfs_escape_path_string (file);
- uri = g_strdup_printf ("%s/%s", base, escaped);
- g_free (escaped);
totem_pl_parser_add_url (parser,
- TOTEM_PL_PARSER_FIELD_URL, uri,
+ TOTEM_PL_PARSER_FIELD_FILE, target,
TOTEM_PL_PARSER_FIELD_TITLE, title,
TOTEM_PL_PARSER_FIELD_GENRE, genre,
TOTEM_PL_PARSER_FIELD_DURATION, length,
- TOTEM_PL_PARSER_FIELD_BASE, base, NULL);
- g_free (uri);
+ TOTEM_PL_PARSER_FIELD_BASE_FILE, base_file, NULL);
}
- g_free (base);
+ g_object_unref (target);
}
parser->priv->fallback = fallback;
- g_free (file);
+ g_free (file_str);
g_free (title);
g_free (genre);
g_free (length);
@@ -267,6 +271,8 @@
if (playlist_title != NULL)
totem_pl_parser_playlist_end (parser, playlist_title);
+ g_object_unref (base_file);
+
bail:
g_free (playlist_title);
g_strfreev (lines);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]