public bool IsSample(Series series, QualityModel quality, string path, long size, bool isSpecial) { if (isSpecial) { _logger.Debug("Special, skipping sample check"); return(false); } var extension = Path.GetExtension(path); if (extension != null && extension.Equals(".flv", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .flv file"); return(false); } if (extension != null && extension.Equals(".strm", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .strm file"); return(false); } try { var runTime = _videoFileInfoReader.GetRunTime(path); var minimumRuntime = GetMinimumAllowedRuntime(series); if (runTime.TotalMinutes.Equals(0)) { _logger.Error("[{0}] has a runtime of 0, is it a valid video file?", path); return(true); } if (runTime.TotalSeconds < minimumRuntime) { _logger.Debug("[{0}] appears to be a sample. Runtime: {1} seconds. Expected at least: {2} seconds", path, runTime, minimumRuntime); return(true); } } catch (DllNotFoundException) { _logger.Debug("Falling back to file size detection"); return(CheckSize(size, quality)); } _logger.Debug("Runtime is over 90 seconds"); return(false); }
public DetectSampleResult IsSample(Movie movie, string path) { var extension = Path.GetExtension(path); if (extension != null) { if (extension.Equals(".flv", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .flv file"); return(DetectSampleResult.NotSample); } if (extension.Equals(".strm", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .strm file"); return(DetectSampleResult.NotSample); } if (new string[] { ".iso", ".img", ".m2ts" }.Contains(extension, StringComparer.OrdinalIgnoreCase)) { _logger.Debug($"Skipping sample check for DVD/BR image file '{path}'"); return(DetectSampleResult.NotSample); } } // TODO: Use MediaInfo from the import process, no need to re-process the file again here var runTime = _videoFileInfoReader.GetRunTime(path); if (!runTime.HasValue) { _logger.Error("Failed to get runtime from the file, make sure mediainfo is available"); return(DetectSampleResult.Indeterminate); } var minimumRuntime = GetMinimumAllowedRuntime(movie); if (runTime.Value.TotalMinutes.Equals(0)) { _logger.Error("[{0}] has a runtime of 0, is it a valid video file?", path); return(DetectSampleResult.Sample); } if (runTime.Value.TotalSeconds < minimumRuntime) { _logger.Debug("[{0}] appears to be a sample. Runtime: {1} seconds. Expected at least: {2} seconds", path, runTime.Value.TotalSeconds, minimumRuntime); return(DetectSampleResult.Sample); } _logger.Debug("Runtime of {0} is more than {1} seconds, Not Sample", runTime.Value.TotalSeconds, minimumRuntime); return(DetectSampleResult.NotSample); }
public bool IsSample(Series series, QualityModel quality, string path, long size, int seasonNumber) { if (seasonNumber == 0 && series.SeriesType == SeriesTypes.Standard) { _logger.Debug("Special, skipping sample check"); return(false); } var extension = Path.GetExtension(path); if (extension != null && extension.Equals(".flv", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .flv file"); return(false); } if (extension != null && extension.Equals(".strm", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .strm file"); return(false); } try { var runTime = _videoFileInfoReader.GetRunTime(path); if (runTime.TotalMinutes.Equals(0)) { _logger.Error("[{0}] has a runtime of 0, is it a valid video file?", path); return(true); } if (runTime.TotalSeconds < 90) { _logger.Debug("[{0}] appears to be a sample. Size: {1} Runtime: {2}", path, size, runTime); return(true); } } catch (DllNotFoundException) { _logger.Debug("Falling back to file size detection"); return(CheckSize(size, quality)); } _logger.Debug("Runtime is over 90 seconds"); return(false); }
public DetectSampleResult IsSample(Series series, string path, bool isSpecial) { if (isSpecial) { _logger.Debug("Special, skipping sample check"); return(DetectSampleResult.NotSample); } var extension = Path.GetExtension(path); if (extension != null && extension.Equals(".flv", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .flv file"); return(DetectSampleResult.NotSample); } if (extension != null && extension.Equals(".strm", StringComparison.InvariantCultureIgnoreCase)) { _logger.Debug("Skipping sample check for .strm file"); return(DetectSampleResult.NotSample); } // TODO: Use MediaInfo from the import process, no need to re-process the file again here var runTime = _videoFileInfoReader.GetRunTime(path); if (!runTime.HasValue) { _logger.Error("Failed to get runtime from the file, make sure mediainfo is available"); return(DetectSampleResult.Indeterminate); } var minimumRuntime = GetMinimumAllowedRuntime(series); if (runTime.Value.TotalMinutes.Equals(0)) { _logger.Error("[{0}] has a runtime of 0, is it a valid video file?", path); return(DetectSampleResult.Sample); } if (runTime.Value.TotalSeconds < minimumRuntime) { _logger.Debug("[{0}] appears to be a sample. Runtime: {1} seconds. Expected at least: {2} seconds", path, runTime, minimumRuntime); return(DetectSampleResult.Sample); } _logger.Debug("Runtime is over 90 seconds"); return(DetectSampleResult.NotSample); }
public bool IsSatisfiedBy(LocalEpisode localEpisode) { if (localEpisode.Series.SeriesType == SeriesTypes.Daily) { _logger.Trace("Daily Series, skipping sample check"); return(true); } if (localEpisode.SeasonNumber == 0) { _logger.Trace("Special, skipping sample check"); return(true); } if (Path.GetExtension(localEpisode.Path).Equals(".flv", StringComparison.InvariantCultureIgnoreCase)) { _logger.Trace("Skipping smaple check for .flv file"); return(true); } if (localEpisode.Size > SampleSizeLimit) { return(true); } var runTime = _videoFileInfoReader.GetRunTime(localEpisode.Path); if (runTime.TotalMinutes.Equals(0)) { _logger.Error("[{0}] has a runtime of 0, is it a valid video file?", localEpisode); return(false); } if (runTime.TotalMinutes < 3) { _logger.Trace("[{0}] appears to be a sample. Size: {1} Runtime: {2}", localEpisode.Path, localEpisode.Size, runTime); return(false); } return(true); }