Skip to content

Commit

Permalink
Support video upload time in Koofr video importer (#1171)
Browse files Browse the repository at this point in the history
Co-authored-by: Ernest Sadykov <[email protected]>
  • Loading branch information
incjo and xokker authored Oct 19, 2022
1 parent 66fc7da commit ee83645
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ private String importSingleVideo(
}

return koofrClient.uploadFile(
parentPath, name, inputStream, video.getEncodingFormat(), null, description);
parentPath,
name,
inputStream,
video.getEncodingFormat(),
video.getUploadedTime(),
description);
} catch (FileNotFoundException e) {
monitor.info(
() -> String.format("Video resource was missing for id: %s", video.getDataId()), e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.datatransferproject.transfer.koofr.videos;

import com.google.common.collect.ImmutableList;
import java.time.Instant;
import java.util.Date;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import org.datatransferproject.api.launcher.Monitor;
Expand Down Expand Up @@ -97,6 +99,7 @@ public void testImportItemFromURLWithAlbum() throws Exception {
new VideoAlbum("id1", "Album 1", "This is a fake album"),
new VideoAlbum("id2", "", description1001));

Date uploadedTime = Date.from(Instant.parse("2020-09-04T12:40:57.741Z"));
Collection<VideoModel> videos =
ImmutableList.of(
new VideoModel(
Expand All @@ -107,7 +110,7 @@ public void testImportItemFromURLWithAlbum() throws Exception {
"video1",
"id1",
false,
null),
uploadedTime),
new VideoModel(
"video2.mp4",
server.url("/2.mp4").toString(),
Expand Down Expand Up @@ -146,7 +149,7 @@ public void testImportItemFromURLWithAlbum() throws Exception {
eq("video1.mp4"),
any(),
eq("video/mp4"),
isNull(),
eq(uploadedTime),
eq("A video 1"));
clientInOrder.verify(client).fileExists(eq("/root/Album 1/video2.mp4"));
clientInOrder.verify(client).fileExists(eq("/root/Album/video3.mp4"));
Expand Down

0 comments on commit ee83645

Please sign in to comment.