diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist.c | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 8121b3b85a..d9c56b62b1 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -301,9 +301,9 @@ void add_indices_to_playlist(void) | |||
301 | int nread; | 301 | int nread; |
302 | int fd = -1; | 302 | int fd = -1; |
303 | int i = 0; | 303 | int i = 0; |
304 | int store_index = 0; | ||
305 | int count = 0; | 304 | int count = 0; |
306 | int next_tick = current_tick + HZ; | 305 | int next_tick = current_tick + HZ; |
306 | bool store_index = true; | ||
307 | 307 | ||
308 | unsigned char *p = playlist_buffer; | 308 | unsigned char *p = playlist_buffer; |
309 | char line[16]; | 309 | char line[16]; |
@@ -314,7 +314,7 @@ void add_indices_to_playlist(void) | |||
314 | return; /* failure */ | 314 | return; /* failure */ |
315 | } | 315 | } |
316 | 316 | ||
317 | store_index = 1; | 317 | store_index = true; |
318 | 318 | ||
319 | while(1) | 319 | while(1) |
320 | { | 320 | { |
@@ -334,47 +334,42 @@ void add_indices_to_playlist(void) | |||
334 | /* Are we on a new line? */ | 334 | /* Are we on a new line? */ |
335 | if((*p == '\n') || (*p == '\r')) | 335 | if((*p == '\n') || (*p == '\r')) |
336 | { | 336 | { |
337 | store_index = 1; | 337 | store_index = true; |
338 | } | 338 | } |
339 | else if(!playlist.in_ram && (*p == '#') && store_index) | ||
340 | { | ||
341 | /* If the first character on a new line is a hash | ||
342 | sign, we treat it as a comment. So called winamp | ||
343 | style playlist. | ||
344 | This applies only to playlist files, of course */ | ||
345 | store_index = 0; | ||
346 | } | ||
347 | else if(store_index) | 339 | else if(store_index) |
348 | { | 340 | { |
349 | 341 | store_index = false; | |
350 | /* Store a new entry */ | 342 | |
351 | playlist.indices[ playlist.amount ] = i+count; | 343 | if(playlist.in_ram || (*p != '#')) |
352 | playlist.amount++; | 344 | { |
353 | if ( playlist.amount >= MAX_PLAYLIST_SIZE ) { | 345 | /* Store a new entry */ |
354 | if(!playlist.in_ram) | 346 | playlist.indices[ playlist.amount ] = i+count; |
355 | close(fd); | 347 | playlist.amount++; |
356 | 348 | if ( playlist.amount >= MAX_PLAYLIST_SIZE ) { | |
357 | lcd_clear_display(); | 349 | if(!playlist.in_ram) |
358 | lcd_puts(0,0,"Playlist"); | 350 | close(fd); |
359 | lcd_puts(0,1,"buffer full"); | 351 | |
360 | lcd_update(); | 352 | lcd_clear_display(); |
361 | sleep(HZ*2); | 353 | lcd_puts(0,0,"Playlist"); |
362 | lcd_clear_display(); | 354 | lcd_puts(0,1,"buffer full"); |
363 | |||
364 | return; | ||
365 | } | ||
366 | |||
367 | store_index = 0; | ||
368 | /* Update the screen if it takes very long */ | ||
369 | if(!playlist.in_ram) { | ||
370 | if ( current_tick >= next_tick ) { | ||
371 | next_tick = current_tick + HZ; | ||
372 | snprintf(line, sizeof line, "%d files", | ||
373 | playlist.amount); | ||
374 | lcd_puts(0,1,line); | ||
375 | status_draw(); | ||
376 | lcd_update(); | 355 | lcd_update(); |
356 | sleep(HZ*2); | ||
357 | lcd_clear_display(); | ||
358 | |||
359 | return; | ||
377 | } | 360 | } |
361 | |||
362 | /* Update the screen if it takes very long */ | ||
363 | if(!playlist.in_ram) { | ||
364 | if ( current_tick >= next_tick ) { | ||
365 | next_tick = current_tick + HZ; | ||
366 | snprintf(line, sizeof line, "%d files", | ||
367 | playlist.amount); | ||
368 | lcd_puts(0,1,line); | ||
369 | status_draw(); | ||
370 | lcd_update(); | ||
371 | } | ||
372 | } | ||
378 | } | 373 | } |
379 | } | 374 | } |
380 | } | 375 | } |