Something went wrong. Try again.
A music player that connects to your cloud/distributed storage. forked from tokono.ma/diffuse
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329module Sources.Services exposing (initialData, keyToType, labels, makeTrackUrl, makeTree, parseErrorResponse, parsePreparationResponse, parseTreeResponse, postProcessTree, prepare, properties, typeToKey)
{-| Service functions used in other modules.-}
import Httpimport Sources exposing (..)import Sources.Processing exposing (..)import Sources.Services.AmazonS3 as AmazonS3import Sources.Services.AzureBlob as AzureBlobimport Sources.Services.AzureFile as AzureFileimport Sources.Services.Dropbox as Dropboximport Sources.Services.Google as Googleimport Sources.Services.Ipfs as Ipfsimport Sources.Services.WebDav as WebDavimport Time
-- FUNCTIONS
initialData : Service -> SourceDatainitialData service = case service of AmazonS3 -> AmazonS3.initialData
AzureBlob -> AzureBlob.initialData
AzureFile -> AzureFile.initialData
Dropbox -> Dropbox.initialData
Google -> Google.initialData
Ipfs -> Ipfs.initialData
WebDav -> WebDav.initialData
makeTrackUrl : Service -> Time.Posix -> String -> SourceData -> HttpMethod -> String -> StringmakeTrackUrl service = case service of AmazonS3 -> AmazonS3.makeTrackUrl
AzureBlob -> AzureBlob.makeTrackUrl
AzureFile -> AzureFile.makeTrackUrl
Dropbox -> Dropbox.makeTrackUrl
Google -> Google.makeTrackUrl
Ipfs -> Ipfs.makeTrackUrl
WebDav -> WebDav.makeTrackUrl
makeTree : Service -> SourceData -> Marker -> Time.Posix -> (Result Http.Error String -> msg) -> Cmd msgmakeTree service = case service of AmazonS3 -> AmazonS3.makeTree
AzureBlob -> AzureBlob.makeTree
AzureFile -> AzureFile.makeTree
Dropbox -> Dropbox.makeTree
Google -> Google.makeTree
Ipfs -> Ipfs.makeTree
WebDav -> WebDav.makeTree
parseErrorResponse : Service -> String -> Maybe StringparseErrorResponse service = case service of AmazonS3 -> AmazonS3.parseErrorResponse
AzureBlob -> AzureBlob.parseErrorResponse
AzureFile -> AzureFile.parseErrorResponse
Dropbox -> Dropbox.parseErrorResponse
Google -> Google.parseErrorResponse
Ipfs -> Ipfs.parseErrorResponse
WebDav -> WebDav.parseErrorResponse
parsePreparationResponse : Service -> String -> Time.Posix -> SourceData -> Marker -> PrepationAnswer MarkerparsePreparationResponse service = case service of AmazonS3 -> AmazonS3.parsePreparationResponse
AzureBlob -> AzureBlob.parsePreparationResponse
AzureFile -> AzureFile.parsePreparationResponse
Dropbox -> Dropbox.parsePreparationResponse
Google -> Google.parsePreparationResponse
Ipfs -> Ipfs.parsePreparationResponse
WebDav -> WebDav.parsePreparationResponse
parseTreeResponse : Service -> String -> Marker -> TreeAnswer MarkerparseTreeResponse service = case service of AmazonS3 -> AmazonS3.parseTreeResponse
AzureBlob -> AzureBlob.parseTreeResponse
AzureFile -> AzureFile.parseTreeResponse
Dropbox -> Dropbox.parseTreeResponse
Google -> Google.parseTreeResponse
Ipfs -> Ipfs.parseTreeResponse
WebDav -> WebDav.parseTreeResponse
postProcessTree : Service -> List String -> List StringpostProcessTree service = case service of AmazonS3 -> AmazonS3.postProcessTree
AzureBlob -> AzureBlob.postProcessTree
AzureFile -> AzureFile.postProcessTree
Dropbox -> Dropbox.postProcessTree
Google -> Google.postProcessTree
Ipfs -> Ipfs.postProcessTree
WebDav -> WebDav.postProcessTree
prepare : Service -> String -> SourceData -> Marker -> (Result Http.Error String -> msg) -> Maybe (Cmd msg)prepare service = case service of AmazonS3 -> AmazonS3.prepare
AzureBlob -> AzureBlob.prepare
AzureFile -> AzureFile.prepare
Dropbox -> Dropbox.prepare
Google -> Google.prepare
Ipfs -> Ipfs.prepare
WebDav -> WebDav.prepare
properties : Service -> List Propertyproperties service = case service of AmazonS3 -> AmazonS3.properties
AzureBlob -> AzureBlob.properties
AzureFile -> AzureFile.properties
Dropbox -> Dropbox.properties
Google -> Google.properties
Ipfs -> Ipfs.properties
WebDav -> WebDav.properties
-- KEYS & LABELS
keyToType : String -> Maybe ServicekeyToType str = case str of "AmazonS3" -> Just AmazonS3
"AzureBlob" -> Just AzureBlob
"AzureFile" -> Just AzureFile
"Dropbox" -> Just Dropbox
"Google" -> Just Google
"Ipfs" -> Just Ipfs
"WebDav" -> Just WebDav
_ -> Nothing
typeToKey : Service -> StringtypeToKey service = case service of AmazonS3 -> "AmazonS3"
AzureBlob -> "AzureBlob"
AzureFile -> "AzureFile"
Dropbox -> "Dropbox"
Google -> "Google"
Ipfs -> "Ipfs"
WebDav -> "WebDav"
{-| Service labels.Maps a service key to a label.-}labels : List ( String, String )labels = [ ( typeToKey AmazonS3, "Amazon S3" ) , ( typeToKey AzureBlob, "Azure Blob Storage" ) , ( typeToKey AzureFile, "Azure File Storage" ) , ( typeToKey Dropbox, "Dropbox" ) , ( typeToKey Ipfs, "IPFS" ) , ( typeToKey WebDav, "WebDAV" ) ]