-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
/
types.go
252 lines (240 loc) · 8.61 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
package vtencent
import (
"strconv"
"time"
"github.com/alist-org/alist/v3/internal/model"
)
type RespErr struct {
Code string `json:"Code"`
Message string `json:"Message"`
}
type Reqfiles struct {
ScrollToken string `json:"ScrollToken"`
Text string `json:"Text"`
Offset int `json:"Offset"`
Limit int `json:"Limit"`
Sort struct {
Field string `json:"Field"`
Order string `json:"Order"`
} `json:"Sort"`
CreateTimeRanges []any `json:"CreateTimeRanges"`
MaterialTypes []any `json:"MaterialTypes"`
ReviewStatuses []any `json:"ReviewStatuses"`
Tags []any `json:"Tags"`
SearchScopes []struct {
Owner struct {
Type string `json:"Type"`
ID string `json:"Id"`
} `json:"Owner"`
ClassID int `json:"ClassId"`
SearchOneDepth bool `json:"SearchOneDepth"`
} `json:"SearchScopes"`
}
type File struct {
Type string `json:"Type"`
ClassInfo struct {
ClassID int `json:"ClassId"`
Name string `json:"Name"`
UpdateTime time.Time `json:"UpdateTime"`
CreateTime time.Time `json:"CreateTime"`
FileInboxID string `json:"FileInboxId"`
Owner struct {
Type string `json:"Type"`
ID string `json:"Id"`
} `json:"Owner"`
ClassPath string `json:"ClassPath"`
ParentClassID int `json:"ParentClassId"`
AttachmentInfo struct {
SubClassCount int `json:"SubClassCount"`
MaterialCount int `json:"MaterialCount"`
Size int64 `json:"Size"`
} `json:"AttachmentInfo"`
ClassPreviewURLSet []string `json:"ClassPreviewUrlSet"`
} `json:"ClassInfo"`
MaterialInfo struct {
BasicInfo struct {
MaterialID string `json:"MaterialId"`
MaterialType string `json:"MaterialType"`
Name string `json:"Name"`
CreateTime time.Time `json:"CreateTime"`
UpdateTime time.Time `json:"UpdateTime"`
ClassPath string `json:"ClassPath"`
ClassID int `json:"ClassId"`
TagInfoSet []any `json:"TagInfoSet"`
TagSet []any `json:"TagSet"`
PreviewURL string `json:"PreviewUrl"`
MediaURL string `json:"MediaUrl"`
UnifiedMediaPreviewURL string `json:"UnifiedMediaPreviewUrl"`
Owner struct {
Type string `json:"Type"`
ID string `json:"Id"`
} `json:"Owner"`
PermissionSet any `json:"PermissionSet"`
PermissionInfoSet []any `json:"PermissionInfoSet"`
TfUID string `json:"TfUid"`
GroupID string `json:"GroupId"`
VersionMaterialIDSet []any `json:"VersionMaterialIdSet"`
FileType string `json:"FileType"`
CmeMaterialPlayList []any `json:"CmeMaterialPlayList"`
Status string `json:"Status"`
DownloadSwitch string `json:"DownloadSwitch"`
} `json:"BasicInfo"`
MediaInfo struct {
Width int `json:"Width"`
Height int `json:"Height"`
Size int `json:"Size"`
Duration float64 `json:"Duration"`
Fps int `json:"Fps"`
BitRate int `json:"BitRate"`
Codec string `json:"Codec"`
MediaType string `json:"MediaType"`
FavoriteStatus string `json:"FavoriteStatus"`
} `json:"MediaInfo"`
MaterialStatus struct {
ContentReviewStatus string `json:"ContentReviewStatus"`
EditorUsableStatus string `json:"EditorUsableStatus"`
UnifiedPreviewStatus string `json:"UnifiedPreviewStatus"`
EditPreviewImageSpiritStatus string `json:"EditPreviewImageSpiritStatus"`
TranscodeStatus string `json:"TranscodeStatus"`
AdaptiveStreamingStatus string `json:"AdaptiveStreamingStatus"`
StreamConnectable string `json:"StreamConnectable"`
AiAnalysisStatus string `json:"AiAnalysisStatus"`
AiRecognitionStatus string `json:"AiRecognitionStatus"`
} `json:"MaterialStatus"`
ImageMaterial struct {
Height int `json:"Height"`
Width int `json:"Width"`
Size int `json:"Size"`
MaterialURL string `json:"MaterialUrl"`
Resolution string `json:"Resolution"`
VodFileID string `json:"VodFileId"`
OriginalURL string `json:"OriginalUrl"`
} `json:"ImageMaterial"`
VideoMaterial struct {
MetaData struct {
Size int `json:"Size"`
Container string `json:"Container"`
Bitrate int `json:"Bitrate"`
Height int `json:"Height"`
Width int `json:"Width"`
Duration float64 `json:"Duration"`
Rotate int `json:"Rotate"`
VideoStreamInfoSet []struct {
Bitrate int `json:"Bitrate"`
Height int `json:"Height"`
Width int `json:"Width"`
Codec string `json:"Codec"`
Fps int `json:"Fps"`
} `json:"VideoStreamInfoSet"`
AudioStreamInfoSet []struct {
Bitrate int `json:"Bitrate"`
SamplingRate int `json:"SamplingRate"`
Codec string `json:"Codec"`
} `json:"AudioStreamInfoSet"`
} `json:"MetaData"`
ImageSpriteInfo any `json:"ImageSpriteInfo"`
MaterialURL string `json:"MaterialUrl"`
CoverURL string `json:"CoverUrl"`
Resolution string `json:"Resolution"`
VodFileID string `json:"VodFileId"`
OriginalURL string `json:"OriginalUrl"`
AudioWaveformURL string `json:"AudioWaveformUrl"`
SubtitleURL string `json:"SubtitleUrl"`
TranscodeInfoSet []any `json:"TranscodeInfoSet"`
ImageSpriteInfoSet []any `json:"ImageSpriteInfoSet"`
} `json:"VideoMaterial"`
} `json:"MaterialInfo"`
}
type RspFiles struct {
Code string `json:"Code"`
Message string `json:"Message"`
EnglishMessage string `json:"EnglishMessage"`
Data struct {
TotalCount int `json:"TotalCount"`
ResourceInfoSet []File `json:"ResourceInfoSet"`
ScrollToken string `json:"ScrollToken"`
} `json:"Data"`
}
type RspDown struct {
Code string `json:"Code"`
Message string `json:"Message"`
EnglishMessage string `json:"EnglishMessage"`
Data struct {
DownloadURLInfoSet []struct {
MaterialID string `json:"MaterialId"`
DownloadURL string `json:"DownloadUrl"`
} `json:"DownloadUrlInfoSet"`
} `json:"Data"`
}
type RspCreatrMaterial struct {
Code string `json:"Code"`
Message string `json:"Message"`
EnglishMessage string `json:"EnglishMessage"`
Data struct {
UploadContext string `json:"UploadContext"`
VodUploadSign string `json:"VodUploadSign"`
QuickUpload bool `json:"QuickUpload"`
} `json:"Data"`
}
type RspApplyUploadUGC struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Video struct {
StorageSignature string `json:"storageSignature"`
StoragePath string `json:"storagePath"`
} `json:"video"`
StorageAppID int `json:"storageAppId"`
StorageBucket string `json:"storageBucket"`
StorageRegion string `json:"storageRegion"`
StorageRegionV5 string `json:"storageRegionV5"`
Domain string `json:"domain"`
VodSessionKey string `json:"vodSessionKey"`
TempCertificate struct {
SecretID string `json:"secretId"`
SecretKey string `json:"secretKey"`
Token string `json:"token"`
ExpiredTime int `json:"expiredTime"`
} `json:"tempCertificate"`
AppID int `json:"appId"`
Timestamp int `json:"timestamp"`
StorageRegionV50 string `json:"StorageRegionV5"`
MiniProgramAccelerateHost string `json:"MiniProgramAccelerateHost"`
} `json:"data"`
}
type RspCommitUploadUGC struct {
Code int `json:"code"`
Message string `json:"message"`
Data struct {
Video struct {
URL string `json:"url"`
VerifyContent string `json:"verify_content"`
} `json:"video"`
FileID string `json:"fileId"`
} `json:"data"`
}
type RspFinishUpload struct {
Code string `json:"Code"`
Message string `json:"Message"`
EnglishMessage string `json:"EnglishMessage"`
Data struct {
MaterialID string `json:"MaterialId"`
} `json:"Data"`
}
func fileToObj(f File) *model.Object {
obj := &model.Object{}
if f.Type == "CLASS" {
obj.Name = f.ClassInfo.Name
obj.ID = strconv.Itoa(f.ClassInfo.ClassID)
obj.IsFolder = true
obj.Modified = f.ClassInfo.CreateTime
obj.Size = 0
} else if f.Type == "MATERIAL" {
obj.Name = f.MaterialInfo.BasicInfo.Name
obj.ID = f.MaterialInfo.BasicInfo.MaterialID
obj.IsFolder = false
obj.Modified = f.MaterialInfo.BasicInfo.CreateTime
obj.Size = int64(f.MaterialInfo.MediaInfo.Size)
}
return obj
}