1module Sources.Processing exposing (..)
2
3import Sources exposing (Source, SourceData)
4import Tracks exposing (Tags, Track)
5
6
7
8-- 🌳
9
10
11type Status
12 = Processing ( Source, List Track ) (List ( Source, List Track ))
13 | NotProcessing
14
15
16type alias Arguments =
17 { origin : String
18 , sources : List Source
19 }
20
21
22
23-- MARKERS & RESPONSES
24
25
26type Marker
27 = TheBeginning
28 | InProgress String
29 | TheEnd
30
31
32type alias PrepationAnswer marker =
33 { sourceData : SourceData
34 , marker : marker
35 }
36
37
38type alias TreeAnswer marker =
39 { filePaths : List String
40 , marker : marker
41 }
42
43
44
45-- CONTEXTS
46
47
48type alias Context =
49 { filePaths : List String
50 , origin : String
51 , preparationMarker : Marker
52 , source : Source
53 , treeMarker : Marker
54 }
55
56
57type alias ContextForTags =
58 { amount : Int
59 , nextFilePaths : List String
60 , receivedFilePaths : List String
61 , receivedTags : List (Maybe Tags)
62 , sourceId : String
63 , urlsForTags : List TagUrls
64 }
65
66
67type alias ContextForTagsSync =
68 { receivedFilePaths : List String
69 , receivedTags : List (Maybe Tags)
70 , trackIds : List String
71 , urlsForTags : List TagUrls
72 }
73
74
75type alias TagUrls =
76 { getUrl : String
77 , headUrl : String
78 }
79
80
81
82-- HTTP
83
84
85type HttpMethod
86 = Get
87 | Head
88
89
90httpMethod : HttpMethod -> String
91httpMethod method =
92 case method of
93 Get ->
94 "GET"
95
96 Head ->
97 "HEAD"