From f7883d975c3895501bb88b5a4a229fe7a8aa0190 Mon Sep 17 00:00:00 2001 From: FriendshipBridge Date: Mon, 24 Aug 2020 17:28:13 +0800 Subject: [PATCH] update bvw --- Release Notes.txt | 6 + pom.xml | 5 + .../com/baidubce/services/bvw/BvwClient.java | 31 ++ .../bvw/model/matlib/MaterialGetRequest.java | 56 +++ .../bvw/model/matlib/MaterialGetResponse.java | 333 ++++++++++++++++++ .../bvw/model/matlib/MatlibUploadRequest.java | 120 +++++++ .../model/matlib/MatlibUploadResponse.java | 49 +++ 7 files changed, 600 insertions(+) create mode 100644 src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetRequest.java create mode 100644 src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetResponse.java create mode 100644 src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadRequest.java create mode 100644 src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadResponse.java diff --git a/Release Notes.txt b/Release Notes.txt index b63eb497..e91bcd3b 100644 --- a/Release Notes.txt +++ b/Release Notes.txt @@ -3,6 +3,12 @@ 【版本:vx.xx.xx】 涉及产品:SHC,新增广播接口,现有product接口增加asrKafka参数。 +【版本:v0.10.124】 +涉及产品:BVW(VideoWorks),支持上传素材和查询素材。 + +【版本:v0.10.123】 +涉及产品:CNAP,支持获取工作空间名称。 + 【版本:v0.10.122】 涉及产品:DCC,创建DCC自实例新增hostname参数。 diff --git a/pom.xml b/pom.xml index 3bb494b7..82589714 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,11 @@ + + com.baidu.bce + gateway-manager-cloud-sdk + 1.27.18.2 + org.apache.commons commons-lang3 diff --git a/src/main/java/com/baidubce/services/bvw/BvwClient.java b/src/main/java/com/baidubce/services/bvw/BvwClient.java index 537cabe1..f24f4f42 100644 --- a/src/main/java/com/baidubce/services/bvw/BvwClient.java +++ b/src/main/java/com/baidubce/services/bvw/BvwClient.java @@ -29,6 +29,10 @@ import com.baidubce.internal.RestartableInputStream; import com.baidubce.model.AbstractBceRequest; import com.baidubce.services.bvw.model.common.ListByPageResponse; +import com.baidubce.services.bvw.model.matlib.MaterialGetRequest; +import com.baidubce.services.bvw.model.matlib.MaterialGetResponse; +import com.baidubce.services.bvw.model.matlib.MatlibUploadRequest; +import com.baidubce.services.bvw.model.matlib.MatlibUploadResponse; import com.baidubce.services.bvw.model.media.MediaBaseRequest; import com.baidubce.services.bvw.model.media.MediaBaseResponse; import com.baidubce.services.bvw.model.media.MediaBatchDeleteRequest; @@ -78,6 +82,8 @@ public class BvwClient extends AbstractBceClient { private static final String INSTANCE = "instance"; private static final String TASK = "task"; private static final String NOTIFICATION = "notification"; + private static final String MATLIB = "matlib"; + private static final String MATERIAL_LIBRARY = "materialLibrary"; /** * The request queries. @@ -105,6 +111,7 @@ public class BvwClient extends AbstractBceClient { private static final String NOTIFICATION_LIST_STATUS = "status"; private static final String NOTIFICATION_ENABLE = "enable"; private static final String NOTIFICATION_DISABLE = "disable"; + private static final String MATLIB_UPLOAD = "upload"; /** * Responsible for handling httpResponses from all Bos service calls. @@ -793,4 +800,28 @@ public NotificationBaseResponse deleteNotification(String name) { return deleteNotification(deleteRequest); } + /** + * Upload media to material library. + * + * @param matlibUploadRequest The uploading request + * @return A uploading response + */ + public MatlibUploadResponse upload2Material(MatlibUploadRequest matlibUploadRequest) { + InternalRequest request = this.createRequest(matlibUploadRequest, HttpMethodName.POST, MATLIB); + request.addParameter(MATLIB_UPLOAD, null); + return this.invokeHttpClient(request, MatlibUploadResponse.class); + } + + /** + * Get material from material library. + * @param materialId The material id + * @return A getting material response + */ + public MaterialGetResponse getMaterial(String materialId) { + MaterialGetRequest materialGetRequest = new MaterialGetRequest(materialId); + InternalRequest request = this.createRequest(materialGetRequest, HttpMethodName.GET, MATERIAL_LIBRARY, + materialId); + return invokeHttpClient(request, MaterialGetResponse.class); + } + } diff --git a/src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetRequest.java b/src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetRequest.java new file mode 100644 index 00000000..4b4dacbb --- /dev/null +++ b/src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetRequest.java @@ -0,0 +1,56 @@ +/* + * Copyright 2019-2020 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.baidubce.services.bvw.model.matlib; + +import com.baidubce.auth.BceCredentials; +import com.baidubce.model.AbstractBceRequest; + +/** + * The request of getting material from material library. + */ +public class MaterialGetRequest extends AbstractBceRequest { + + /** + * The material id in material library. + */ + private String materialId; + + public MaterialGetRequest() { + } + + public MaterialGetRequest(String materialId) { + this.materialId = materialId; + } + + public String getMaterialId() { + return materialId; + } + + public void setMaterialId(String materialId) { + this.materialId = materialId; + } + + @Override + public String toString() { + return "MaterialGetRequest{" + + "materialId='" + materialId + '\'' + + '}'; + } + + @Override + public AbstractBceRequest withRequestCredentials(BceCredentials credentials) { + this.setRequestCredentials(credentials); + return this; + } + +} diff --git a/src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetResponse.java b/src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetResponse.java new file mode 100644 index 00000000..9174a54b --- /dev/null +++ b/src/main/java/com/baidubce/services/bvw/model/matlib/MaterialGetResponse.java @@ -0,0 +1,333 @@ +/* + * Copyright 2019-2020 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.baidubce.services.bvw.model.matlib; + +import com.baidubce.model.AbstractBceResponse; + +import java.util.List; + +/** + * The response of getting material from material library. + */ +public class MaterialGetResponse extends AbstractBceResponse { + + /** + * The material id + */ + private String id; + /** + * The user id + */ + private String userId; + /** + * The info type of material, only support ENTERTAINMENT now. + */ + private String infoType; + /** + * The media type, contains video/audio/image. + */ + private String mediaType; + /** + * The media source type, contains USER/SERVICE. + */ + private String sourceType; + /** + * The statue of processing media source, contains PROCESSING/FAILED/FINISHED. + */ + private String status; + /** + * The material title. + */ + private String title; + /** + * The media source url. + */ + private String sourceUrl; + /** + * The 360p preview url of media source. + */ + private String sourceUrl360p; + /** + * The thumbnails preview urls of media source. + */ + private List thumbnailUrls; + /** + * The subtitles preview urls of media source. + */ + private List subtitleUrls; + /** + * The create time of this material. + */ + private String createTime; + /** + * The update time of this material. + */ + private String updateTime; + /** + * The video or audio duration of media source. + */ + private Double duration; + /** + * The video of image height of media source. + */ + private Integer height; + /** + * The video of image width of media source. + */ + private Integer width; + /** + * The bos bucket to storage media source and process result. + */ + private String bucket; + /** + * The bos key of media source. + */ + private String key; + /** + * The bos key of 360p result. + */ + private String key360p; + /** + * The bos key of 720p result. + */ + private String key720p; + /** + * The bos key of audio result. + */ + private String audioKey; + /** + * The bos keys of thumbnail results. + */ + private List thumbnailKeys; + /** + * The bos key of subtitle results. + */ + private List subtitles; + + public MaterialGetResponse() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getInfoType() { + return infoType; + } + + public void setInfoType(String infoType) { + this.infoType = infoType; + } + + public String getMediaType() { + return mediaType; + } + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } + + public String getSourceType() { + return sourceType; + } + + public void setSourceType(String sourceType) { + this.sourceType = sourceType; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getSourceUrl() { + return sourceUrl; + } + + public void setSourceUrl(String sourceUrl) { + this.sourceUrl = sourceUrl; + } + + public String getSourceUrl360p() { + return sourceUrl360p; + } + + public void setSourceUrl360p(String sourceUrl360p) { + this.sourceUrl360p = sourceUrl360p; + } + + public List getThumbnailUrls() { + return thumbnailUrls; + } + + public void setThumbnailUrls(List thumbnailUrls) { + this.thumbnailUrls = thumbnailUrls; + } + + public List getSubtitleUrls() { + return subtitleUrls; + } + + public void setSubtitleUrls(List subtitleUrls) { + this.subtitleUrls = subtitleUrls; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public Double getDuration() { + return duration; + } + + public void setDuration(Double duration) { + this.duration = duration; + } + + public Integer getHeight() { + return height; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public String getBucket() { + return bucket; + } + + public void setBucket(String bucket) { + this.bucket = bucket; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getKey360p() { + return key360p; + } + + public void setKey360p(String key360p) { + this.key360p = key360p; + } + + public String getKey720p() { + return key720p; + } + + public void setKey720p(String key720p) { + this.key720p = key720p; + } + + public String getAudioKey() { + return audioKey; + } + + public void setAudioKey(String audioKey) { + this.audioKey = audioKey; + } + + public List getThumbnailKeys() { + return thumbnailKeys; + } + + public void setThumbnailKeys(List thumbnailKeys) { + this.thumbnailKeys = thumbnailKeys; + } + + public List getSubtitles() { + return subtitles; + } + + public void setSubtitles(List subtitles) { + this.subtitles = subtitles; + } + + @Override + public String toString() { + return "MaterialGetResponse{" + + "id='" + id + '\'' + + ", userId='" + userId + '\'' + + ", infoType='" + infoType + '\'' + + ", mediaType='" + mediaType + '\'' + + ", sourceType='" + sourceType + '\'' + + ", status='" + status + '\'' + + ", title='" + title + '\'' + + ", sourceUrl='" + sourceUrl + '\'' + + ", sourceUrl360p='" + sourceUrl360p + '\'' + + ", thumbnailUrls=" + thumbnailUrls + + ", subtitleUrls=" + subtitleUrls + + ", createTime='" + createTime + '\'' + + ", updateTime='" + updateTime + '\'' + + ", duration=" + duration + + ", height=" + height + + ", width=" + width + + ", bucket='" + bucket + '\'' + + ", key='" + key + '\'' + + ", key360p='" + key360p + '\'' + + ", key720p='" + key720p + '\'' + + ", audioKey='" + audioKey + '\'' + + ", thumbnailKeys=" + thumbnailKeys + + ", subtitles=" + subtitles + + '}'; + } + +} diff --git a/src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadRequest.java b/src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadRequest.java new file mode 100644 index 00000000..0234df2a --- /dev/null +++ b/src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadRequest.java @@ -0,0 +1,120 @@ +/* + * Copyright 2019-2020 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.baidubce.services.bvw.model.matlib; + +import com.baidubce.auth.BceCredentials; +import com.baidubce.model.AbstractBceRequest; + +/** + * The request of uploading media to material library. + */ +public class MatlibUploadRequest extends AbstractBceRequest { + + /** + * The media type,video/audio/image. + */ + private String mediaType; + /** + * The material title. + */ + private String title; + /** + * The source media in bos bucket. + */ + private String bucket; + /** + * The source media in bos key. + */ + private String key; + /** + * The notification name which to callback when process of uploading media is completed; + * if none, will not callback. + */ + private String notification; + + public MatlibUploadRequest() { + } + + public MatlibUploadRequest(String mediaType, String title, String bucket, String key) { + this.mediaType = mediaType; + this.title = title; + this.bucket = bucket; + this.key = key; + } + + public MatlibUploadRequest(String mediaType, String title, String bucket, String key, String notification) { + this.mediaType = mediaType; + this.title = title; + this.bucket = bucket; + this.key = key; + this.notification = notification; + } + + public String getMediaType() { + return mediaType; + } + + public void setMediaType(String mediaType) { + this.mediaType = mediaType; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBucket() { + return bucket; + } + + public void setBucket(String bucket) { + this.bucket = bucket; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getNotification() { + return notification; + } + + public void setNotification(String notification) { + this.notification = notification; + } + + @Override + public String toString() { + return "MatlibUploadRequest{" + + "mediaType='" + mediaType + '\'' + + ", title='" + title + '\'' + + ", bucket='" + bucket + '\'' + + ", key='" + key + '\'' + + ", notification='" + notification + '\'' + + '}'; + } + + @Override + public AbstractBceRequest withRequestCredentials(BceCredentials credentials) { + this.setRequestCredentials(credentials); + return this; + } + +} diff --git a/src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadResponse.java b/src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadResponse.java new file mode 100644 index 00000000..7bb46671 --- /dev/null +++ b/src/main/java/com/baidubce/services/bvw/model/matlib/MatlibUploadResponse.java @@ -0,0 +1,49 @@ +/* + * Copyright 2019-2020 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.baidubce.services.bvw.model.matlib; + +import com.baidubce.model.AbstractBceResponse; + +/** + * The response of uploading media to material library. + */ +public class MatlibUploadResponse extends AbstractBceResponse { + + /** + * The material id. + */ + private String materialId; + + public MatlibUploadResponse() { + } + + public MatlibUploadResponse(String materialId) { + this.materialId = materialId; + } + + public String getMaterialId() { + return materialId; + } + + public void setMaterialId(String materialId) { + this.materialId = materialId; + } + + @Override + public String toString() { + return "MatlibUploadResponse{" + + "materialId='" + materialId + '\'' + + '}'; + } + +}