Search in sources :

Example 1 with Upload

use of co.videofirst.vft.capture.model.capture.Upload in project vft-capture by videofirst.

the class DefaultUploadService method upload.

// Methods from `UploadService`
@Override
public void upload(String captureId) {
    if (!uploadConfig.isEnable()) {
        throw new VideoUploadException("Please enable upload configuration (i.e. set `vft_config.upload.enable` property to `true`)");
    }
    Capture capture = getCapture(captureId);
    // Check capture is finished i.e. the `finished` timestamp is set.
    if (capture.getFinished() == null) {
        throw new InvalidStateException("You can only upload a capture which is finished.  Please try again later.");
    }
    // Mark capture that it's scheduled for upload
    Upload upload = Upload.schedule(uploadConfig.getUrl());
    capture.setUpload(upload);
    captureDao.save(capture);
    uploads.put(captureId, capture);
    queue.add(capture);
}
Also used : VideoUploadException(co.videofirst.vft.capture.exception.VideoUploadException) Upload(co.videofirst.vft.capture.model.capture.Upload) InvalidStateException(co.videofirst.vft.capture.exception.InvalidStateException) Capture(co.videofirst.vft.capture.model.capture.Capture)

Aggregations

InvalidStateException (co.videofirst.vft.capture.exception.InvalidStateException)1 VideoUploadException (co.videofirst.vft.capture.exception.VideoUploadException)1 Capture (co.videofirst.vft.capture.model.capture.Capture)1 Upload (co.videofirst.vft.capture.model.capture.Upload)1