[Xfce4-commits] <parole:master> Support title entry in some playlist file format.
Ali Abdallah
noreply at xfce.org
Sun Nov 8 15:26:02 CET 2009
Updating branch refs/heads/master
to 8959cc77dcd715eb1c6b858b968bb948c931e9f3 (commit)
from 13fb294d4043332815178dbc793a0945a8590677 (commit)
commit 8959cc77dcd715eb1c6b858b968bb948c931e9f3
Author: Ali Abdallah <ali at ali-xfce.org>
Date: Sun Nov 8 15:19:44 2009 +0100
Support title entry in some playlist file format.
Do override confirmation when saving playlist file.
parole/parole-file.c | 31 ++++++++++++++++++-------------
parole/parole-medialist.c | 2 ++
parole/parole-pl-parser.c | 10 +++++-----
3 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/parole/parole-file.c b/parole/parole-file.c
index 23f39b6..64b6845 100644
--- a/parole/parole-file.c
+++ b/parole/parole-file.c
@@ -165,7 +165,8 @@ parole_file_constructed (GObject *object)
}
else
{
- priv->display_name = g_strdup (priv->filename);
+ if ( !priv->display_name )
+ priv->display_name = g_strdup (priv->filename);
g_warning ("Unable to read file info %s", error->message);
}
goto out;
@@ -180,22 +181,26 @@ parole_file_constructed (GObject *object)
tag_file = taglib_file_new (priv->filename);
- tag = taglib_file_tag (tag_file);
-
- title = taglib_tag_title (tag);
-
- if ( title )
+ if ( tag_file )
{
- title_s = g_strstrip (title);
- if ( strlen (title_s ) )
+ tag = taglib_file_tag (tag_file);
+ if ( tag )
{
- priv->display_name = g_strdup (title_s);
+ title = taglib_tag_title (tag);
+
+ if ( title )
+ {
+ title_s = g_strstrip (title);
+ if ( strlen (title_s ) )
+ {
+ priv->display_name = g_strdup (title_s);
+ }
+ }
+
+ taglib_tag_free_strings ();
}
+ taglib_file_free (tag_file);
}
-
- taglib_file_free (tag_file);
-
- taglib_tag_free_strings ();
}
#endif
diff --git a/parole/parole-medialist.c b/parole/parole-medialist.c
index b9326e6..b2da840 100644
--- a/parole/parole-medialist.c
+++ b/parole/parole-medialist.c
@@ -516,6 +516,8 @@ void parole_media_list_save_cb (GtkButton *button, ParoleMediaList *list)
gtk_window_set_transient_for (GTK_WINDOW (chooser),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (list))));
+
+ gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (chooser), TRUE);
filename = g_strconcat (_("Playlist"), ".m3u", NULL);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (chooser), filename);
diff --git a/parole/parole-pl-parser.c b/parole/parole-pl-parser.c
index a9fe419..4255cc4 100644
--- a/parole/parole-pl-parser.c
+++ b/parole/parole-pl-parser.c
@@ -422,8 +422,6 @@ parole_pl_parser_parse_pls (const gchar *filename)
static GSList *
parole_pl_parser_parse_xspf (const gchar *filename)
{
- GSList *list = NULL;
-
ParoleParserData data;
GFile *file;
gchar *contents;
@@ -481,8 +479,6 @@ parole_pl_parser_parse_xspf (const gchar *filename)
out:
g_object_unref (file);
return data.list;
-
- return list;
}
static GSList *
@@ -573,6 +569,8 @@ parole_pl_parser_save_pls (FILE *f, GSList *files)
file = g_slist_nth_data (files, i - 1);
g_snprintf (key, 128, "File%d", i);
fprintf (f, "%s=%s\n", key, parole_file_get_file_name (file));
+ g_snprintf (key, 128, "Title%d", i);
+ fprintf (f, "%s=%s\n\n", key, parole_file_get_display_name (file));
}
return TRUE;
@@ -618,8 +616,10 @@ parole_pl_parser_save_xspf (FILE *f, GSList *files)
for ( i = 0; i < len; i++)
{
ParoleFile *file;
+
file = g_slist_nth_data (files, i);
- fprintf (f, " <track>\n <location>%s</location>\n </track>\n", parole_file_get_uri (file));
+ fprintf (f, " <track>\n <title>%s</title>\n <location>%s</location>\n </track>\n",
+ parole_file_get_display_name (file), parole_file_get_uri (file));
}
fputs (" </trackList>\n<playlist>", f);
More information about the Xfce4-commits
mailing list