Enlightenment CVS committal

Author  : tsauerbeck
Project : e17
Module  : apps/euphoria

Dir     : e17/apps/euphoria/src


Modified Files:
        interface.c playlist_item.c 


Log Message:
fixed playlist item property code
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/interface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- interface.c 28 Feb 2004 09:36:26 -0000      1.5
+++ interface.c 29 Feb 2004 13:52:05 -0000      1.6
@@ -1,5 +1,5 @@
 /*
- * $Id: interface.c,v 1.5 2004/02/28 09:36:26 tsauerbeck Exp $
+ * $Id: interface.c,v 1.6 2004/02/29 13:52:05 tsauerbeck Exp $
  * vim:noexpandtab:sw=4:sts=4:ts=4
  */
 
@@ -179,24 +179,16 @@
 }
 
 void ui_fill_track_info(Euphoria *e, PlayListItem *pli) {
-       char *tmp;
        char buf[32];
 
-       /* XMMS should fill these for us! */
-       if (!(tmp = (char *) playlist_item_title_get(pli)))
-               tmp = "Unknown";
+       edje_object_part_text_set(e->gui.edje, "song_name",
+                                 playlist_item_title_get(pli));
 
-       edje_object_part_text_set(e->gui.edje, "song_name", tmp);
+       edje_object_part_text_set(e->gui.edje, "artist_name",
+                                 playlist_item_artist_get(pli));
 
-       if (!(tmp = (char *) playlist_item_artist_get(pli)))
-               tmp = "Unknown";
-
-       edje_object_part_text_set(e->gui.edje, "artist_name", tmp);
-
-       if (!(tmp = (char *) playlist_item_album_get(pli)))
-               tmp = "Unknown";
-
-       edje_object_part_text_set(e->gui.edje, "album_name", tmp);
+       edje_object_part_text_set(e->gui.edje, "album_name",
+                                 playlist_item_album_get(pli));
 
        /* sample rate */
        snprintf(buf, sizeof(buf), "%.1f",
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/euphoria/src/playlist_item.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- playlist_item.c     28 Feb 2004 09:36:26 -0000      1.5
+++ playlist_item.c     29 Feb 2004 13:52:05 -0000      1.6
@@ -1,5 +1,5 @@
 /*
- * $Id: playlist_item.c,v 1.5 2004/02/28 09:36:26 tsauerbeck Exp $
+ * $Id: playlist_item.c,v 1.6 2004/02/29 13:52:05 tsauerbeck Exp $
  * vim:noexpandtab:sw=4:sts=4:ts=4
  */
 
@@ -13,15 +13,31 @@
 #include "utils.h"
 
 const char *playlist_item_artist_get(PlayListItem *pli) {
-       return x_hash_lookup(pli->properties, "artist");
+       const char *tmp = x_hash_lookup(pli->properties, "artist");
+
+       return tmp ? tmp : "Unknown";
 }
 
 const char *playlist_item_title_get(PlayListItem *pli) {
-       return x_hash_lookup(pli->properties, "title");
+       const char *title, *url;
+
+       if ((title = x_hash_lookup(pli->properties, "title")))
+               return title;
+
+       /* we don't have a title, so let's try to use the url instead */
+       url = x_hash_lookup(pli->properties, "url");
+       assert(url);
+
+       if (!strncmp(url, "file://", 7))
+               return strrchr(url, '/') + 1;
+       else
+               return strstr(url, "//") + 2;
 }
 
 const char *playlist_item_album_get(PlayListItem *pli) {
-       return x_hash_lookup(pli->properties, "album");
+       const char *tmp = x_hash_lookup(pli->properties, "album");
+
+       return tmp ? tmp : "Unknown";
 }
 
 unsigned int playlist_item_duration_get(PlayListItem *pli) {




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to