public void SetStatus(VideoListItem item, VideoListItemStatusEnum status, string statusText) { item.Status = status; if (statusText != null) { item.StatusText = statusText; } // Store results in cache. scanResults[item.MediaId.Value] = new ScanResultItem(item.Status, item.StatusText); }
/// <summary> /// Returns whether the local file should be replaced by the YouTube version. /// </summary> /// <param name="serverFile">The information of the available server file.</param> /// <param name="localFile">A path to the local file.</param> /// <returns>True if the local file should be replaced.</returns> public async Task <VideoListItemStatusEnum> IsHigherQualityAvailable(BestFormatInfo serverFile, string localFile) { // If there is no local file, it should be downloaded. if (!File.Exists(localFile)) { return(VideoListItemStatusEnum.HigherQualityAvailable); } // Read local file info. string LocalFileExt = Path.GetExtension(localFile).ToLower(); FFmpegProcess InfoReader = await Task.Run(() => MediaInfo.GetFileInfo(localFile)); LastInfoReader = InfoReader; VideoListItemStatusEnum Result = IsHigherQualityAvailableInternal(serverFile, localFile, InfoReader); if (Result == VideoListItemStatusEnum.OK) { // Check if video has right container. string VFormat = InfoReader.VideoStream?.Format; string AFormat = InfoReader.AudioStream?.Format; VFormat = VFormat?.ToLower(); AFormat = AFormat?.ToLower(); if (VFormat == "h264" && (AFormat == null || AFormat == "aac") && LocalFileExt != ".mp4") { return(VideoListItemStatusEnum.WrongContainer); } else if (VFormat == "webm" && (AFormat == null || AFormat == "opus" || AFormat == "vorbis") && LocalFileExt != ".webm") { return(VideoListItemStatusEnum.WrongContainer); } else { return(VideoListItemStatusEnum.OK); } } else { return(Result); } }
public ScanResultItem(VideoListItemStatusEnum status, string statusText) { this.Status = status; this.StatusText = statusText; }
public void SetStatus(VideoListItem item, VideoListItemStatusEnum status) { SetStatus(item, status, null); }
public void SetStatus(VideoListItem item, VideoListItemStatusEnum status, string statusText) { item.Status = status; if (statusText != null) item.StatusText = statusText; // Store results in cache. scanResults[item.MediaId.Value] = new ScanResultItem(item.Status, item.StatusText); }