public bool Equals(VideoFileInformationModel other) { return(string.Equals(FullPath, other.FullPath) && string.Equals(Filename, other.Filename) && string.Equals(Extension, other.Extension) && string.Equals(FormatName, other.FormatName) && string.Equals(BitRate, other.BitRate) && FileSize == other.FileSize && DurationInSecs.Equals(other.DurationInSecs) && VideoStream.Equals(other.VideoStream) && AudioStream.Equals(other.AudioStream)); }
public VideoFileInformationModel Parse(JObject json) { dynamic videoStream = json["streams"].FirstOrDefault(x => x["codec_type"].Value <string>() == "video"); if (videoStream == null) { throw new HqvException("No video stream found"); } dynamic format = json["format"]; if (format == null) { throw new HqvException("No format found"); } AudioStreamModel audioStreamModel; try { dynamic audioStream = json["streams"].FirstOrDefault(x => x["codec_type"].Value <string>() == "audio"); audioStreamModel = GetAudioStream(audioStream); } catch (Exception) { audioStreamModel = null; } string path = format.filename; var filename = Path.GetFileNameWithoutExtension(path); var extension = Path.GetExtension(path); string formatName = format.format_name; string bitRate = format.bit_rate; long filesize = format.size; double duration = format.duration; var videoFile = new VideoFileInformationModel(path, filename, extension, formatName, bitRate, filesize, duration, GetVideoStream(videoStream), audioStreamModel); return(videoFile); }
private ThumbnailSheetCreateResponse CreateThumbnailSheet(CreateThumbnailSheetOptions options, VideoFileInformationModel videoFileInformation) { var request = new ThumbnailSheetCreateRequest( videoPath: options.VideoFilePath, sheetName: Path.GetFileNameWithoutExtension(options.VideoFilePath), numberOfThumbnails: options.NumberOfThumbnails, videoDurationInSeconds: videoFileInformation.DurationInSecs, correlationId: _correlationId); var response = _thumbnailSheetCreationService.Create(request); if (response.IsValid) { _auditor.AuditSuccess("VideoFile", options.VideoFilePath, "ThumbnailSheetCreated", response); } else { _auditor.AuditFailure("VideoFile", options.VideoFilePath, "ThumbnailSheetCreationFailed", response); } return(response); }