summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/filetree.c21
-rw-r--r--apps/playlist.c9
2 files changed, 26 insertions, 4 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 107163add5..2d4416df5a 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -72,6 +72,7 @@ static int strnatcasecmp_n(const char *a, const char *b, size_t n)
72int ft_build_playlist(struct tree_context* c, int start_index) 72int ft_build_playlist(struct tree_context* c, int start_index)
73{ 73{
74 int i; 74 int i;
75 int res = 0;
75 int start=start_index; 76 int start=start_index;
76 77
77 tree_lock_cache(c); 78 tree_lock_cache(c);
@@ -81,7 +82,8 @@ int ft_build_playlist(struct tree_context* c, int start_index)
81 { 82 {
82 if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) 83 if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO)
83 { 84 {
84 if (playlist_add(entries[i].name) < 0) 85 res = playlist_add(entries[i].name);
86 if (res < 0)
85 break; 87 break;
86 } 88 }
87 else 89 else
@@ -92,7 +94,22 @@ int ft_build_playlist(struct tree_context* c, int start_index)
92 } 94 }
93 } 95 }
94 96
95 tree_unlock_cache(c); 97 if (res == -2) /* name buffer is full store to disk? */
98 {
99 if (yesno_pop(ID2P(LANG_CATALOG_ADD_TO_NEW)))
100 {
101 char playlist_dir[MAX_PATH];
102 strmemccpy(playlist_dir, c->currdir, sizeof(playlist_dir));
103 tree_unlock_cache(c);
104 if (playlist_create(playlist_dir, "dynamic.m3u8") >= 0)
105 {
106 playlist_insert_directory(NULL, playlist_dir,
107 PLAYLIST_REPLACE, false, false);
108 }
109 }
110 }
111 else
112 tree_unlock_cache(c);
96 113
97 return start_index; 114 return start_index;
98} 115}
diff --git a/apps/playlist.c b/apps/playlist.c
index b349799269..4e4e3ed42a 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2082,8 +2082,13 @@ int playlist_add(const char *filename)
2082 struct playlist_info* playlist = &current_playlist; 2082 struct playlist_info* playlist = &current_playlist;
2083 int len = strlen(filename); 2083 int len = strlen(filename);
2084 2084
2085 if((len+1 > playlist->buffer_size - playlist->buffer_end_pos) || 2085 if(len+1 > playlist->buffer_size - playlist->buffer_end_pos)
2086 (playlist->amount >= playlist->max_playlist_size)) 2086 {
2087 notify_buffer_full();
2088 return -2;
2089 }
2090
2091 if(playlist->amount >= playlist->max_playlist_size)
2087 { 2092 {
2088 notify_buffer_full(); 2093 notify_buffer_full();
2089 return -1; 2094 return -1;