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.

Improve Google Drive support

+73 -14
+1
CHANGELOG.md
··· 2 2 3 3 ## 2.2.1 4 4 5 + - Add support for Google Drive nested directories 5 6 - Fixes processing issues with Google Drive 6 7 - Fixes processing issues with WebDAV 7 8
+18 -12
src/Library/Sources/Services/Google.elm
··· 5 5 6 6 import Base64 7 7 import Common 8 + import Conditional exposing (..) 8 9 import Dict 9 10 import Dict.Ext as Dict 10 11 import Http ··· 14 15 import Sources.Processing exposing (..) 15 16 import Sources.Services.Google.Marker as Marker 16 17 import Sources.Services.Google.Parser as Parser 18 + import String.Path 17 19 import Time 18 20 import Url 19 21 ··· 188 190 folderId = 189 191 Dict.fetch "folderId" "" srcData 190 192 193 + parentId = 194 + marker 195 + |> Marker.takeOne 196 + |> Maybe.map Marker.itemDirectory 197 + |> Maybe.andThen (\dir -> ifThenElse (String.isEmpty dir) Nothing <| Just dir) 198 + |> Maybe.withDefault folderId 199 + |> String.Path.file 200 + 191 201 query = 192 - case String.trim folderId of 202 + case parentId of 193 203 "" -> 194 204 [ "mimeType contains 'audio/'" ] 195 205 196 - fid -> 197 - let 198 - parentId = 199 - marker 200 - |> Marker.takeOne 201 - |> Maybe.withDefault (Marker.Directory fid) 202 - |> Marker.itemDirectory 203 - in 206 + pid -> 204 207 [ "(mimeType contains 'audio/'" 205 208 , "or mimeType = 'application/vnd.google-apps.folder')" 206 - , "and ('" ++ parentId ++ "' in parents)" 209 + , "and ('" ++ pid ++ "' in parents)" 207 210 ] 208 211 209 212 paramsBase = ··· 286 289 makeTrackUrl : Time.Posix -> SourceData -> HttpMethod -> String -> String 287 290 makeTrackUrl currentTime srcData method path = 288 291 let 292 + file = 293 + String.Path.file path 294 + 289 295 fileId = 290 - path 296 + file 291 297 |> String.split "?" 292 298 |> List.head 293 - |> Maybe.withDefault path 299 + |> Maybe.withDefault file 294 300 295 301 accessToken = 296 302 Dict.fetch "accessToken" "" srcData
+12 -2
src/Library/Sources/Services/Google/Parser.elm
··· 8 8 import Sources.Pick 9 9 import Sources.Processing exposing (Marker(..), PrepationAnswer, TreeAnswer) 10 10 import Sources.Services.Google.Marker as Marker 11 + import String.Path 11 12 12 13 13 14 ··· 76 77 |> Maybe.map Marker.itemDirectory 77 78 |> Maybe.withDefault "" 78 79 80 + usedPath = 81 + usedDirectory 82 + |> String.Path.dropRight 1 83 + |> String.Path.addSuffix 84 + 79 85 ( directories, files ) = 80 86 List.partition 81 87 (\item -> ··· 92 98 files 93 99 |> List.map itemProperties 94 100 |> List.filter (.name >> Sources.Pick.isMusicFile) 95 - |> List.map (\{ id, name } -> id ++ "?name=" ++ name) 101 + |> List.map (\{ id, name } -> usedPath ++ id ++ "?name=" ++ name) 96 102 , marker = 97 103 previousMarker 98 104 |> Marker.removeOne 99 105 |> Marker.concat 100 106 (List.map 101 - (itemProperties >> .id >> Marker.Directory) 107 + (itemProperties 108 + >> (\props -> props.name ++ "/" ++ props.id) 109 + >> String.append usedPath 110 + >> Marker.Directory 111 + ) 102 112 directories 103 113 ) 104 114 |> (case nextPageToken of
+42
src/Library/String/Path.elm
··· 1 + module String.Path exposing (..) 2 + 3 + import List.Extra as List 4 + 5 + 6 + 7 + -- ⛩ 8 + 9 + 10 + sep : String 11 + sep = 12 + "/" 13 + 14 + 15 + 16 + -- 🔱 17 + 18 + 19 + addSuffix : String -> String 20 + addSuffix path = 21 + case path of 22 + "" -> 23 + "" 24 + 25 + p -> 26 + p ++ sep 27 + 28 + 29 + dropRight : Int -> String -> String 30 + dropRight int path = 31 + path 32 + |> String.split sep 33 + |> (\l -> List.take (List.length l - 1) l) 34 + |> String.join sep 35 + 36 + 37 + file : String -> String 38 + file path = 39 + path 40 + |> String.split sep 41 + |> List.last 42 + |> Maybe.withDefault path