private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalMovie localMovie, DownloadClientItem downloadClientItem) { try { var result = spec.IsSatisfiedBy(localMovie, downloadClientItem); if (!result.Accepted) { return(new Rejection(result.Reason)); } } catch (NotImplementedException e) { _logger.Warn(e, "Spec " + spec.ToString() + " currently does not implement evaluation for movies."); return(null); } catch (Exception e) { //e.Data.Add("report", remoteEpisode.Report.ToJson()); //e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson()); _logger.Error(e, "Couldn't evaluate decision on " + localMovie.Path); return(new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message))); } return(null); }
private Rejection EvaluateSpec <T>(IImportDecisionEngineSpecification <T> spec, T item, DownloadClientItem downloadClientItem) { try { var result = spec.IsSatisfiedBy(item, downloadClientItem); if (!result.Accepted) { return(new Rejection(result.Reason)); } } catch (Exception e) { _logger.Error(e, "Couldn't evaluate decision on {0}", item); return(new Rejection($"{spec.GetType().Name}: {e.Message}")); } return(null); }
private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalEpisode localEpisode) { try { var result = spec.IsSatisfiedBy(localEpisode); if (!result.Accepted) { return(new Rejection(result.Reason)); } } catch (Exception e) { //e.Data.Add("report", remoteEpisode.Report.ToJson()); //e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson()); _logger.ErrorException("Couldn't evaluate decision on " + localEpisode.Path, e); return(new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message))); } return(null); }
private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalEpisode localEpisode, DownloadClientItem downloadClientItem) { try { var result = spec.IsSatisfiedBy(localEpisode, downloadClientItem); if (!result.Accepted) { return(new Rejection(result.Reason)); } } catch (Exception e) { //e.Data.Add("report", remoteEpisode.Report.ToJson()); //e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson()); _logger.Error(e, "Couldn't evaluate decision on {0}", localEpisode.Path); return(new Rejection($"{spec.GetType().Name}: {e.Message}")); } return(null); }
private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalMovie localMovie, DownloadClientItem downloadClientItem) { try { var result = spec.IsSatisfiedBy(localMovie, downloadClientItem); if (!result.Accepted) { return(new Rejection(result.Reason)); } } catch (NotImplementedException e) { _logger.Warn(e, "Spec " + spec.ToString() + " currently does not implement evaluation for movies."); return(null); } catch (Exception ex) { _logger.Error(ex, "Couldn't evaluate decision on {0}", localMovie.Path); return(new Rejection($"{spec.GetType().Name}: {ex.Message}")); } return(null); }
private Rejection EvaluateSpec(IImportDecisionEngineSpecification spec, LocalEpisode localEpisode) { try { var result = spec.IsSatisfiedBy(localEpisode); if (!result.Accepted) { return new Rejection(result.Reason); } } catch (Exception e) { //e.Data.Add("report", remoteEpisode.Report.ToJson()); //e.Data.Add("parsed", remoteEpisode.ParsedEpisodeInfo.ToJson()); _logger.ErrorException("Couldn't evaluate decision on " + localEpisode.Path, e); return new Rejection(string.Format("{0}: {1}", spec.GetType().Name, e.Message)); } return null; }