changeset 884:4fd90f2d1832 trunk

[svn] improve support for static playlist: - make use of Playlist.attribute. - now xspf plugin is capable of embedding static playlist marker. user can specify at "Save Playlist" dialog. - all meaningful mtime value will be preserved even if a playlist file is handled as static playlist.
author yaz
date Wed, 21 Mar 2007 02:32:49 -0700
parents e6d51d079a46
children 1d8d643134db
files ChangeLog src/xspf/xspf.c
diffstat 2 files changed, 39 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Mar 20 18:55:57 2007 -0700
+++ b/ChangeLog	Wed Mar 21 02:32:49 2007 -0700
@@ -1,3 +1,15 @@
+2007-03-21 01:55:57 +0000  Giacomo Lozito <james@develia.org>
+  revision [1866]
+  - aosd: use a single ghosd object for all of the osd showups; this will be a lot gentler to XLib and should definitely help with stability
+  trunk/src/aosd/aosd.c         |   11 ++++++----
+  trunk/src/aosd/aosd_osd.c     |   45 +++++++++++++++++++++++++++++-------------
+  trunk/src/aosd/aosd_osd.h     |    6 +++--
+  trunk/src/aosd/aosd_trigger.c |    6 ++---
+  trunk/src/aosd/aosd_ui.c      |   14 ++++++++++---
+  trunk/src/aosd/ghosd.c        |    1 
+  6 files changed, 57 insertions(+), 26 deletions(-)
+
+
 2007-03-20 21:01:54 +0000  Michael Farber <01mf02@gmail.com>
   revision [1864]
   - integrated SndStretch into build process
--- a/src/xspf/xspf.c	Tue Mar 20 18:55:57 2007 -0700
+++ b/src/xspf/xspf.c	Wed Mar 21 02:32:49 2007 -0700
@@ -49,7 +49,6 @@
 #define TMP_BUF_LEN 128
 
 gchar *base = NULL;
-gboolean override_mtime = FALSE;
 
 // this function is taken from libxml2-2.6.27.
 static xmlChar *
@@ -86,7 +85,7 @@
 
 	tuple = bmp_title_input_new();
 
-	// staticlist hack
+	tuple->length = -1;
 	tuple->mtime = -1; // mark as uninitialized.
 
 	// creator, album, title, duration, trackNum, annotation, image, 
@@ -119,7 +118,6 @@
 		}
 		else if(nptr->type == XML_ELEMENT_NODE && !xmlStrcmp(nptr->name, (xmlChar *)"annotation")){
 			tuple->comment = (gchar *)xmlNodeGetContent(nptr);
-			continue;
 		}
 		else if(nptr->type == XML_ELEMENT_NODE && !xmlStrcmp(nptr->name, (xmlChar *)"album")){
 			tuple->album_name = (gchar *)xmlNodeGetContent(nptr);
@@ -176,14 +174,6 @@
 
 	}
 
-	if (tuple->length == 0) {
-		tuple->length = -1;
-	}
-
-	if(override_mtime) {
-		tuple->mtime = 0; //when mtime=0, scanning will be skipped.  --yaz
-	}
-
 	if(location){
 		tuple->file_name = g_path_get_basename(location);
 		tuple->file_path = g_path_get_dirname(location);
@@ -212,16 +202,20 @@
 find_audoptions(xmlNode *tracklist, const gchar *filename, gint pos)
 {
 	xmlNode *nptr;
+	Playlist *playlist = playlist_get_active();
+
 	for(nptr = tracklist->children; nptr != NULL; nptr = nptr->next){
 		if(nptr->type == XML_ELEMENT_NODE && !xmlStrcmp(nptr->name, (xmlChar *)"options")){
 			xmlChar *opt = NULL;
 			
 			opt = xmlGetProp(nptr, (xmlChar *)"staticlist");
 			if(!strcasecmp((char *)opt, "true")){
-                override_mtime = TRUE;
+				playlist->attribute |= PLAYLIST_STATIC;
 			}
-            xmlFree(opt);
-            opt = NULL;
+			else
+				playlist->attribute ^= PLAYLIST_STATIC;
+			xmlFree(opt);
+			opt = NULL;
 		}
 	}
 }
@@ -281,7 +275,7 @@
 	xmlDocPtr doc;
 	xmlNodePtr rootnode, tmp, tracklist;
 	GList *node;
-        Playlist *playlist = playlist_get_active();
+	Playlist *playlist = playlist_get_active();
 
 	doc = xmlNewDoc((xmlChar *)"1.0");
 
@@ -297,6 +291,20 @@
 	xmlAddChild(tmp, xmlNewText((xmlChar *)PACKAGE "-" VERSION));
 	xmlAddChild(rootnode, tmp);
 
+	// add staticlist marker
+	if(playlist->attribute & PLAYLIST_STATIC) {
+		xmlNodePtr extension, options;
+
+		extension = xmlNewNode(NULL, (xmlChar *)"extension");
+		xmlSetProp(extension, (xmlChar *)"application", (xmlChar *)"audacious");
+
+		options = xmlNewNode(NULL, (xmlChar *)"options");
+		xmlSetProp(options, (xmlChar *)"staticlist", (xmlChar *)"true");
+
+		xmlAddChild(extension, options);
+		xmlAddChild(rootnode, extension);
+	}
+
 	tracklist = xmlNewNode(NULL, (xmlChar *)"trackList");
 	xmlAddChild(rootnode, tracklist);
 
@@ -435,18 +443,18 @@
 				xmlAddChild(track, tmp);
 			}
 
-            // mtime: write mtime unconditionally for staticlist hack.
-//			if (entry->tuple->mtime) {
+			// mtime: write mtime unconditionally to support staticlist.
+			{
 				gchar *str;
 				str = g_malloc(TMP_BUF_LEN);
 				tmp = xmlNewNode(NULL, (xmlChar *)"meta");
 				xmlSetProp(tmp, (xmlChar *)"rel", (xmlChar *)"mtime");
 				sprintf(str, "%ld", (long) entry->tuple->mtime);
+
 				xmlAddChild(tmp, xmlNewText((xmlChar *)str));
 				xmlAddChild(track, tmp);
 				g_free(str);
-//			}
-
+			}
 		}
 		g_free(filename);
 		filename = NULL;