summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 4457de853a..9c494778a3 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -347,7 +347,7 @@ static void create_control(struct playlist_info* playlist)
347 if (check_rockboxdir()) 347 if (check_rockboxdir())
348 { 348 {
349 cond_talk_ids_fq(LANG_PLAYLIST_CONTROL_ACCESS_ERROR); 349 cond_talk_ids_fq(LANG_PLAYLIST_CONTROL_ACCESS_ERROR);
350 gui_syncsplash(HZ*2, (unsigned char *)"%s (%d)", 350 splashf(HZ*2, (unsigned char *)"%s (%d)",
351 str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), 351 str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR),
352 playlist->control_fd); 352 playlist->control_fd);
353 } 353 }
@@ -536,7 +536,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
536 if((i = lseek(playlist->fd, 0, SEEK_CUR)) > 0) 536 if((i = lseek(playlist->fd, 0, SEEK_CUR)) > 0)
537 playlist->utf8 = true; /* Override any earlier indication. */ 537 playlist->utf8 = true; /* Override any earlier indication. */
538 538
539 gui_syncsplash(0, ID2P(LANG_WAIT)); 539 splash(0, ID2P(LANG_WAIT));
540 540
541 if (!buffer) 541 if (!buffer)
542 { 542 {
@@ -1426,9 +1426,9 @@ static int get_filename(struct playlist_info* playlist, int index, int seek,
1426 if (max < 0) 1426 if (max < 0)
1427 { 1427 {
1428 if (control_file) 1428 if (control_file)
1429 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 1429 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
1430 else 1430 else
1431 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); 1431 splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR));
1432 1432
1433 return max; 1433 return max;
1434 } 1434 }
@@ -1523,7 +1523,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
1523 1523
1524 if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0) 1524 if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0)
1525 { 1525 {
1526 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); 1526 splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
1527 exit = true; 1527 exit = true;
1528 result = -1; 1528 result = -1;
1529 break; 1529 break;
@@ -1604,7 +1604,7 @@ static int check_subdir_for_music(char *dir, char *subdir, bool recurse)
1604 1604
1605 if (ft_load(tc, dir) < 0) 1605 if (ft_load(tc, dir) < 0)
1606 { 1606 {
1607 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); 1607 splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
1608 return -2; 1608 return -2;
1609 } 1609 }
1610 1610
@@ -1657,8 +1657,7 @@ static int check_subdir_for_music(char *dir, char *subdir, bool recurse)
1657 1657
1658 /* we now need to reload our current directory */ 1658 /* we now need to reload our current directory */
1659 if(ft_load(tc, dir) < 0) 1659 if(ft_load(tc, dir) < 0)
1660 gui_syncsplash(HZ*2, 1660 splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
1661 ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
1662 } 1661 }
1663 return result; 1662 return result;
1664} 1663}
@@ -1747,7 +1746,7 @@ static void display_playlist_count(int count, const unsigned char *fmt,
1747 } 1746 }
1748 fmt = P2STR(fmt); 1747 fmt = P2STR(fmt);
1749 1748
1750 gui_syncsplash(0, fmt, count, str(LANG_OFF_ABORT)); 1749 splashf(0, fmt, count, str(LANG_OFF_ABORT));
1751} 1750}
1752 1751
1753/* 1752/*
@@ -1755,7 +1754,7 @@ static void display_playlist_count(int count, const unsigned char *fmt,
1755 */ 1754 */
1756static void display_buffer_full(void) 1755static void display_buffer_full(void)
1757{ 1756{
1758 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_BUFFER_FULL)); 1757 splash(HZ*2, ID2P(LANG_PLAYLIST_BUFFER_FULL));
1759} 1758}
1760 1759
1761/* 1760/*
@@ -1834,7 +1833,7 @@ static int flush_cached_control(struct playlist_info* playlist)
1834 else 1833 else
1835 { 1834 {
1836 result = -1; 1835 result = -1;
1837 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); 1836 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
1838 } 1837 }
1839 1838
1840 return result; 1839 return result;
@@ -2021,11 +2020,11 @@ int playlist_resume(void)
2021 2020
2022 empty_playlist(playlist, true); 2021 empty_playlist(playlist, true);
2023 2022
2024 gui_syncsplash(0, ID2P(LANG_WAIT)); 2023 splash(0, ID2P(LANG_WAIT));
2025 playlist->control_fd = open(playlist->control_filename, O_RDWR); 2024 playlist->control_fd = open(playlist->control_filename, O_RDWR);
2026 if (playlist->control_fd < 0) 2025 if (playlist->control_fd < 0)
2027 { 2026 {
2028 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 2027 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
2029 return -1; 2028 return -1;
2030 } 2029 }
2031 playlist->control_created = true; 2030 playlist->control_created = true;
@@ -2033,7 +2032,7 @@ int playlist_resume(void)
2033 control_file_size = filesize(playlist->control_fd); 2032 control_file_size = filesize(playlist->control_fd);
2034 if (control_file_size <= 0) 2033 if (control_file_size <= 0)
2035 { 2034 {
2036 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 2035 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
2037 return -1; 2036 return -1;
2038 } 2037 }
2039 2038
@@ -2042,7 +2041,7 @@ int playlist_resume(void)
2042 PLAYLIST_COMMAND_SIZE<buflen?PLAYLIST_COMMAND_SIZE:buflen); 2041 PLAYLIST_COMMAND_SIZE<buflen?PLAYLIST_COMMAND_SIZE:buflen);
2043 if(nread <= 0) 2042 if(nread <= 0)
2044 { 2043 {
2045 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 2044 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
2046 return -1; 2045 return -1;
2047 } 2046 }
2048 2047
@@ -2069,9 +2068,9 @@ int playlist_resume(void)
2069 /* So a splash while we are loading. */ 2068 /* So a splash while we are loading. */
2070 if (current_tick - last_tick > HZ/4) 2069 if (current_tick - last_tick > HZ/4)
2071 { 2070 {
2072 gui_syncsplash(0, str(LANG_LOADING_PERCENT), 2071 splashf(0, str(LANG_LOADING_PERCENT),
2073 (total_read+count)*100/control_file_size, 2072 (total_read+count)*100/control_file_size,
2074 str(LANG_OFF_ABORT)); 2073 str(LANG_OFF_ABORT));
2075 if (action_userabort(TIMEOUT_NOBLOCK)) 2074 if (action_userabort(TIMEOUT_NOBLOCK))
2076 { 2075 {
2077 useraborted = true; 2076 useraborted = true;
@@ -2337,13 +2336,13 @@ int playlist_resume(void)
2337 2336
2338 if (result < 0) 2337 if (result < 0)
2339 { 2338 {
2340 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID)); 2339 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID));
2341 return result; 2340 return result;
2342 } 2341 }
2343 2342
2344 if (useraborted) 2343 if (useraborted)
2345 { 2344 {
2346 gui_syncsplash(HZ*2, ID2P(LANG_CANCEL)); 2345 splash(HZ*2, ID2P(LANG_CANCEL));
2347 return -1; 2346 return -1;
2348 } 2347 }
2349 if (!newline || (exit_loop && count<nread)) 2348 if (!newline || (exit_loop && count<nread))
@@ -2351,7 +2350,7 @@ int playlist_resume(void)
2351 if ((total_read + count) >= control_file_size) 2350 if ((total_read + count) >= control_file_size)
2352 { 2351 {
2353 /* no newline at end of control file */ 2352 /* no newline at end of control file */
2354 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID)); 2353 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID));
2355 return -1; 2354 return -1;
2356 } 2355 }
2357 2356
@@ -2861,7 +2860,7 @@ int playlist_insert_track(struct playlist_info* playlist, const char *filename,
2861 2860
2862 if (check_control(playlist) < 0) 2861 if (check_control(playlist) < 0)
2863 { 2862 {
2864 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 2863 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
2865 return -1; 2864 return -1;
2866 } 2865 }
2867 2866
@@ -2892,7 +2891,7 @@ int playlist_insert_directory(struct playlist_info* playlist,
2892 2891
2893 if (check_control(playlist) < 0) 2892 if (check_control(playlist) < 0)
2894 { 2893 {
2895 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 2894 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
2896 return -1; 2895 return -1;
2897 } 2896 }
2898 2897
@@ -2959,14 +2958,14 @@ int playlist_insert_playlist(struct playlist_info* playlist, const char *filenam
2959 2958
2960 if (check_control(playlist) < 0) 2959 if (check_control(playlist) < 0)
2961 { 2960 {
2962 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 2961 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
2963 return -1; 2962 return -1;
2964 } 2963 }
2965 2964
2966 fd = open_utf8(filename, O_RDONLY); 2965 fd = open_utf8(filename, O_RDONLY);
2967 if (fd < 0) 2966 if (fd < 0)
2968 { 2967 {
2969 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); 2968 splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR));
2970 return -1; 2969 return -1;
2971 } 2970 }
2972 2971
@@ -3087,7 +3086,7 @@ int playlist_delete(struct playlist_info* playlist, int index)
3087 3086
3088 if (check_control(playlist) < 0) 3087 if (check_control(playlist) < 0)
3089 { 3088 {
3090 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 3089 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
3091 return -1; 3090 return -1;
3092 } 3091 }
3093 3092
@@ -3122,7 +3121,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
3122 3121
3123 if (check_control(playlist) < 0) 3122 if (check_control(playlist) < 0)
3124 { 3123 {
3125 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); 3124 splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR));
3126 return -1; 3125 return -1;
3127 } 3126 }
3128 3127
@@ -3385,7 +3384,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
3385 if (playlist->buffer_size < (int)(playlist->amount * sizeof(int))) 3384 if (playlist->buffer_size < (int)(playlist->amount * sizeof(int)))
3386 { 3385 {
3387 /* not enough buffer space to store updated indices */ 3386 /* not enough buffer space to store updated indices */
3388 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); 3387 splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR));
3389 return -1; 3388 return -1;
3390 } 3389 }
3391 3390
@@ -3409,7 +3408,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
3409 } 3408 }
3410 if (fd < 0) 3409 if (fd < 0)
3411 { 3410 {
3412 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); 3411 splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR));
3413 return -1; 3412 return -1;
3414 } 3413 }
3415 3414
@@ -3450,7 +3449,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
3450 3449
3451 if (fdprintf(fd, "%s\n", tmp_buf) < 0) 3450 if (fdprintf(fd, "%s\n", tmp_buf) < 0)
3452 { 3451 {
3453 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); 3452 splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR));
3454 result = -1; 3453 result = -1;
3455 break; 3454 break;
3456 } 3455 }
@@ -3538,7 +3537,7 @@ int playlist_directory_tracksearch(const char* dirname, bool recurse,
3538 3537
3539 if (ft_load(tc, dirname) < 0) 3538 if (ft_load(tc, dirname) < 0)
3540 { 3539 {
3541 gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); 3540 splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR));
3542 *(tc->dirfilter) = old_dirfilter; 3541 *(tc->dirfilter) = old_dirfilter;
3543 return -1; 3542 return -1;
3544 } 3543 }