From 7c15ded62c8b04ef39dd0dedb3d30b3bc6634114 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 21 Jul 2009 19:53:59 +0200 Subject: added handling of non-tagged files --- playlist.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'playlist.c') diff --git a/playlist.c b/playlist.c index 4f7fcb80..ea2d3ec7 100644 --- a/playlist.c +++ b/playlist.c @@ -537,8 +537,19 @@ ps_format_item_display_name (playItem_t *it) { snprintf (it->displayname, MAX_DISPLAY_NAME, "%s", title); } else { - //snprintf (it->displayname, MAX_DISPLAY_NAME, "%s", title); - strncpy (it->displayname, it->fname, MAX_DISPLAY_NAME); + // cut filename without path and extension + char *pext = it->fname + strlen (it->fname) - 1; + while (pext >= it->fname && *pext != '.') { + pext--; + } + char *pname = pext; + while (pname >= it->fname && *pname != '/') { + pname--; + } + if (*pname == '/') { + pname++; + } + strncpy (it->displayname, pname, pext-pname); } } -- cgit v1.2.3