diff --git a/src/Core/UI/Queue/ContextMenu.elm b/src/Core/UI/Queue/ContextMenu.elm index 91f3c3d1..12cd3333 100644 --- a/src/Core/UI/Queue/ContextMenu.elm +++ b/src/Core/UI/Queue/ContextMenu.elm @@ -63,7 +63,7 @@ futureNavigationMenu { manualEntries } = [ [ Item { icon = Icons.not_interested , label = "Reset ignored" - , msg = QueueMsg Queue.Reset + , msg = QueueMsg Queue.ResetIgnored -- , active = False diff --git a/src/Core/UI/Queue/Fill.elm b/src/Core/UI/Queue/Fill.elm index f30ed596..6fb44e6b 100644 --- a/src/Core/UI/Queue/Fill.elm +++ b/src/Core/UI/Queue/Fill.elm @@ -94,32 +94,41 @@ ordered _ unfilteredTracks state = shuffled : Time.Posix -> List IdentifiedTrack -> State -> List Item -shuffled timestamp unfilteredTracks s = +shuffled timestamp unfilteredTracks state = let - state = - if List.isEmpty s.future && not (List.isEmpty s.past) then - -- We played every available track, - -- disregard the past tracks. - { s | past = [] } - - else - s - - idsToIgnore = + idsToIgnoreWithoutPast = [ state.ignored - , state.past - , state.future , Maybe.unwrap [] List.singleton state.activeItem ] |> List.map (List.map itemTrackId) |> List.concat |> List.unique + ( tracksWithPast, idsToIgnoreWithoutPastAfterFilter ) = + purifier unfilteredTracks ( [], idsToIgnoreWithoutPast ) + + idsToIgnoreWithPast = + List.unique (idsToIgnoreWithoutPastAfterFilter ++ List.map itemTrackId state.past) + + ( tracksWithoutPast, idsToIgnoreWithPastAfterFilter ) = + purifier tracksWithPast ( [], idsToIgnoreWithPast ) + + idsToIgnoreWithFuture = + List.unique (idsToIgnoreWithoutPastAfterFilter ++ List.map itemTrackId state.future) + + ( tracksList, _ ) = + purifier + (case tracksWithoutPast of + [] -> + tracksWithPast + + t -> + t + ) + ( [], idsToIgnoreWithFuture ) + tracks = - ( [], idsToIgnore ) - |> purifier unfilteredTracks - |> Tuple.first - |> Array.fromList + Array.fromList tracksList amountOfTracks = Array.length tracks diff --git a/src/Core/UI/Queue/State.elm b/src/Core/UI/Queue/State.elm index c38c619f..2dc2f7ed 100644 --- a/src/Core/UI/Queue/State.elm +++ b/src/Core/UI/Queue/State.elm @@ -36,6 +36,9 @@ update msg = Reset -> reset + ResetIgnored -> + resetIgnored + Rewind -> rewind @@ -128,7 +131,7 @@ changeActiveItem maybeItem model = clear : Manager clear model = - fill { model | playingNext = [], dontPlay = [] } + fill { model | playingNext = [] } fill : Manager @@ -286,10 +289,15 @@ reset : Manager reset model = model.playingNext |> List.filter (.manualEntry >> (==) True) - |> (\f -> { model | playingNext = f, dontPlay = [] }) + |> (\f -> { model | playingNext = f }) |> fill +resetIgnored : Manager +resetIgnored model = + fill { model | dontPlay = [] } + + select : Item -> Manager select item model = Return.singleton { model | selectedQueueItem = Just item } diff --git a/src/Core/UI/Queue/Types.elm b/src/Core/UI/Queue/Types.elm index c5a35260..9cc99e02 100644 --- a/src/Core/UI/Queue/Types.elm +++ b/src/Core/UI/Queue/Types.elm @@ -13,6 +13,7 @@ type Msg = Clear | PreloadNext | Reset + | ResetIgnored | Rewind | Select Item | Shift