···33import Base64
44import Conditional exposing (ifThenElse)
55import Dict
66-import List.Extra as List
76import Maybe.Extra as Maybe
87import Tracks exposing (..)
98
+15-22
src/Applications/UI/Tracks/Scene/Covers.elm
···666666 nowPlayingId =
667667 Maybe.unwrap "" (.identifiedTrack >> Tuple.second >> .id) nowPlaying
668668669669- album =
670670- cover.identifiedTrackCover
671671- |> Tuple.second
672672- |> .tags
673673- |> .album
674674-675669 missingTracks =
676676- List.any
677677- (Tuple.first >> .isMissing)
678678- cover.tracks
670670+ List.any
671671+ (Tuple.first >> .isMissing)
672672+ cover.tracks
679673680674 maybeBlobUrlFromCache =
681675 cachedCovers
···803797804798 missingTracks =
805799 List.any
806806- (Tuple.first >> .isMissing)
807807- cover.tracks
800800+ (Tuple.first >> .isMissing)
801801+ cover.tracks
808802 in
809803 brick
810804 (if clickable then
···831825 , "pt-px"
832826 , "truncate"
833827 ]
834834- [
835835- case sortBy of
836836- Album ->
828828+ [ case sortBy of
829829+ Album ->
837830 if missingTracks then
838838- text "Missing tracks"
831831+ text "Missing tracks"
839832840833 else
841841- text (Maybe.withDefault "Unknown album" track.tags.album)
834834+ text (Maybe.withDefault "Unknown album" track.tags.album)
842835843843- Artist ->
836836+ Artist ->
844837 if missingTracks then
845845- text "Missing tracks"
838838+ text "Missing tracks"
846839847840 else
848848- text (Maybe.withDefault "Unknown artist" track.tags.artist)
841841+ text (Maybe.withDefault "Unknown artist" track.tags.artist)
849842850850- _ ->
851851- nothing
843843+ _ ->
844844+ nothing
852845 ]
853846854847 --
···866859867860 else if not missingTracks && Maybe.isJust track.tags.artist then
868861 text (Maybe.withDefault "" track.tags.artist)
862862+869863 else
870864 case List.length cover.trackIds of
871865 1 ->
···873867874868 n ->
875869 text (String.fromInt n ++ " tracks")
876876-877870878871 Artist ->
879872 case List.length cover.trackIds of
+33-30
src/Library/Tracks.elm
···2233import Base64
44import List.Extra as List
55+import Maybe.Extra as Maybe
56import Playlists exposing (Playlist, PlaylistTrack)
67import String.Ext as String
78import Time
89import Time.Ext as Time
99-import Maybe.Extra as Maybe
101011111212···220220 , scrollContext = ""
221221 }
222222223223+223224{-| If a track doesn't fit into a group, where does it go?
224225-}
225226fallbackCoverGroup : String
226227fallbackCoverGroup =
227227- "MISSING_TRACK_INFO"
228228+ "MISSING_TRACK_INFO"
229229+228230229231{-| This value is used as a fallback in the UI if the album is missing.
230232-}
231233fallbackAlbum : String
232234fallbackAlbum =
233233- ""
235235+ ""
236236+234237235238{-| This value is used as a fallback in the UI if the artist is missing.
236239-}
237240fallbackArtist : String
238241fallbackArtist =
239239- ""
242242+ ""
243243+240244241245242246-- MORE STUFF
···245249coverGroup : SortBy -> IdentifiedTrack -> String
246250coverGroup sort ( identifiers, { tags } as track ) =
247251 if identifiers.isMissing then
248248- "MISSING_TRACKS"
252252+ "MISSING_TRACKS"
253253+249254 else
250250- (case sort of
251251- Artist ->
252252- Maybe.unwrap fallbackCoverGroup (String.trim >> String.toLower) tags.artist
255255+ case sort of
256256+ Artist ->
257257+ Maybe.unwrap fallbackCoverGroup (String.trim >> String.toLower) tags.artist
253258254254- Album ->
255255- -- There is the possibility of albums with the same name,
256256- -- such as "Greatests Hits".
257257- -- To make sure we treat those as different albums,
258258- -- we prefix the album by its parent directory.
259259+ Album ->
260260+ -- There is the possibility of albums with the same name,
261261+ -- such as "Greatests Hits".
262262+ -- To make sure we treat those as different albums,
263263+ -- we prefix the album by its parent directory.
264264+ case tags.album of
265265+ Just album ->
266266+ (identifiers.parentDirectory ++ album)
267267+ |> String.trim
268268+ |> String.toLower
259269260260- case tags.album of
261261- Just album ->
262262- (identifiers.parentDirectory ++ album)
263263- |> String.trim
264264- |> String.toLower
265265- Nothing ->
266266- fallbackCoverGroup
267267-268268- PlaylistIndex ->
269269- ""
270270+ Nothing ->
271271+ fallbackCoverGroup
270272271271- Title ->
272272- tags.title
273273- )
273273+ PlaylistIndex ->
274274+ ""
274275276276+ Title ->
277277+ tags.title
275278276279277280coverKey : Bool -> Track -> String
278281coverKey isVariousArtists { tags } =
279279- if isVariousArtists then
280280- Maybe.withDefault "?" tags.album
282282+ if isVariousArtists then
283283+ Maybe.withDefault "?" tags.album
281284282282- else
283283- Maybe.withDefault "?" tags.artist ++ " --- " ++ Maybe.withDefault "?" tags.album
285285+ else
286286+ Maybe.withDefault "?" tags.artist ++ " --- " ++ Maybe.withDefault "?" tags.album
284287285288286289isNowPlaying : IdentifiedTrack -> IdentifiedTrack -> Bool
···2233import Dict
44import List.Extra as List
55-import Maybe.Extra as Maybe
65import Time.Ext as Time
76import Tracks exposing (..)
88-import Tracks.Favourites as Favourites
97108119
+1-2
src/Library/Tracks/Favourites.elm
···2233import List.Extra as List
44import Maybe.Extra as Maybe
55-import Tracks exposing (Favourite, IdentifiedTrack, Track)
66-import Tracks exposing (fallbackArtist)
55+import Tracks exposing (Favourite, IdentifiedTrack, Track, fallbackArtist)
768798