summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playlist_viewer.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 087bdd1..6c21cc4 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -357,18 +357,16 @@ static void format_name(char* dest, const char* src)
case 0:
default:
{
- /* Only display the mp3 filename */
+ /* Only display the filename */
char* p = strrchr(src, '/');
- int len;
strcpy(dest, p+1);
- len = strlen(dest);
/* Remove the extension */
- if (!strcasecmp(&dest[len-4], ".mp3") ||
- !strcasecmp(&dest[len-4], ".mp2") ||
- !strcasecmp(&dest[len-4], ".mpa"))
- dest[len-4] = '\0';
+ char* q = strrchr(dest, '.');
+
+ if (q != NULL)
+ *q = '\0';
break;
}