Issue with overwriting user settings for Indexers resolved.

Reworked RssSyncProvider to make it cleaner.

SeasonProvider was returning the reveresed boolean result

Indexer changed to not store empty strings as null when saving config (ApiUrl).
pull/4/head
markus101 14 years ago
parent d83ae9895c
commit a7780fab67

@ -66,7 +66,7 @@ namespace NzbDrone.Core
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
_kernel.Bind<IRssProvider>().To<RssProvider>().InSingletonScope();
_kernel.Bind<IRssSyncProvider>().To<RssSyncProvider>().InSingletonScope();
_kernel.Bind<IIndexerProvider>().To<IndexerProvider>().InSingletonScope();;
_kernel.Bind<IIndexerProvider>().To<IndexerProvider>().InSingletonScope(); ;
_kernel.Bind<INotificationProvider>().To<NotificationProvider>().InSingletonScope();
_kernel.Bind<ILogProvider>().To<LogProvider>().InSingletonScope();
_kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope();
@ -176,7 +176,6 @@ namespace NzbDrone.Core
IndexerName = "NzbMatrix",
RssUrl = nzbMatrixRss,
ApiUrl = String.Empty,
Enabled = false,
Order = 1
};
@ -185,7 +184,6 @@ namespace NzbDrone.Core
IndexerName = "NzbsOrg",
RssUrl = nzbsOrgRss,
ApiUrl = String.Empty,
Enabled = false,
Order = 2
};
@ -194,13 +192,13 @@ namespace NzbDrone.Core
IndexerName = "Nzbsrus",
RssUrl = nzbsrusRss,
ApiUrl = String.Empty,
Enabled = false,
Order = 3
};
//NzbMatrix
Logger.Debug("Checking for NzbMatrix Indexer");
if (!repository.Exists<Indexer>(i => i.IndexerName == "NzbMatrix"))
var nzbMatix = repository.Single<Indexer>("NzbMatrix");
if (nzbMatix == null)
{
Logger.Debug("Adding new Indexer: NzbMatrix");
repository.Add(nzbMatrixIndexer);
@ -209,12 +207,15 @@ namespace NzbDrone.Core
else
{
Logger.Debug("Updating Indexer: NzbMatrix");
repository.Update(nzbMatrixIndexer);
nzbMatix.RssUrl = nzbMatrixIndexer.RssUrl;
nzbMatix.ApiUrl = nzbMatrixIndexer.ApiUrl;
repository.Update(nzbMatix);
}
//Nzbs.org
Logger.Debug("Checking for Nzbs.org");
if (!repository.Exists<Indexer>(i => i.IndexerName == "NzbsOrg"))
var nzbsOrg = repository.Single<Indexer>("NzbsOrg");
if (nzbsOrg == null)
{
Logger.Debug("Adding new Indexer: Nzbs.org");
repository.Add(nzbsOrgIndexer);
@ -223,12 +224,15 @@ namespace NzbDrone.Core
else
{
Logger.Debug("Updating Indexer: Nzbs.org");
repository.Update(nzbsOrgIndexer);
nzbsOrg.RssUrl = nzbsOrgIndexer.RssUrl;
nzbsOrg.ApiUrl = nzbsOrgIndexer.ApiUrl;
repository.Update(nzbsOrg);
}
//Nzbsrus
Logger.Debug("Checking for Nzbsrus");
if (!repository.Exists<Indexer>(i => i.IndexerName == "Nzbsrus"))
var nzbsrus = repository.Single<Indexer>("Nzbsrus");
if (nzbsrus == null)
{
Logger.Debug("Adding new Indexer: Nzbsrus");
repository.Add(nzbsrusIndexer);
@ -237,7 +241,9 @@ namespace NzbDrone.Core
else
{
Logger.Debug("Updating Indexer: Nzbsrus");
repository.Update(nzbsrusIndexer);
nzbsrus.RssUrl = nzbsOrgIndexer.RssUrl;
nzbsrus.ApiUrl = nzbsOrgIndexer.ApiUrl;
repository.Update(nzbsrus);
}
}
@ -246,42 +252,42 @@ namespace NzbDrone.Core
var sdtv = new QualityProfile
{
Name = "SDTV",
Allowed = new List<QualityTypes> {QualityTypes.TV},
Allowed = new List<QualityTypes> { QualityTypes.TV },
Cutoff = QualityTypes.TV
};
var dvd = new QualityProfile
{
Name = "DVD SD",
Allowed = new List<QualityTypes> {QualityTypes.DVD},
Allowed = new List<QualityTypes> { QualityTypes.DVD },
Cutoff = QualityTypes.DVD
};
var bdrip = new QualityProfile
{
Name = "BDRip",
Allowed = new List<QualityTypes> {QualityTypes.BDRip},
Allowed = new List<QualityTypes> { QualityTypes.BDRip },
Cutoff = QualityTypes.BDRip
};
var hdtv = new QualityProfile
{
Name = "HDTV",
Allowed = new List<QualityTypes> {QualityTypes.HDTV},
Allowed = new List<QualityTypes> { QualityTypes.HDTV },
Cutoff = QualityTypes.HDTV
};
var webdl = new QualityProfile
{
Name = "WEBDL",
Allowed = new List<QualityTypes> {QualityTypes.WEBDL},
Allowed = new List<QualityTypes> { QualityTypes.WEBDL },
Cutoff = QualityTypes.WEBDL
};
var bluray = new QualityProfile
{
Name = "Bluray",
Allowed = new List<QualityTypes> {QualityTypes.Bluray},
Allowed = new List<QualityTypes> { QualityTypes.Bluray },
Cutoff = QualityTypes.Bluray
};

@ -87,9 +87,10 @@ namespace NzbDrone.Core.Providers
{
Logger.Info("Starting RSS Sync for: {0}", i.IndexerName);
//Need to insert the users information in the the URL before trying to use it
i.RssUrl = GetUsersUrl(i); //Get the new users specific url (with their information) to use for the Sync
GetUsersUrl(i); //Get the new users specific url (with their information) to use for the Sync
if (i.RssUrl == null)
//If the url still contains '{' & '}' the user probably hasn't configured the indexer settings
if (i.RssUrl.Contains("{") && i.RssUrl.Contains("}"))
{
Logger.Debug("Unable to Sync {0}. User Information has not been configured.", i.IndexerName);
continue; //Skip this indexer
@ -200,7 +201,7 @@ namespace NzbDrone.Core.Providers
return String.Format("{0} - {1}{2} - {3}", series.Title, seasonNumber, episodeNumbers, episodeTitles);
}
private string GetUsersUrl(Indexer indexer)
private void GetUsersUrl(Indexer indexer)
{
if (indexer.IndexerName == "NzbMatrix")
{
@ -208,10 +209,10 @@ namespace NzbDrone.Core.Providers
var nzbMatrixApiKey = _configProvider.GetValue("NzbMatrixApiKey", String.Empty, false);
if (!String.IsNullOrEmpty(nzbMatrixUsername) && !String.IsNullOrEmpty(nzbMatrixApiKey))
return indexer.RssUrl.Replace("{USERNAME}", nzbMatrixUsername).Replace("{APIKEY}", nzbMatrixApiKey);
indexer.RssUrl = indexer.RssUrl.Replace("{USERNAME}", nzbMatrixUsername).Replace("{APIKEY}", nzbMatrixApiKey);
//Todo: Perform validation at the config level so a user is unable to enable a provider until user details are provided
return null; //Return Null if Provider is enabled, but user information is not supplied.
return;
}
if (indexer.IndexerName == "NzbsOrg")
@ -220,10 +221,10 @@ namespace NzbDrone.Core.Providers
var nzbsOrgHash = _configProvider.GetValue("NzbsOrgHash", String.Empty, false);
if (!String.IsNullOrEmpty(nzbsOrgUId) && !String.IsNullOrEmpty(nzbsOrgHash))
return indexer.RssUrl.Replace("{UID}", nzbsOrgUId).Replace("{HASH}", nzbsOrgHash);
indexer.RssUrl = indexer.RssUrl.Replace("{UID}", nzbsOrgUId).Replace("{HASH}", nzbsOrgHash);
//Todo: Perform validation at the config level so a user is unable to enable a provider until user details are provided
return null; //Return Null if Provider is enabled, but user information is not supplied.
return;
}
if (indexer.IndexerName == "NzbsOrg")
@ -232,13 +233,13 @@ namespace NzbDrone.Core.Providers
var nzbsrusHash = _configProvider.GetValue("NzbsrusHash", String.Empty, false);
if (!String.IsNullOrEmpty(nzbsrusUId) && !String.IsNullOrEmpty(nzbsrusHash))
return indexer.RssUrl.Replace("{UID}", nzbsrusUId).Replace("{HASH}", nzbsrusHash);
indexer.RssUrl = indexer.RssUrl.Replace("{UID}", nzbsrusUId).Replace("{HASH}", nzbsrusHash);
//Todo: Perform validation at the config level so a user is unable to enable a provider until user details are provided
return null; //Return Null if Provider is enabled, but user information is not supplied.
return;
}
return indexer.RssUrl; //Currently other providers do not require user information to be substituted, simply return the RssUrl
return; //Currently other providers do not require user information to be substituted, simply return
}
}
}

@ -57,19 +57,19 @@ namespace NzbDrone.Core.Providers
public bool IsIgnored(int seasonId)
{
if (_sonicRepo.Single<Season>(seasonId).Monitored)
return true;
return false;
Logger.Debug("Season {0} is not wanted.");
return false;
return true;
}
public bool IsIgnored(int seriesId, int seasonNumber)
{
if (_sonicRepo.Single<Season>(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber).Monitored)
return true;
return false;
Logger.Debug("Season: {0} is not wanted for Series: {1}", seasonNumber, seriesId);
return false;
return true;
}
}
}

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using SubSonic.SqlGeneration.Schema;
@ -9,11 +10,12 @@ namespace NzbDrone.Core.Repository
{
public class Indexer
{
[SubSonicPrimaryKey (true)]
[SubSonicPrimaryKey(true)]
public string IndexerName { get; set; }
public string RssUrl { get; set; }
[SubSonicNullStringAttribute]
[DisplayFormat(ConvertEmptyStringToNull = false)]
public string ApiUrl { get; set; }
public bool Enabled { get; set; }
public int Order { get; set; }

Loading…
Cancel
Save