diff options
-rw-r--r-- | apps/menus/playlist_menu.c | 15 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/playlist_catalog.c | 15 | ||||
-rw-r--r-- | apps/playlist_catalog.h | 2 |
4 files changed, 18 insertions, 16 deletions
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c index 87ed7428ea..e527e3ebef 100644 --- a/apps/menus/playlist_menu.c +++ b/apps/menus/playlist_menu.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "playlist_catalog.h" | 39 | #include "playlist_catalog.h" |
40 | #include "splash.h" | 40 | #include "splash.h" |
41 | #include "filetree.h" | 41 | #include "filetree.h" |
42 | #include "general.h" | ||
42 | 43 | ||
43 | /* load a screen to save the playlist passed in (or current playlist if NULL is passed) */ | 44 | /* load a screen to save the playlist passed in (or current playlist if NULL is passed) */ |
44 | int save_playlist_screen(struct playlist_info* playlist) | 45 | int save_playlist_screen(struct playlist_info* playlist) |
@@ -54,29 +55,27 @@ int save_playlist_screen(struct playlist_info* playlist) | |||
54 | char temp[MAX_PATH+1], *p; | 55 | char temp[MAX_PATH+1], *p; |
55 | int len; | 56 | int len; |
56 | 57 | ||
58 | catalog_get_directory(directoryonly, sizeof(directoryonly)); | ||
57 | playlist_get_name(playlist, temp, sizeof(temp)-1); | 59 | playlist_get_name(playlist, temp, sizeof(temp)-1); |
58 | 60 | ||
59 | len = strlen(temp); | 61 | len = strlen(temp); |
60 | 62 | ||
61 | if (len <= 1) /* root or dynamic playlist */ | 63 | if (len <= 1) /* root or dynamic playlist */ |
62 | { | 64 | create_numbered_filename(temp, directoryonly, PLAYLIST_UNTITLED_PREFIX, ".m3u8", |
63 | catalog_get_directory(temp, sizeof(temp)); | 65 | 1 IF_CNFN_NUM_(, NULL)); |
64 | strlcat(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(temp)); | ||
65 | } | ||
66 | else if (!strcmp((temp + len - 1), "/")) /* dir playlists other than root */ | 66 | else if (!strcmp((temp + len - 1), "/")) /* dir playlists other than root */ |
67 | { | 67 | { |
68 | temp[len - 1] = '\0'; | 68 | temp[len - 1] = '\0'; |
69 | catalog_get_directory(directoryonly, sizeof(directoryonly)); | ||
70 | 69 | ||
71 | if ((p = strrchr(temp, '/'))) /* use last path component as playlist name */ | 70 | if ((p = strrchr(temp, '/'))) /* use last path component as playlist name */ |
72 | { | 71 | { |
73 | strlcat(directoryonly, p, sizeof(directoryonly)); | 72 | strlcat(directoryonly, p, sizeof(directoryonly)); |
74 | strlcat(directoryonly, ".m3u8", sizeof(directoryonly)); | 73 | strlcat(directoryonly, ".m3u8", sizeof(directoryonly)); |
74 | strmemccpy(temp, directoryonly, sizeof(temp)); | ||
75 | } | 75 | } |
76 | else | 76 | else |
77 | strlcat(directoryonly, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(directoryonly)); | 77 | create_numbered_filename(temp, directoryonly, PLAYLIST_UNTITLED_PREFIX, ".m3u8", |
78 | 78 | 1 IF_CNFN_NUM_(, NULL)); | |
79 | strmemccpy(temp, directoryonly, sizeof(temp)); | ||
80 | } | 79 | } |
81 | 80 | ||
82 | if (catalog_pick_new_playlist_name(temp, sizeof(temp), | 81 | if (catalog_pick_new_playlist_name(temp, sizeof(temp), |
diff --git a/apps/playlist.h b/apps/playlist.h index 0dc5148acd..c7b672a2ef 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #define PLAYLIST_DISPLAY_COUNT 10 | 37 | #define PLAYLIST_DISPLAY_COUNT 10 |
38 | 38 | ||
39 | #define DEFAULT_DYNAMIC_PLAYLIST_NAME "/dynamic.m3u8" | 39 | #define PLAYLIST_UNTITLED_PREFIX "Playlist " |
40 | 40 | ||
41 | #define PLAYLIST_FLAG_MODIFIED (1u << 0) /* playlist was manually modified */ | 41 | #define PLAYLIST_FLAG_MODIFIED (1u << 0) /* playlist was manually modified */ |
42 | #define PLAYLIST_FLAG_DIRPLAY (1u << 1) /* enable directory skipping */ | 42 | #define PLAYLIST_FLAG_DIRPLAY (1u << 1) /* enable directory skipping */ |
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 0cf9d2e09d..1bd4b7ee13 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "playlist_viewer.h" | 47 | #include "playlist_viewer.h" |
48 | #include "bookmark.h" | 48 | #include "bookmark.h" |
49 | #include "root_menu.h" | 49 | #include "root_menu.h" |
50 | #include "general.h" | ||
50 | 51 | ||
51 | /* Use for recursive directory search */ | 52 | /* Use for recursive directory search */ |
52 | struct add_track_context { | 53 | struct add_track_context { |
@@ -464,14 +465,16 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr, | |||
464 | name = strrchr(sel, '/'); | 465 | name = strrchr(sel, '/'); |
465 | 466 | ||
466 | if (name == NULL || ((sel_attr & ATTR_DIRECTORY) != ATTR_DIRECTORY)) | 467 | if (name == NULL || ((sel_attr & ATTR_DIRECTORY) != ATTR_DIRECTORY)) |
467 | name = "/"; | 468 | create_numbered_filename(playlist, playlist, PLAYLIST_UNTITLED_PREFIX, |
468 | 469 | ".m3u8", 1 IF_CNFN_NUM_(, NULL)); | |
469 | strlcat(playlist, name, sizeof(playlist)); | 470 | else |
471 | { | ||
472 | strlcat(playlist, name, sizeof(playlist)); | ||
473 | apply_playlist_extension(playlist, sizeof(playlist)); | ||
474 | } | ||
470 | } | 475 | } |
471 | else | 476 | else |
472 | strmemccpy(playlist, m3u8name, MAX_PATH); | 477 | strmemccpy(playlist, m3u8name, sizeof(playlist)); |
473 | |||
474 | apply_playlist_extension(playlist, sizeof(playlist)); | ||
475 | 478 | ||
476 | if (!catalog_pick_new_playlist_name(playlist, sizeof(playlist), NULL)) | 479 | if (!catalog_pick_new_playlist_name(playlist, sizeof(playlist), NULL)) |
477 | return false; | 480 | return false; |
diff --git a/apps/playlist_catalog.h b/apps/playlist_catalog.h index 756a1e1129..f455ef7ebc 100644 --- a/apps/playlist_catalog.h +++ b/apps/playlist_catalog.h | |||
@@ -43,7 +43,7 @@ bool catalog_pick_new_playlist_name(char *pl_name, size_t buf_size, | |||
43 | * sel_attr : the attributes that tell what type of file we're adding | 43 | * sel_attr : the attributes that tell what type of file we're adding |
44 | * new_playlist : whether we want to create a new playlist or add to an | 44 | * new_playlist : whether we want to create a new playlist or add to an |
45 | * existing one. | 45 | * existing one. |
46 | * m3u8name : filename to save the playlist to, NULL to show the keyboard | 46 | * m3u8name : NULL, or filename to show in keyboard picker (include the extension!) |
47 | * add_to_pl_cb : can be NULL, or a function responsible for handling the | 47 | * add_to_pl_cb : can be NULL, or a function responsible for handling the |
48 | * insert operations itself, in case the caller wants full | 48 | * insert operations itself, in case the caller wants full |
49 | * control over how and what files are actually added. | 49 | * control over how and what files are actually added. |