diff options
author | Robert Hak <adiamas@rockbox.org> | 2002-10-15 11:49:15 +0000 |
---|---|---|
committer | Robert Hak <adiamas@rockbox.org> | 2002-10-15 11:49:15 +0000 |
commit | f9d3d1cd91d67b9692a44fa6408dca5758336e6d (patch) | |
tree | 830d7f378f1bfbf955719144491f5a41c95d85ba | |
parent | 3148bc45b0ab0d72d9dabe54d84648554f96015b (diff) | |
download | rockbox-f9d3d1cd91d67b9692a44fa6408dca5758336e6d.tar.gz rockbox-f9d3d1cd91d67b9692a44fa6408dca5758336e6d.zip |
added %pn (playlist name) to wps
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2651 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/playlist.c | 14 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/wps-display.c | 4 |
3 files changed, 20 insertions, 0 deletions
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; |