Commit 2358a551 authored by Agate's avatar Agate 💬

Will now play appended track automatically if end of queue was previously reached

parent 084dc8a4
...@@ -11,6 +11,7 @@ class Queue { ...@@ -11,6 +11,7 @@ class Queue {
this.tracks = [] this.tracks = []
this.currentIndex = -1 this.currentIndex = -1
this.currentTrack = null this.currentTrack = null
this.ended = true
this.state = { this.state = {
volume: cache.get('volume', 0.5) volume: cache.get('volume', 0.5)
} }
...@@ -98,8 +99,8 @@ class Queue { ...@@ -98,8 +99,8 @@ class Queue {
// we insert the track at given position // we insert the track at given position
this.tracks.splice(index, 0, track) this.tracks.splice(index, 0, track)
} }
if (this.currentIndex < 0) { if (this.ended) {
this.play(0) this.play(this.currentIndex + 1)
} }
this.cache() this.cache()
} }
...@@ -154,6 +155,7 @@ class Queue { ...@@ -154,6 +155,7 @@ class Queue {
} }
this.currentIndex = index this.currentIndex = index
this.currentTrack = this.tracks[index] this.currentTrack = this.tracks[index]
this.ended = false
let file = this.currentTrack.files[0] let file = this.currentTrack.files[0]
if (!file) { if (!file) {
return this.next() return this.next()
...@@ -178,6 +180,7 @@ class Queue { ...@@ -178,6 +180,7 @@ class Queue {
this.next() this.next()
} else { } else {
logger.default.info('We reached the end of the queue') logger.default.info('We reached the end of the queue')
this.ended = true
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment