summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2cd55f6)
raw | patch | inline | side by side (parent: 2cd55f6)
author | Kalle Wallin <kaw@linux.se> | |
Tue, 15 Jun 2004 15:32:18 +0000 (15:32 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Tue, 15 Jun 2004 15:32:18 +0000 (15:32 +0000) |
src/ncmpc.h | patch | blob | history | |
src/strfsong.c | patch | blob | history |
diff --git a/src/ncmpc.h b/src/ncmpc.h
index 6efe55af60a8f2760a25f9c9a87a027576daa4b6..4a2770be948d308ee618ba1688c5e3e9bdd74b86 100644 (file)
--- a/src/ncmpc.h
+++ b/src/ncmpc.h
#define MPD_RECONNECT_TIME 1500
/* song format - list window */
-#define DEFAULT_LIST_FORMAT "%name%|[%artist% - ]%title%|%file%"
+#define DEFAULT_LIST_FORMAT "%name%|[%artist% - ]%title%|%shortfile%"
#define LIST_FORMAT (options.list_format ? options.list_format : DEFAULT_LIST_FORMAT)
/* song format - status window */
diff --git a/src/strfsong.c b/src/strfsong.c
index 8014472767c1361fcc69a0dac17f5013968ff4bd..a06ae95a119811c85c706364b45c4fdfca7834a1 100644 (file)
--- a/src/strfsong.c
+++ b/src/strfsong.c
/*
* $Id$
*
+ * Based on mpc's songToFormatedString modified for glib and ncmpc
+ *
+ *
+ * (c) 2003-2004 by normalperson and Warren Dukes (shank@mercury.chem.pitt.edu)
+ * and Daniel Brown (danb@cs.utexas.edu)
+ * and Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "config.h"
#include "libmpdclient.h"
-#include "ncmpc.h"
#include "support.h"
#include "strfsong.h"
-static char *
-skip(char * p)
+static gchar *
+skip(gchar * p)
{
- int stack = 0;
+ gint stack = 0;
while (*p != '\0') {
if(*p == '[') stack++;
n = end - p + 1;
if(*end != '%')
n--;
- else if (strncmp("%shortfile%", p, n) == 0)
- temp = utf8_to_locale(basename(song->file));
else if (strncmp("%file%", p, n) == 0)
temp = utf8_to_locale(song->file);
else if (strncmp("%artist%", p, n) == 0)
temp = song->track ? utf8_to_locale(song->track) : NULL;
else if (strncmp("%name%", p, n) == 0)
temp = song->name ? utf8_to_locale(song->name) : NULL;
+ else if (strncmp("%shortfile%", p, n) == 0)
+ {
+ if( strstr(song->file, "://") )
+ temp = utf8_to_locale(song->file);
+ else
+ temp = utf8_to_locale(basename(song->file));
+ }
else if (strncmp("%time%", p, n) == 0)
{
if (song->time != MPD_SONG_NO_TIME) {
return length;
}
-
-/* a modified version of mpc's songToFormatedString (util.c)
- * added - %basename%
- */
-
gsize
strfsong(gchar *s, gsize max, const gchar *format, mpd_Song *song)
{