summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-21 19:53:59 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-07-21 19:53:59 +0200
commit7c15ded62c8b04ef39dd0dedb3d30b3bc6634114 (patch)
treedd43e044e8afd7483bf4a592ee01a9536f84e58a /playlist.c
parentf64ea0fb7c04cf55b223bd7ae96f19b4aaf3f553 (diff)
added handling of non-tagged files
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c15
1 files changed, 13 insertions, 2 deletions
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);
}
}