mirror of
https://github.com/yattee/yattee.git
synced 2024-12-24 22:43:41 +00:00
Restore last played item into queue only if it's not in there yet
This commit is contained in:
parent
d202ff8b40
commit
3f137be780
@ -198,8 +198,17 @@ extension PlayerModel {
|
||||
return
|
||||
}
|
||||
|
||||
queue = ([Defaults[.lastPlayed]] + Defaults[.queue]).compactMap { $0 }
|
||||
Defaults[.lastPlayed] = nil
|
||||
var restoredQueue = [PlayerQueueItem?]()
|
||||
|
||||
if let lastPlayed = Defaults[.lastPlayed],
|
||||
!Defaults[.queue].contains(where: { $0.videoID == lastPlayed.videoID })
|
||||
{
|
||||
restoredQueue.append(lastPlayed)
|
||||
Defaults[.lastPlayed] = nil
|
||||
}
|
||||
|
||||
restoredQueue.append(contentsOf: Defaults[.queue])
|
||||
queue = restoredQueue.compactMap { $0 }
|
||||
|
||||
queue.forEach { item in
|
||||
accounts.api.loadDetails(item) { newItem in
|
||||
|
Loading…
Reference in New Issue
Block a user