aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-06-15 15:32:18 +0000
committerKalle Wallin <kaw@linux.se>2004-06-15 15:32:18 +0000
commit236077042b696133b4a634be5048faf65b53e6dc (patch)
treec6f4fdf9c66673abac2ed1dbe47a88e30c20d9e7 /src
parent2cd55f67e6fd74337d48936ff4020cbe7f60c476 (diff)
downloadmpd-236077042b696133b4a634be5048faf65b53e6dc.tar.gz
mpd-236077042b696133b4a634be5048faf65b53e6dc.tar.xz
mpd-236077042b696133b4a634be5048faf65b53e6dc.zip
Modified %shortfile% format to not shorten urls
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1502 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/ncmpc.h2
-rw-r--r--src/strfsong.c41
2 files changed, 31 insertions, 12 deletions
diff --git a/src/ncmpc.h b/src/ncmpc.h
index 6efe55af6..4a2770be9 100644
--- a/src/ncmpc.h
+++ b/src/ncmpc.h
@@ -39,7 +39,7 @@
#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 801447276..a06ae95a1 100644
--- a/src/strfsong.c
+++ b/src/strfsong.c
@@ -1,8 +1,28 @@
/*
* $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>
@@ -11,14 +31,13 @@
#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++;
@@ -145,8 +164,6 @@ _strfsong(gchar *s,
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)
@@ -159,6 +176,13 @@ _strfsong(gchar *s,
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) {
@@ -201,11 +225,6 @@ _strfsong(gchar *s,
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)
{