added %pn (playlist name) to wps

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2651 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Hak 2002-10-15 11:49:15 +00:00
parent 3148bc45b0
commit f9d3d1cd91
3 changed files with 20 additions and 0 deletions

View file

@ -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);

View file

@ -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__ */

View file

@ -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;