/// <summary> /// Creates a BySearchRequest used to obtain all items matching the specified title or partial title of the movie/series/episode. /// </summary> /// <param name="title">The title (or partial title) of the item(s) to be searched for.</param> /// <param name="videoType">Apply a filter for the video type (movie, tv series, episode).</param> /// <param name="year">Apply a filter for the year of release.</param> /// <param name="page">Request a specific page of the search results. Leave blank to return all result pages.</param> public BySearchRequest(string title, VideoType?videoType = null, uint?year = null, uint?page = null) { Title = title; VideoType = videoType; Year = year; Page = page; }
/// <summary> /// Creates a ByTitleRequest used to obtain information regarding a Movie, TV Series, or TV Series Episode by specifying its exact title. /// </summary> /// <param name="title">The exact title of the item to be searched for.</param> /// <param name="videoType">>Apply a filter for the video type (movie, tv series, episode).</param> /// <param name="year">Apply a filter for the year of release.</param> /// <param name="plotSize">Specify whether you want a short plot summary of a full-length plot summary in the response. Default is a short plot summary.</param> public ByTitleRequest(string title, VideoType?videoType = null, uint?year = null, PlotSize plotSize = PlotSize.Short) { Title = title; VideoType = videoType; Year = year; PlotSize = plotSize; }
public VideosResponse Videos( string[] id, string user_id, string game_id, string after, string before, string first, string language, Period?period, Sort?sort, VideoType?type) { throw new NotImplementedException(); }
public IList <WatchedVideo> GetWatchedVideos(int?VideoId, int?CustomerId, VideoType?VideoType) { var query = _repository.Table; if (VideoId.HasValue) { query = query.Where(x => x.VideoId == VideoId); } if (CustomerId.HasValue) { query = query.Where(x => x.CustomerId == CustomerId); } if (VideoType.HasValue) { query = query.Where(x => x.VideoType == VideoType); } return(query.ToList()); }
public IList <WatchedVideo> GetWatchedVideos(int?videoId, int?customerId, VideoType?videoType) { var query = _repository.Get(x => true); if (videoId.HasValue) { query = query.Where(x => x.VideoId == videoId); } if (customerId.HasValue) { query = query.Where(x => x.CustomerId == customerId); } if (videoType.HasValue) { query = query.Where(x => x.VideoType == videoType); } return(query.ToList()); }
/// <summary> /// Gets the type of the input. /// </summary> /// <param name="videoType">Type of the video.</param> /// <param name="isoType">Type of the iso.</param> /// <returns>InputType.</returns> public static InputType GetInputType(VideoType?videoType, IsoType?isoType) { var type = InputType.File; if (videoType.HasValue) { switch (videoType.Value) { case VideoType.BluRay: type = InputType.Bluray; break; case VideoType.Dvd: type = InputType.Dvd; break; case VideoType.Iso: if (isoType.HasValue) { switch (isoType.Value) { case IsoType.BluRay: type = InputType.Bluray; break; case IsoType.Dvd: type = InputType.Dvd; break; } } break; } } return(type); }
/// <summary> /// Gets the media info internal. /// </summary> /// <returns>Task{MediaInfoResult}.</returns> private async Task <MediaInfo> GetMediaInfoInternal(string inputPath, string primaryPath, MediaProtocol protocol, bool extractChapters, string probeSizeArgument, bool isAudio, VideoType?videoType, bool forceEnableLogging, CancellationToken cancellationToken) { var args = extractChapters ? "{0} -i {1} -threads 0 -v info -print_format json -show_streams -show_chapters -show_format" : "{0} -i {1} -threads 0 -v info -print_format json -show_streams -show_format"; var process = _processFactory.Create(new ProcessOptions { CreateNoWindow = true, UseShellExecute = false, // Must consume both or ffmpeg may hang due to deadlocks. See comments below. RedirectStandardOutput = true, FileName = FFProbePath, Arguments = string.Format(args, probeSizeArgument, inputPath).Trim(), IsHidden = true, ErrorDialog = false, EnableRaisingEvents = true }); if (forceEnableLogging) { _logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); } else { _logger.LogDebug("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments); } using (var processWrapper = new ProcessWrapper(process, this, _logger)) { StartProcess(processWrapper); try { //process.BeginErrorReadLine(); var result = await _jsonSerializer.DeserializeFromStreamAsync <InternalMediaInfoResult>(process.StandardOutput.BaseStream).ConfigureAwait(false); if (result == null || (result.streams == null && result.format == null)) { throw new Exception("ffprobe failed - streams and format are both null."); } if (result.streams != null) { // Normalize aspect ratio if invalid foreach (var stream in result.streams) { if (string.Equals(stream.display_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase)) { stream.display_aspect_ratio = string.Empty; } if (string.Equals(stream.sample_aspect_ratio, "0:1", StringComparison.OrdinalIgnoreCase)) { stream.sample_aspect_ratio = string.Empty; } } } return(new ProbeResultNormalizer(_logger, FileSystem).GetMediaInfo(result, videoType, isAudio, primaryPath, protocol)); } catch { StopProcess(processWrapper, 100); throw; } } }
/// <summary> /// Gets the media info internal. /// </summary> /// <returns>Task{MediaInfoResult}.</returns> private async Task <MediaInfo> GetMediaInfoInternal( string inputPath, string primaryPath, MediaProtocol protocol, bool extractChapters, string probeSizeArgument, bool isAudio, VideoType?videoType, bool forceEnableLogging, CancellationToken cancellationToken) { var args = extractChapters ? "{0} -i {1} -threads {2} -v warning -print_format json -show_streams -show_chapters -show_format" : "{0} -i {1} -threads {2} -v warning -print_format json -show_streams -show_format"; args = string.Format(CultureInfo.InvariantCulture, args, probeSizeArgument, inputPath, threads).Trim(); var process = new Process { StartInfo = new ProcessStartInfo { CreateNoWindow = true, UseShellExecute = false, // Must consume both or ffmpeg may hang due to deadlocks. See comments below. RedirectStandardOutput = true, FileName = _ffprobePath, Arguments = args, WindowStyle = ProcessWindowStyle.Hidden, ErrorDialog = false, }, EnableRaisingEvents = true }; if (forceEnableLogging) { _logger.LogInformation("{ProcessFileName} {ProcessArgs}", process.StartInfo.FileName, process.StartInfo.Arguments); } else { _logger.LogDebug("{ProcessFileName} {ProcessArgs}", process.StartInfo.FileName, process.StartInfo.Arguments); } using (var processWrapper = new ProcessWrapper(process, this)) { _logger.LogDebug("Starting ffprobe with args {Args}", args); StartProcess(processWrapper); InternalMediaInfoResult result; try { result = await JsonSerializer.DeserializeAsync <InternalMediaInfoResult>( process.StandardOutput.BaseStream, _jsonSerializerOptions, cancellationToken : cancellationToken).ConfigureAwait(false); } catch { StopProcess(processWrapper, 100); throw; } if (result == null || (result.Streams == null && result.Format == null)) { throw new FfmpegException("ffprobe failed - streams and format are both null."); } if (result.Streams != null) { // Normalize aspect ratio if invalid foreach (var stream in result.Streams) { if (string.Equals(stream.DisplayAspectRatio, "0:1", StringComparison.OrdinalIgnoreCase)) { stream.DisplayAspectRatio = string.Empty; } if (string.Equals(stream.SampleAspectRatio, "0:1", StringComparison.OrdinalIgnoreCase)) { stream.SampleAspectRatio = string.Empty; } } } return(new ProbeResultNormalizer(_logger, _localization).GetMediaInfo(result, videoType, isAudio, primaryPath, protocol)); } }
public async Task <SearchResult <VideoViewModel> > Search(string tenantId, string languageId, string keyword, VideoType?type, bool?isActive, int page, int pageSize) { var items = await _videoRepository.Search(tenantId, languageId, keyword, type, isActive, page, pageSize, out var totalRows); return(new SearchResult <VideoViewModel> { Items = items, TotalRows = totalRows }); }
public async Task <IActionResult> Search(string keyword, VideoType?type, bool?isActive, int page = 1, int pageSize = 20) { var result = await _videoService.Search(CurrentUser.TenantId, CultureInfo.CurrentCulture.Name, keyword, type, isActive, page, pageSize); return(Ok(result)); }
protected virtual TVideoType ResolveVideo <TVideoType>(ItemResolveArgs args, bool parseName) where TVideoType : Video, new() { VideoFileInfo videoInfo = null; VideoType? videoType = null; // If the path is a file check for a matching extensions if (args.IsDirectory) { // Loop through each child file/folder and see if we find a video foreach (var child in args.FileSystemChildren) { var filename = child.Name; if (child.IsDirectory) { if (IsDvdDirectory(child.FullName, filename, args.DirectoryService)) { videoType = VideoType.Dvd; } else if (IsBluRayDirectory(filename)) { videoType = VideoType.BluRay; } } else if (IsDvdFile(filename)) { videoType = VideoType.Dvd; } if (videoType == null) { continue; } videoInfo = VideoResolver.ResolveDirectory(args.Path, NamingOptions, parseName); break; } } else { videoInfo = VideoResolver.Resolve(args.Path, false, NamingOptions, parseName); } if (videoInfo == null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions))) { return(null); } var video = new TVideoType { Name = videoInfo.Name, Path = args.Path, ProductionYear = videoInfo.Year, ExtraType = videoInfo.ExtraType }; if (videoType.HasValue) { video.VideoType = videoType.Value; } else { SetVideoType(video, videoInfo); } Set3DFormat(video, videoInfo); return(video); }