diff options
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 23195b4417..abfefa7e8d 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -203,10 +203,10 @@ static void copy_filerefs(struct dircache_fileref *dcfto, | |||
203 | /* Check if the filename suggests M3U or M3U8 format. */ | 203 | /* Check if the filename suggests M3U or M3U8 format. */ |
204 | static bool is_m3u8(const char* filename) | 204 | static bool is_m3u8(const char* filename) |
205 | { | 205 | { |
206 | int len = strlen(filename); | 206 | char *dot = strrchr(filename, '.'); |
207 | 207 | ||
208 | /* Default to M3U8 unless explicitly told otherwise. */ | 208 | /* Default to M3U8 unless explicitly told otherwise. */ |
209 | return !(len > 4 && strcasecmp(&filename[len - 4], ".m3u") == 0); | 209 | return (!dot || strcasecmp(dot, ".m3u") != 0); |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
@@ -468,20 +468,21 @@ static void update_playlist_filename(struct playlist_info* playlist, | |||
468 | */ | 468 | */ |
469 | static void empty_playlist(struct playlist_info* playlist, bool resume) | 469 | static void empty_playlist(struct playlist_info* playlist, bool resume) |
470 | { | 470 | { |
471 | playlist->filename[0] = '\0'; | ||
472 | playlist->utf8 = true; | 471 | playlist->utf8 = true; |
472 | playlist->control_created = false; | ||
473 | playlist->in_ram = false; | ||
473 | 474 | ||
474 | if(playlist->fd >= 0) | 475 | if(playlist->fd >= 0) /* If there is an already open playlist, close it. */ |
475 | /* If there is an already open playlist, close it. */ | 476 | { |
476 | close(playlist->fd); | 477 | close(playlist->fd); |
478 | } | ||
477 | playlist->fd = -1; | 479 | playlist->fd = -1; |
478 | 480 | ||
479 | if(playlist->control_fd >= 0) | 481 | if(playlist->control_fd >= 0) |
480 | close(playlist->control_fd); | 482 | close(playlist->control_fd); |
481 | playlist->control_fd = -1; | 483 | playlist->control_fd = -1; |
482 | playlist->control_created = false; | ||
483 | 484 | ||
484 | playlist->in_ram = false; | 485 | playlist->num_inserted_tracks = 0; |
485 | 486 | ||
486 | if (playlist->buffer) | 487 | if (playlist->buffer) |
487 | playlist->buffer[0] = 0; | 488 | playlist->buffer[0] = 0; |
@@ -492,14 +493,16 @@ static void empty_playlist(struct playlist_info* playlist, bool resume) | |||
492 | playlist->first_index = 0; | 493 | playlist->first_index = 0; |
493 | playlist->amount = 0; | 494 | playlist->amount = 0; |
494 | playlist->last_insert_pos = -1; | 495 | playlist->last_insert_pos = -1; |
495 | playlist->seed = 0; | 496 | |
496 | playlist->shuffle_modified = false; | ||
497 | playlist->deleted = false; | 497 | playlist->deleted = false; |
498 | playlist->num_inserted_tracks = 0; | ||
499 | playlist->started = false; | 498 | playlist->started = false; |
499 | playlist->pending_control_sync = false; | ||
500 | playlist->shuffle_modified = false; | ||
500 | 501 | ||
502 | playlist->seed = 0; | ||
501 | playlist->num_cached = 0; | 503 | playlist->num_cached = 0; |
502 | playlist->pending_control_sync = false; | 504 | |
505 | playlist->filename[0] = '\0'; | ||
503 | 506 | ||
504 | if (!resume && playlist->current) | 507 | if (!resume && playlist->current) |
505 | { | 508 | { |
@@ -656,19 +659,23 @@ static void display_playlist_count(int count, const unsigned char *fmt, | |||
656 | { | 659 | { |
657 | static long talked_tick = 0; | 660 | static long talked_tick = 0; |
658 | long id = P2ID(fmt); | 661 | long id = P2ID(fmt); |
659 | if(global_settings.talk_menu && id>=0) | 662 | |
663 | if(id >= 0 && global_settings.talk_menu) | ||
660 | { | 664 | { |
661 | if(final || (count && (talked_tick == 0 | 665 | long next_tick = talked_tick + (HZ * 5); |
662 | || TIME_AFTER(current_tick, talked_tick+5*HZ)))) | 666 | |
667 | if (final || talked_tick == 0) | ||
668 | next_tick = current_tick - 1; | ||
669 | |||
670 | if(count && TIME_AFTER(current_tick, next_tick)) | ||
663 | { | 671 | { |
664 | talked_tick = current_tick; | 672 | talked_tick = current_tick; |
665 | talk_number(count, false); | 673 | talk_number(count, false); |
666 | talk_id(id, true); | 674 | talk_id(id, true); |
667 | } | 675 | } |
668 | } | 676 | } |
669 | fmt = P2STR(fmt); | ||
670 | 677 | ||
671 | splashf(0, fmt, count, str(LANG_OFF_ABORT)); | 678 | splashf(0, P2STR(fmt), count, str(LANG_OFF_ABORT)); |
672 | } | 679 | } |
673 | 680 | ||
674 | 681 | ||