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.tar.gz
rockbox-73926ef5e5dbe1a3bfd627a016c3a975cf673327.zip
%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 3cd40deb45..ce812c7c67 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -111,18 +111,21 @@ int playlist_first_index(void)
111 return playlist.first_index; 111 return playlist.first_index;
112} 112}
113 113
114void playlist_name(char *name, int name_size) 114char *playlist_name(char *buf, int buf_size)
115{ 115{
116 char buf[MAX_PATH+1]; 116 char *sep;
117 int i = 0; 117
118 snprintf(buf, buf_size, "%s", playlist.filename+playlist.dirlen);
118 119
119 snprintf(buf, sizeof(buf), "%s", playlist.filename+playlist.dirlen); 120 if (0 == buf[0])
120 while((buf[i] != '.') && (buf[i] != 0)) 121 return NULL;
121 i++;
122 buf[i] = 0;
123 122
124 snprintf(name, name_size, "%s", buf); 123 /* Remove extension */
125 return; 124 sep = strrchr(buf, '.');
125 if (NULL != sep)
126 *sep = 0;
127
128 return buf;
126} 129}
127 130
128int playlist_next(int steps) 131int playlist_next(int steps)
diff --git a/apps/playlist.h b/apps/playlist.h
index 39ed3a568d..47422a40a5 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -45,13 +45,13 @@ int play_list(char *dir, char *file, int start_index,
45 bool shuffled_index, int start_offset, 45 bool shuffled_index, int start_offset,
46 int random_seed, int first_index); 46 int random_seed, int first_index);
47char* playlist_peek(int steps); 47char* playlist_peek(int steps);
48char* playlist_name(char *name, int name_size);
48int playlist_next(int steps); 49int playlist_next(int steps);
49void randomise_playlist( unsigned int seed ); 50void randomise_playlist( unsigned int seed );
50void sort_playlist(bool start_current); 51void sort_playlist(bool start_current);
51void empty_playlist(void); 52void empty_playlist(void);
52void add_indices_to_playlist(void); 53void add_indices_to_playlist(void);
53void playlist_clear(void); 54void playlist_clear(void);
54void playlist_name(char *name, int name_size);
55int playlist_add(char *filename); 55int playlist_add(char *filename);
56int playlist_amount(void); 56int playlist_amount(void);
57int playlist_first_index(void); 57int playlist_first_index(void);
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 88bfa73687..f095fe5c58 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -319,8 +319,7 @@ static char* get_tag(struct mp3entry* id3,
319 return buf; 319 return buf;
320 320
321 case 'n': /* Playlist Name (without path) */ 321 case 'n': /* Playlist Name (without path) */
322 playlist_name(buf, buf_size); 322 return playlist_name(buf, buf_size);
323 return buf;
324 323
325 case 'e': /* Playlist Total Entries */ 324 case 'e': /* Playlist Total Entries */
326 snprintf(buf, buf_size, "%d", playlist_amount()); 325 snprintf(buf, buf_size, "%d", playlist_amount());