From f9d3d1cd91d67b9692a44fa6408dca5758336e6d Mon Sep 17 00:00:00 2001 From: Robert Hak Date: Tue, 15 Oct 2002 11:49:15 +0000 Subject: added %pn (playlist name) to wps git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2651 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 14 ++++++++++++++ apps/playlist.h | 2 ++ apps/wps-display.c | 4 ++++ 3 files changed, 20 insertions(+) (limited to 'apps') diff --git a/apps/playlist.c b/apps/playlist.c index 3c512cd82f..091a8bb1b0 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -111,6 +111,20 @@ int playlist_first_index(void) return playlist.first_index; } +void playlist_name(char *name, int name_size) +{ + char buf[MAX_PATH+1]; + int i = 0; + + snprintf(buf, "%s", playlist.filename+playlist.dirlen); + while((buf[i] != '.') && (buf[i] != 0)) + i++; + buf[i] = 0; + + snprintf(name, name_size, "%s", buf); + return; +} + int playlist_next(int steps) { playlist.index = get_next_index(steps); diff --git a/apps/playlist.h b/apps/playlist.h index c47fec4325..39ed3a568d 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -51,8 +51,10 @@ void sort_playlist(bool start_current); void empty_playlist(void); void add_indices_to_playlist(void); void playlist_clear(void); +void playlist_name(char *name, int name_size); int playlist_add(char *filename); int playlist_amount(void); int playlist_first_index(void); #endif /* __PLAYLIST_H__ */ + diff --git a/apps/wps-display.c b/apps/wps-display.c index 59fda08cac..88bfa73687 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -318,6 +318,10 @@ static char* get_tag(struct mp3entry* id3, snprintf(buf, buf_size, "%d", id3->index + 1); return buf; + case 'n': /* Playlist Name (without path) */ + playlist_name(buf, buf_size); + return buf; + case 'e': /* Playlist Total Entries */ snprintf(buf, buf_size, "%d", playlist_amount()); return buf; -- cgit v1.2.3