diff options
-rw-r--r-- | apps/playlist_catalog.c | 10 | ||||
-rw-r--r-- | apps/playlist_menu.c | 16 |
2 files changed, 16 insertions, 10 deletions
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 0b047b0fee..54326d3ff9 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -453,13 +453,17 @@ bool catalog_add_to_a_playlist(char* sel, int sel_attr, bool new_playlist) | |||
453 | 453 | ||
454 | if (new_playlist) | 454 | if (new_playlist) |
455 | { | 455 | { |
456 | size_t len; | ||
456 | snprintf(playlist, MAX_PATH, "%s/", playlist_dir); | 457 | snprintf(playlist, MAX_PATH, "%s/", playlist_dir); |
457 | if (kbd_input(playlist, MAX_PATH)) | 458 | if (kbd_input(playlist, MAX_PATH)) |
458 | return false; | 459 | return false; |
459 | 460 | ||
460 | if(strlen(playlist) <= 4 || | 461 | len = strlen(playlist); |
461 | strcasecmp(&playlist[strlen(playlist)-4], ".m3u")) | 462 | |
462 | strcat(playlist, ".m3u"); | 463 | if(len > 4 && !strcasecmp(&playlist[len-4], ".m3u")) |
464 | strcat(playlist, "8"); | ||
465 | else if(len <= 5 || strcasecmp(&playlist[len-5], ".m3u8")) | ||
466 | strcat(playlist, ".m3u8"); | ||
463 | } | 467 | } |
464 | else | 468 | else |
465 | { | 469 | { |
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c index 5e73621a22..2874c3b0d2 100644 --- a/apps/playlist_menu.c +++ b/apps/playlist_menu.c | |||
@@ -79,19 +79,21 @@ bool playlist_menu(void) | |||
79 | 79 | ||
80 | int save_playlist_screen(struct playlist_info* playlist) | 80 | int save_playlist_screen(struct playlist_info* playlist) |
81 | { | 81 | { |
82 | char* filename; | ||
83 | char temp[MAX_PATH+1]; | 82 | char temp[MAX_PATH+1]; |
84 | int len; | 83 | int len; |
85 | 84 | ||
86 | filename = playlist_get_name(playlist, temp, sizeof(temp)); | 85 | playlist_get_name(playlist, temp, sizeof(temp)); |
86 | len = strlen(temp); | ||
87 | 87 | ||
88 | if (!filename || (len=strlen(filename)) <= 5 || | 88 | if (len > 4 && !strcasecmp(&temp[len-4], ".m3u")) |
89 | strcasecmp(&filename[len-5], ".m3u8")) | 89 | strcat(temp, "8"); |
90 | strcpy(filename, DEFAULT_DYNAMIC_PLAYLIST_NAME); | 90 | |
91 | if (len <= 5 || strcasecmp(&temp[len-5], ".m3u8")) | ||
92 | strcpy(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME); | ||
91 | 93 | ||
92 | if (!kbd_input(filename, sizeof(temp))) | 94 | if (!kbd_input(temp, sizeof(temp))) |
93 | { | 95 | { |
94 | playlist_save(playlist, filename); | 96 | playlist_save(playlist, temp); |
95 | 97 | ||
96 | /* reload in case playlist was saved to cwd */ | 98 | /* reload in case playlist was saved to cwd */ |
97 | reload_directory(); | 99 | reload_directory(); |