1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Index: apps/playlist.c
===================================================================
--- apps/playlist.c  (revision 29679)
+++ apps/playlist.c  (working copy)
@@ -2612,24 +2612,28 @@
     return 0;
 }

+/* Get current playlist index. */
+int playlist_get_index(void)
+{
+    return current_playlist.index;
+}
+
 /* Update resume info for current playing song.  Returns -1 on error. */
 int playlist_update_resume_info(const struct mp3entry* id3)
 {
-    struct playlist_info* playlist = &current_playlist;
-
     if (id3)
     {
-        if (global_status.resume_index != playlist->index ||
+        if (global_status.resume_index  != id3->index ||
             global_status.resume_offset != id3->offset)
         {
-            global_status.resume_index = playlist->index;
+            global_status.resume_index  = id3->index;
             global_status.resume_offset = id3->offset;
             status_save();
         }
     }
     else
     {
-        global_status.resume_index = -1;
+        global_status.resume_index  = -1;
         global_status.resume_offset = -1;
         status_save();
     }
Index: apps/playlist.h
===================================================================
--- apps/playlist.h  (revision 29679)
+++ apps/playlist.h  (working copy)
@@ -131,6 +131,7 @@
 int playlist_next(int steps);
 bool playlist_next_dir(int direction);
 int playlist_get_resume_info(int *resume_index);
+int playlist_get_index(void);
 int playlist_update_resume_info(const struct mp3entry* id3);
 int playlist_get_display_index(void);
 int playlist_amount(void);
Index: apps/playback.c
===================================================================
--- apps/playback.c  (revision 29679)
+++ apps/playback.c  (working copy)
@@ -1632,7 +1632,7 @@
         audio_last_track(automatic_skip);
         return;
     }
-    
+
     if (new_playlist)
     {
         ci.new_track = 1;
@@ -1945,6 +1945,7 @@
         }
     }
     send_event(PLAYBACK_EVENT_TRACK_CHANGE, thistrack_id3);
+    thistrack_id3->index = playlist_get_index();
     playlist_update_resume_info(audio_current_track());
 }