diff options
Diffstat (limited to 'apps/playlist.c')
-rw-r--r-- | apps/playlist.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 70637b39a2..d23f3ec0d1 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -2519,6 +2519,7 @@ bool playlist_entries_iterate(const char *filename, | |||
2519 | bool ret = false; | 2519 | bool ret = false; |
2520 | int max; | 2520 | int max; |
2521 | char *dir; | 2521 | char *dir; |
2522 | off_t filesize; | ||
2522 | 2523 | ||
2523 | char temp_buf[MAX_PATH+1]; | 2524 | char temp_buf[MAX_PATH+1]; |
2524 | char trackname[MAX_PATH+1]; | 2525 | char trackname[MAX_PATH+1]; |
@@ -2533,14 +2534,16 @@ bool playlist_entries_iterate(const char *filename, | |||
2533 | notify_access_error(); | 2534 | notify_access_error(); |
2534 | goto out; | 2535 | goto out; |
2535 | } | 2536 | } |
2536 | 2537 | off_t start = lseek(fd, 0, SEEK_CUR); | |
2538 | filesize = lseek(fd, 0, SEEK_END); | ||
2539 | lseek(fd, start, SEEK_SET); | ||
2537 | /* we need the directory name for formatting purposes */ | 2540 | /* we need the directory name for formatting purposes */ |
2538 | size_t dirlen = path_dirname(filename, (const char **)&dir); | 2541 | size_t dirlen = path_dirname(filename, (const char **)&dir); |
2539 | //dir = strmemdupa(dir, dirlen); | 2542 | //dir = strmemdupa(dir, dirlen); |
2540 | 2543 | ||
2541 | 2544 | ||
2542 | if (action_cb) | 2545 | if (action_cb) |
2543 | show_search_progress(true, 0); | 2546 | show_search_progress(true, 0, 0, 0); |
2544 | 2547 | ||
2545 | while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0) | 2548 | while ((max = read_line(fd, temp_buf, sizeof(temp_buf))) > 0) |
2546 | { | 2549 | { |
@@ -2561,17 +2564,17 @@ bool playlist_entries_iterate(const char *filename, | |||
2561 | 2564 | ||
2562 | /* we need to format so that relative paths are correctly | 2565 | /* we need to format so that relative paths are correctly |
2563 | handled */ | 2566 | handled */ |
2564 | if (format_track_path(trackname, temp_buf, | 2567 | if ((max = format_track_path(trackname, temp_buf, |
2565 | sizeof(trackname), dir, dirlen) < 0) | 2568 | sizeof(trackname), dir, dirlen)) < 0) |
2566 | { | 2569 | { |
2567 | goto out; | 2570 | goto out; |
2568 | } | 2571 | } |
2569 | 2572 | start += max; | |
2570 | if (action_cb) | 2573 | if (action_cb) |
2571 | { | 2574 | { |
2572 | if (!action_cb(trackname)) | 2575 | if (!action_cb(trackname)) |
2573 | goto out; | 2576 | goto out; |
2574 | else if (!show_search_progress(false, i)) | 2577 | else if (!show_search_progress(false, i, start, filesize)) |
2575 | break; | 2578 | break; |
2576 | } | 2579 | } |
2577 | else if (playlist_insert_context_add(pl_context, trackname) < 0) | 2580 | else if (playlist_insert_context_add(pl_context, trackname) < 0) |