1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00

Fixed a bug with converting default quality profile from config when adding a new series.

Re-enabled the RssSyncTimer so it will run an RSS Sync when fired.
This commit is contained in:
markus101 2011-02-15 20:44:19 -08:00
parent da79ad147e
commit 735668f7b3
4 changed files with 22 additions and 25 deletions

View File

@ -74,7 +74,7 @@ public bool IsNeeded(EpisodeModel episode)
if (IsSeasonIgnored(episode))
return false;
if (!_series.QualityWanted(episode.SeriesId, episode.Quality))
{
Logger.Debug("Quality [{0}] is not wanted for: {1}", episode.Quality, episode.SeriesTitle);
@ -86,7 +86,7 @@ public bool IsNeeded(EpisodeModel episode)
episode.EpisodeId = dbEpisode.EpisodeId;
var epWithFiles = _sonicRepo.Single<Episode>(c => c.EpisodeId == episode.EpisodeId && c.Files.Count > 0);
if (epWithFiles != null)
{
//If not null we need to see if this episode has the quality as the download (or if it is better)
@ -104,7 +104,7 @@ public bool IsNeeded(EpisodeModel episode)
return false;
}
throw new NotImplementedException();
return true;
}
public void RefreshEpisodeInfo(int seriesId)

View File

@ -108,7 +108,7 @@ public void AddSeries(string path, TvdbSeries series)
repoSeries.Path = path;
repoSeries.CleanTitle = Parser.NormalizeTitle(series.SeriesName);
repoSeries.Monitored = true; //New shows should be monitored
repoSeries.QualityProfile = (QualityProfile) Enum.Parse(typeof (QualityProfile), _config.GetValue("Quality", 1, true));
repoSeries.QualityProfile = _quality.Find(Convert.ToInt32(_config.GetValue("Quality", 1, true)));
_sonioRepo.Add(repoSeries);
}

View File

@ -36,7 +36,7 @@ public TimerProvider(IRssSyncProvider rssSyncProvider, ISeriesProvider seriesPro
public void ResetRssSyncTimer()
{
double interval = _rssSyncTimer.Interval;
_rssSyncTimer .Interval= interval;
_rssSyncTimer.Interval = interval;
}
public void StartRssSyncTimer()
@ -47,7 +47,7 @@ public void StartRssSyncTimer()
throw new InvalidOperationException("RSS Sync Frequency Invalid");
}
_rssSyncTimer.Elapsed +=new ElapsedEventHandler(RunRssSync);
_rssSyncTimer.Elapsed += new ElapsedEventHandler(RunRssSync);
_rssSyncTimer.Start();
_rssSyncNextInterval = DateTime.Now.AddMilliseconds(_rssSyncTimer.Interval);
}
@ -59,7 +59,7 @@ public void StopRssSyncTimer()
public void SetRssSyncTimer(int minutes)
{
long ms = minutes*60*1000;
long ms = minutes * 60 * 1000;
_rssSyncTimer.Interval = ms;
}
@ -89,7 +89,7 @@ public void StopMinuteTimer()
private void RunRssSync(object obj, ElapsedEventArgs args)
{
_rssSyncNextInterval = DateTime.Now.AddMilliseconds(_rssSyncTimer.Interval);
//_rssSyncProvider.Begin();
_rssSyncProvider.Begin();
}
private void MinuteTimer_Elapsed(object obj, ElapsedEventArgs args)

View File

@ -144,8 +144,8 @@ public QualityModel GetUpdatedProfileList()
var profiles = _qualityProvider.GetAllProfiles().ToList();
var defaultQualityProfileId = Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].ProfileId, true));
var selectList = new SelectList(profiles, "ProfileId", "Name");
return new QualityModel {DefaultProfileId = defaultQualityProfileId, SelectList = selectList};
return new QualityModel { DefaultProfileId = defaultQualityProfileId, SelectList = selectList };
}
[HttpPost]
@ -157,7 +157,7 @@ public ActionResult SaveGeneral(SettingsModel data)
return Content(_settingsSaved);
}
return Content(_settingsFailed);
return Content(_settingsFailed);
}
[HttpPost]
@ -167,10 +167,7 @@ public ActionResult SaveIndexers(IndexerSettingsModel data)
{
//Todo: Only allow indexers to be enabled if user information has been provided
foreach (var indexer in data.Indexers)
{
indexer.ApiUrl = String.Empty; //TODO: Remove this and use a Real API URL
_indexerProvider.Update(indexer);
}
_configProvider.SetValue("NzbMatrixUsername", data.NzbMatrixUsername);
_configProvider.SetValue("NzbMatrixApiKey", data.NzbMatrixApiKey);
@ -190,18 +187,18 @@ public ActionResult SaveDownloads(DownloadSettingsModel data)
{
if (ModelState.IsValid)
{
_configProvider.SetValue("SyncFrequency", data.SyncFrequency.ToString());
_configProvider.SetValue("DownloadPropers", data.DownloadPropers.ToString());
_configProvider.SetValue("Retention", data.Retention.ToString());
_configProvider.SetValue("SabHost", data.SabHost);
_configProvider.SetValue("SabPort", data.SabPort.ToString());
_configProvider.SetValue("SabApiKey", data.SabApiKey);
_configProvider.SetValue("SabUsername", data.SabUsername);
_configProvider.SetValue("SabPassword", data.SabPassword);
_configProvider.SetValue("SabCategory", data.SabCategory);
_configProvider.SetValue("SabPriority", data.SabPriority.ToString());
_configProvider.SetValue("SyncFrequency", data.SyncFrequency.ToString());
_configProvider.SetValue("DownloadPropers", data.DownloadPropers.ToString());
_configProvider.SetValue("Retention", data.Retention.ToString());
_configProvider.SetValue("SabHost", data.SabHost);
_configProvider.SetValue("SabPort", data.SabPort.ToString());
_configProvider.SetValue("SabApiKey", data.SabApiKey);
_configProvider.SetValue("SabUsername", data.SabUsername);
_configProvider.SetValue("SabPassword", data.SabPassword);
_configProvider.SetValue("SabCategory", data.SabCategory);
_configProvider.SetValue("SabPriority", data.SabPriority.ToString());
return Content(_settingsSaved);
return Content(_settingsSaved);
}
return Content(_settingsFailed);