-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathvideoservice.proto
More file actions
215 lines (177 loc) · 4.7 KB
/
videoservice.proto
File metadata and controls
215 lines (177 loc) · 4.7 KB
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
syntax = "proto3";
option go_package = "github.com/horahoradev/horahora/video_service/protocol";
package proto;
service VideoService {
rpc uploadVideo(stream InputVideoChunk) returns (uploadResponse) {}
rpc downloadVideo(VideoRequest) returns (stream ResponseVideoChunk) {}
rpc foreignVideoExists(ForeignVideoCheck) returns (VideoExistenceResponse) {}
rpc getVideoList(VideoQueryConfig) returns (VideoList) {}
rpc getVideo(VideoRequest) returns (videoMetadata) {}
rpc rateVideo(videoRating) returns (Nothing) {}
rpc viewVideo(videoViewing) returns (Nothing) {}
rpc MakeComment(videoComment) returns (Nothing) {}
rpc MakeCommentUpvote(commentUpvote) returns (Nothing) {}
rpc GetCommentsForVideo(commentRequest) returns (CommentListResponse) {}
rpc GetVideoRecommendations(recReq) returns (recResp) {}
rpc ApproveVideo(videoApproval) returns (Nothing) {}
rpc DeleteVideo(videoDeletionReq) returns (Nothing) {}
}
message videoDeletionReq {
string videoID = 1;
}
message Nothing{}
message recReq {
int64 user_id = 1;
}
message recResp {
repeated VideoRec videos = 1;
}
message VideoRec {
string thumbnailLoc = 1;
string videoTitle = 2;
int64 videoID = 3;
}
message videoComment {
int64 user_id = 1;
int64 video_id = 2;
string comment = 3;
int64 parent_comment = 4; // 0 if root
}
// Can add pagination in the future if needed (probably fine without it)
message commentRequest {
int64 videoID = 1;
int64 currUserID = 2;
}
message commentUpvote {
int64 user_id = 1;
int64 comment_id = 2;
bool is_upvote = 3;
}
message CommentListResponse {
repeated Comment comments = 1;
}
message Comment {
int64 comment_id = 1;
string creation_date = 2;
string content = 3;
string author_username = 4;
string author_profile_image_url = 5;
int64 vote_score = 6;
bool current_user_has_upvoted = 7;
int64 author_id = 8;
int64 parent_id = 9;
}
message videoMetadata {
string videoLoc = 1; // The location of the DASH manifest
string videoTitle = 2;
double rating = 3;
string authorName = 4; // Do I need this? probably not
uint64 views = 5;
int64 videoID = 6;
string uploadDate = 7;
string description = 8;
int64 authorID = 9;
repeated string tags = 10;
}
message VideoList {
repeated Video videos = 1;
int64 numberOfVideos = 2;
}
message Video {
string videoTitle = 1;
uint64 views = 2;
double rating = 3;
string thumbnailLoc = 4;
int64 videoID = 5;
string authorName = 6;
string uploadDate = 7;
int64 authorID = 8;
}
message videoRating {
int64 userID = 1;
int64 videoID = 2;
float rating = 3;
}
message videoViewing {
int64 videoID = 1;
}
message videoApproval {
int64 userID = 1;
int64 videoID = 2;
}
message VideoQueryConfig {
orderCategory orderBy = 1;
sortDirection direction = 2;
int64 pageNumber = 3;
string SearchVal = 4;
int64 fromUserID = 5; // domestic user ID
bool showUnapproved = 6;
bool unapprovedOnly = 7;
}
message VideoExistenceResponse {
bool Exists = 1;
}
message ForeignVideoCheck {
string ForeignVideoID = 1;
string ForeignWebsite = 2;
}
message VideoRequest {
string videoID = 1;
}
message InputVideoChunk {
oneof Payload {
FileContent content = 1;
InputFileMetadata meta = 2;
RawMetadata rawmeta = 3; // This was added after the above two fields, and is used for the metadata.json file for the video
}
}
message ResponseVideoChunk {
oneof Payload {
FileContent content = 1;
ResponseFileMetadata meta = 2;
}
}
message FileContent {
bytes Data = 1;
}
message RawMetadata {
bytes Data = 1;
}
// Could make the reupload fields optional
message InputFileMetadata {
string title = 1;
string description = 2;
string authorUID = 3;// 0 if reupload
string originalVideoLink = 4; // If reupload
string authorUsername = 5; // If reupload
string originalSite = 6; // If reupload
string originalID = 7; // If reupload // this is a little dumb
int64 domesticAuthorID = 8;
repeated string Tags = 9;
bytes thumbnail = 10; // lol good enough, I could stream this but this is easier
}
// For now, these two are the same, but may deviate in future
message ResponseFileMetadata {
string title = 1;
string description = 2;
int64 authorUID = 3;// 0 if reupload
string originalVideoLink = 4; // If reupload
}
//enum website {
// niconico = 0;
// bilibili = 1;
// youtube = 2;
//}
enum orderCategory {
views = 0;
rating = 1;
upload_date = 2;
my_ratings = 3;
}
enum sortDirection {
asc = 0;
desc = 2;
}
message uploadResponse {
int64 videoID = 1;
}