summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobert Hak <adiamas@rockbox.org>2002-10-17 09:34:48 +0000
committerRobert Hak <adiamas@rockbox.org>2002-10-17 09:34:48 +0000
commit73926ef5e5dbe1a3bfd627a016c3a975cf673327 (patch)
treebdb8831fbe30b02bf1ebe85dfc85c28445ee9d08 /apps
parenta477dc6cf5d738ac3647919f2547d9b24dd55ef8 (diff)
downloadrockbox-73926ef5e5dbe1a3bfd627a016c3a975cf673327.zip
rockbox-73926ef5e5dbe1a3bfd627a016c3a975cf673327.tar.gz
rockbox-73926ef5e5dbe1a3bfd627a016c3a975cf673327.tar.bz2
rockbox-73926ef5e5dbe1a3bfd627a016c3a975cf673327.tar.xz
%pn now allows for conditional checking
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2698 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playlist.c21
-rw-r--r--apps/playlist.h2
-rw-r--r--apps/wps-display.c3
3 files changed, 14 insertions, 12 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 3cd40de..ce812c7 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -111,18 +111,21 @@ int playlist_first_index(void)
return playlist.first_index;
}
-void playlist_name(char *name, int name_size)
+char *playlist_name(char *buf, int buf_size)
{
- char buf[MAX_PATH+1];
- int i = 0;
+ char *sep;
+
+ snprintf(buf, buf_size, "%s", playlist.filename+playlist.dirlen);
- snprintf(buf, sizeof(buf), "%s", playlist.filename+playlist.dirlen);
- while((buf[i] != '.') && (buf[i] != 0))
- i++;
- buf[i] = 0;
+ if (0 == buf[0])
+ return NULL;
- snprintf(name, name_size, "%s", buf);
- return;
+ /* Remove extension */
+ sep = strrchr(buf, '.');
+ if (NULL != sep)
+ *sep = 0;
+
+ return buf;
}
int playlist_next(int steps)
diff --git a/apps/playlist.h b/apps/playlist.h
index 39ed3a5..47422a4 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -45,13 +45,13 @@ int play_list(char *dir, char *file, int start_index,
bool shuffled_index, int start_offset,
int random_seed, int first_index);
char* playlist_peek(int steps);
+char* playlist_name(char *name, int name_size);
int playlist_next(int steps);
void randomise_playlist( unsigned int seed );
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);
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 88bfa73..f095fe5 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -319,8 +319,7 @@ static char* get_tag(struct mp3entry* id3,
return buf;
case 'n': /* Playlist Name (without path) */
- playlist_name(buf, buf_size);
- return buf;
+ return playlist_name(buf, buf_size);
case 'e': /* Playlist Total Entries */
snprintf(buf, buf_size, "%d", playlist_amount());