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
diff --git a/apps/playback.c b/apps/playback.c
index 5ee5166..c4b8666 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1586,8 +1586,6 @@ static void audio_check_new_track(void)
     track_count = audio_track_count();
     old_track_ridx = track_ridx;

-    /* Now it's good time to send track finish events. */
-    send_event(PLAYBACK_EVENT_TRACK_FINISH, thistrack_id3);
     /* swap the mp3entry pointers */
     temp = thistrack_id3;
     thistrack_id3 = othertrack_id3;
@@ -1777,6 +1775,8 @@ static void audio_stop_codec_flush(void)

 static void audio_stop_playback(void)
 {
+    automatic_skip = false;
+
     if (playing)
     {
         /* If we were playing, save resume information */
@@ -1791,8 +1791,7 @@ static void audio_stop_playback(void)
         /* Now it's good time to send track finish events.  Do this
            only if this hasn't been done already as part of a track
            switch. */
-        if (id3 == thistrack_id3)
-            send_event(PLAYBACK_EVENT_TRACK_FINISH, thistrack_id3);
+        send_event(PLAYBACK_EVENT_TRACK_FINISH, thistrack_id3);

         /* TODO: Create auto bookmark too? */

@@ -1929,6 +1928,9 @@ static void audio_finalise_track_change(void)
 {
     logf("audio_finalise_track_change");

+    /* Now it's good time to send track finish events. */
+    send_event(PLAYBACK_EVENT_TRACK_FINISH, othertrack_id3);
+
     if (automatic_skip)
     {
         wps_offset = 0;
@@ -2176,14 +2178,6 @@ static void audio_thread(void)
                     break;
                 }

-                if ((long)ev.data == 0)
-                {
-                    /* About to restart the track - send track finish
-                       events if not already done. */
-                    if (thistrack_id3 == audio_current_track())
-                        send_event(PLAYBACK_EVENT_TRACK_FINISH, thistrack_id3);
-                }
-
                 if (automatic_skip)
                 {
                     /* An automatic track skip is in progress. Finalize it,