Add endpoint to get metadata
This commit is contained in:
parent
ae1d9e2bc1
commit
3dbc1b54d6
@ -91,6 +91,17 @@ public class LibraryAPI implements EndpointCollection {
|
||||
ctx.respond(HttpStatusCodes.OK_200, new JsonResponse(videoToJSON(video)));
|
||||
}
|
||||
|
||||
@Endpoint(method = HttpRequestMethod.GET, path = "/video/{video}/metadata", pathPattern = true)
|
||||
public void getMetadata(HttpRequestContext ctx, @RequestParameter("video") String videoId) {
|
||||
Video video = VideoBase.getLibrary().findVideoById(videoId);
|
||||
if(video == null) {
|
||||
ctx.respond(HttpStatusCodes.NOT_FOUND_404, new TextResponse("Not found"));
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.respond(HttpStatusCodes.OK_200, new JsonResponse(video.getMetadata().getRaw()));
|
||||
}
|
||||
|
||||
@Endpoint(method = HttpRequestMethod.PUT, path = "/video/{video}/metadata", pathPattern = true)
|
||||
public void updateVideoMetadata(HttpRequestContext ctx, @RequestParameter("video") String videoId) {
|
||||
Library library = VideoBase.getLibrary();
|
||||
|
Loading…
x
Reference in New Issue
Block a user