summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 14ebb7a198..d17bf230a5 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -822,9 +822,6 @@ static int add_track_to_playlist(struct playlist_info* playlist,
822 playlist->amount++; 822 playlist->amount++;
823 playlist->num_inserted_tracks++; 823 playlist->num_inserted_tracks++;
824 824
825 /* Update index for resume. */
826 playlist_update_resume_index();
827
828 return insert_position; 825 return insert_position;
829} 826}
830 827
@@ -925,9 +922,6 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
925 sync_control(playlist, false); 922 sync_control(playlist, false);
926 } 923 }
927 924
928 /* Update index for resume. */
929 playlist_update_resume_index();
930
931 return 0; 925 return 0;
932} 926}
933 927
@@ -987,9 +981,6 @@ static int randomise_playlist(struct playlist_info* playlist,
987 playlist->first_index, NULL, NULL, NULL); 981 playlist->first_index, NULL, NULL, NULL);
988 } 982 }
989 983
990 /* Update index for resume. */
991 playlist_update_resume_index();
992
993 return 0; 984 return 0;
994} 985}
995 986
@@ -1030,9 +1021,6 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current,
1030 playlist->first_index, -1, NULL, NULL, NULL); 1021 playlist->first_index, -1, NULL, NULL, NULL);
1031 } 1022 }
1032 1023
1033 /* Update index for resume. */
1034 playlist_update_resume_index();
1035
1036 return 0; 1024 return 0;
1037} 1025}
1038 1026
@@ -1205,9 +1193,6 @@ static void find_and_set_playlist_index(struct playlist_info* playlist,
1205 break; 1193 break;
1206 } 1194 }
1207 } 1195 }
1208
1209 /* Update index for resume. */
1210 playlist_update_resume_index();
1211} 1196}
1212 1197
1213/* 1198/*
@@ -2486,6 +2471,12 @@ const char* playlist_peek(int steps, char* buf, size_t buf_size)
2486 if (index < 0) 2471 if (index < 0)
2487 return NULL; 2472 return NULL;
2488 2473
2474#if CONFIG_CODEC == SWCODEC
2475 /* Just testing - don't care about the file name */
2476 if (!buf || !buf_size)
2477 return "";
2478#endif
2479
2489 control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK; 2480 control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK;
2490 seek = playlist->indices[index] & PLAYLIST_SEEK_MASK; 2481 seek = playlist->indices[index] & PLAYLIST_SEEK_MASK;
2491 2482
@@ -2632,30 +2623,17 @@ int playlist_get_resume_info(int *resume_index)
2632 return 0; 2623 return 0;
2633} 2624}
2634 2625
2635/* Get current playlist index. */
2636int playlist_get_index(void)
2637{
2638 return current_playlist.index;
2639}
2640
2641/* Update resume index within playlist_info structure. */
2642void playlist_update_resume_index(void)
2643{
2644 struct playlist_info* playlist = &current_playlist;
2645 playlist->resume_index = playlist->index;
2646}
2647
2648/* Update resume info for current playing song. Returns -1 on error. */ 2626/* Update resume info for current playing song. Returns -1 on error. */
2649int playlist_update_resume_info(const struct mp3entry* id3) 2627int playlist_update_resume_info(const struct mp3entry* id3)
2650{ 2628{
2651 struct playlist_info* playlist = &current_playlist; 2629 struct playlist_info* playlist = &current_playlist;
2652 2630
2653 if (id3) 2631 if (id3)
2654 { 2632 {
2655 if (global_status.resume_index != playlist->resume_index || 2633 if (global_status.resume_index != playlist->index ||
2656 global_status.resume_offset != id3->offset) 2634 global_status.resume_offset != id3->offset)
2657 { 2635 {
2658 global_status.resume_index = playlist->resume_index; 2636 global_status.resume_index = playlist->index;
2659 global_status.resume_offset = id3->offset; 2637 global_status.resume_offset = id3->offset;
2660 status_save(); 2638 status_save();
2661 } 2639 }
@@ -3203,9 +3181,6 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
3203 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); 3181 queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
3204#endif 3182#endif
3205 3183
3206 /* Update index for resume. */
3207 playlist_update_resume_index();
3208
3209 return result; 3184 return result;
3210} 3185}
3211 3186