A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixes #16

+20 -10
+1 -1
src/App/State.elm
··· 174 174 -- Identify 175 175 , maybeQueueItem 176 176 |> Maybe.map .track 177 - |> Tracks.Types.IdentifyActiveTrack 177 + |> Tracks.Types.SetActiveTrackId 178 178 |> TracksMsg 179 179 |> do 180 180 ]
+12 -4
src/App/Tracks/Collection/Internal.elm
··· 48 48 let 49 49 ( identifiedUnsorted, missingFavourites ) = 50 50 List.foldl 51 - (identifier model.favourites) 51 + (identifier model.favourites model.activeTrackId) 52 52 ( [], model.favourites ) 53 53 collection.untouched 54 54 in ··· 61 61 62 62 identifier : 63 63 List Favourite 64 + -> Maybe TrackId 64 65 -> Track 65 66 -> ( List IdentifiedTrack, List Favourite ) 66 67 -> ( List IdentifiedTrack, List Favourite ) 67 - identifier favourites track ( acc, missingFavourites ) = 68 + identifier favourites activeTrackId track ( acc, missingFavourites ) = 68 69 let 69 70 lartist = 70 71 String.toLower track.tags.artist 71 72 72 73 ltitle = 73 74 String.toLower track.tags.title 75 + 76 + isNowPlaying = 77 + Just track.id == activeTrackId 74 78 75 79 idx = 76 80 List.findIndex (Favourites.matcher lartist ltitle) missingFavourites 77 81 in 78 82 case idx of 83 + -- A favourite 84 + -- 79 85 Just i -> 80 86 ( acc 81 87 ++ [ ( { isFavourite = True 82 88 , isMissing = False 83 - , isNowPlaying = False 89 + , isNowPlaying = isNowPlaying 84 90 } 85 91 , track 86 92 ) ··· 88 94 , List.removeAt i missingFavourites 89 95 ) 90 96 97 + -- Not a favourite 98 + -- 91 99 Nothing -> 92 100 ( acc 93 101 ++ [ ( { isFavourite = False 94 102 , isMissing = False 95 - , isNowPlaying = False 103 + , isNowPlaying = isNowPlaying 96 104 } 97 105 , track 98 106 )
+4 -3
src/App/Tracks/State.elm
··· 22 22 23 23 initialModel : TopLevel.ProgramFlags -> Model 24 24 initialModel flags = 25 - { collection = emptyCollection 25 + { activeTrackId = Nothing 26 + , collection = emptyCollection 26 27 , enabledSourceIds = decodeEnabledSourceIds flags 27 28 , exposedStep = 1 28 29 , favourites = decodeFavourites (Maybe.withDefault [] flags.favourites) ··· 212 213 ------------------------------------ 213 214 -- Identify the active track 214 215 -- 215 - IdentifyActiveTrack maybeTrack -> 216 + SetActiveTrackId maybeTrack -> 216 217 let 217 218 mapFn = 218 219 case maybeTrack of ··· 222 223 Nothing -> 223 224 \( i, t ) -> ( { i | isNowPlaying = False }, t ) 224 225 in 225 - model 226 + { model | activeTrackId = Maybe.map .id maybeTrack } 226 227 |> Collection.makeParcel 227 228 |> Collection.remap (List.map mapFn) 228 229 |> Collection.set
+3 -2
src/App/Tracks/Types.elm
··· 136 136 | ToggleFavourite String 137 137 | ToggleFavouritesOnly 138 138 -- UI 139 - | IdentifyActiveTrack (Maybe Track) 139 + | SetActiveTrackId (Maybe Track) 140 140 | ScrollThroughTable ScrollPos 141 141 | ScrollToActiveTrack Track 142 142 ··· 151 151 152 152 type alias InternalModel extension = 153 153 { extension 154 - | collection : Collection 154 + | activeTrackId : Maybe TrackId 155 + , collection : Collection 155 156 , enabledSourceIds : List SourceId 156 157 , exposedStep : Int 157 158 , favourites : List Favourite