Browse Source

Fixed issue with Faded always being first song played

Kristian Vos 4 years ago
parent
commit
09c065f6c8
1 changed files with 12 additions and 13 deletions
  1. 12 13
      backend/logic/stations.js

+ 12 - 13
backend/logic/stations.js

@@ -889,20 +889,19 @@ class StationsModule extends CoreClass {
                                             { bypassQueue: payload.bypassQueue }
                                         )
                                             .then((newPlaylist) => {
-                                                this.songs.getSong(
-                                                    newPlaylist[0],
-                                                    (err, song) => {
-                                                        if (err || !song)
-                                                            return next(
-                                                                null,
-                                                                this
-                                                                    .defaultSong,
-                                                                0
-                                                            );
+                                                this.songs
+                                                    .runJob("GET_SONG", { id: newPlaylist[0] })
+                                                    .then((response) => {
                                                         station.playlist = newPlaylist;
-                                                        next(null, song, 0);
-                                                    }
-                                                );
+                                                        next(null, response.song, 0);
+                                                    })
+                                                    .catch(err => {
+                                                        return next(
+                                                            null,
+                                                            this.defaultSong,
+                                                            0
+                                                        );
+                                                    });
                                             })
                                             .catch((err) => {
                                                 next(null, this.defaultSong, 0);