summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 694caab3c0..9a132e02f8 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -582,7 +582,6 @@ static int add_track_to_playlist(struct playlist_info* playlist,
582#ifdef HAVE_DIRCACHE 582#ifdef HAVE_DIRCACHE
583 if (playlist->filenames) 583 if (playlist->filenames)
584 playlist->filenames[insert_position] = NULL; 584 playlist->filenames[insert_position] = NULL;
585 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
586#endif 585#endif
587 586
588 playlist->amount++; 587 playlist->amount++;
@@ -917,22 +916,15 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps)
917 int index; 916 int index;
918 int stepped_count = 0; 917 int stepped_count = 0;
919 918
919 count = steps;
920 if (steps < 0) 920 if (steps < 0)
921 {
922 direction = -1; 921 direction = -1;
923 count = -steps;
924 }
925 else 922 else
926 {
927 direction = 1; 923 direction = 1;
928 count = steps;
929 }
930 924
931 index = playlist->index; 925 index = playlist->index;
932 i = 0; 926 i = 0;
933 while (i < count) 927 do {
934 {
935 index += direction;
936 /* Boundary check */ 928 /* Boundary check */
937 if (index < 0) 929 if (index < 0)
938 index += playlist->amount; 930 index += playlist->amount;
@@ -949,7 +941,9 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps)
949 } 941 }
950 else 942 else
951 i++; 943 i++;
952 } 944
945 index += direction;
946 } while (i < count);
953 947
954 return steps; 948 return steps;
955} 949}
@@ -1693,6 +1687,7 @@ int playlist_resume(void)
1693 1687
1694 empty_playlist(playlist, true); 1688 empty_playlist(playlist, true);
1695 1689
1690 gui_syncsplash(0, true, str(LANG_WAIT));
1696 playlist->control_fd = open(playlist->control_filename, O_RDWR); 1691 playlist->control_fd = open(playlist->control_filename, O_RDWR);
1697 if (playlist->control_fd < 0) 1692 if (playlist->control_fd < 0)
1698 { 1693 {
@@ -1810,7 +1805,7 @@ int playlist_resume(void)
1810 buffer */ 1805 buffer */
1811 if (add_track_to_playlist(playlist, str3, position, 1806 if (add_track_to_playlist(playlist, str3, position,
1812 queue, total_read+(str3-buffer)) < 0) 1807 queue, total_read+(str3-buffer)) < 0)
1813 return -1; 1808 return -1;
1814 1809
1815 playlist->last_insert_pos = last_position; 1810 playlist->last_insert_pos = last_position;
1816 1811
@@ -2041,6 +2036,10 @@ int playlist_resume(void)
2041 } 2036 }
2042 } 2037 }
2043 2038
2039#ifdef HAVE_DIRCACHE
2040 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2041#endif
2042
2044 return 0; 2043 return 0;
2045} 2044}
2046 2045
@@ -2582,6 +2581,10 @@ int playlist_insert_track(struct playlist_info* playlist,
2582 audio_flush_and_reload_tracks(); 2581 audio_flush_and_reload_tracks();
2583 } 2582 }
2584 2583
2584#ifdef HAVE_DIRCACHE
2585 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2586#endif
2587
2585 return result; 2588 return result;
2586} 2589}
2587 2590
@@ -2624,6 +2627,10 @@ int playlist_insert_directory(struct playlist_info* playlist,
2624 if (audio_status() & AUDIO_STATUS_PLAY) 2627 if (audio_status() & AUDIO_STATUS_PLAY)
2625 audio_flush_and_reload_tracks(); 2628 audio_flush_and_reload_tracks();
2626 2629
2630#ifdef HAVE_DIRCACHE
2631 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2632#endif
2633
2627 return result; 2634 return result;
2628} 2635}
2629 2636
@@ -2738,6 +2745,10 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
2738 if (audio_status() & AUDIO_STATUS_PLAY) 2745 if (audio_status() & AUDIO_STATUS_PLAY)
2739 audio_flush_and_reload_tracks(); 2746 audio_flush_and_reload_tracks();
2740 2747
2748#ifdef HAVE_DIRCACHE
2749 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2750#endif
2751
2741 return result; 2752 return result;
2742} 2753}
2743 2754
@@ -2860,6 +2871,10 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
2860 } 2871 }
2861 } 2872 }
2862 2873
2874#ifdef HAVE_DIRCACHE
2875 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
2876#endif
2877
2863 return result; 2878 return result;
2864} 2879}
2865 2880