mirror of https://github.com/Sonarr/Sonarr
Removed leftover code from old ages ;)
This commit is contained in:
parent
907c508a70
commit
ef9bbdc60e
Binary file not shown.
|
@ -60,17 +60,6 @@ namespace NzbDrone.Core.Providers
|
|||
return GetAllSeries().Any(c => c.SeriesId == id && c.Monitored);
|
||||
}
|
||||
|
||||
public virtual TvdbSeries MapPathToSeries(string path)
|
||||
{
|
||||
var seriesPath = new DirectoryInfo(path);
|
||||
var searchResults = _tvDbProvider.GetSeries(seriesPath.Name);
|
||||
|
||||
if (searchResults == null)
|
||||
return null;
|
||||
|
||||
return _tvDbProvider.GetSeries(searchResults.Id, false);
|
||||
}
|
||||
|
||||
public virtual Series UpdateSeriesInfo(int seriesId)
|
||||
{
|
||||
var tvDbSeries = _tvDbProvider.GetSeries(seriesId, true);
|
||||
|
|
|
@ -38,43 +38,6 @@ namespace NzbDrone.Core.Providers
|
|||
}
|
||||
|
||||
|
||||
public virtual TvdbSearchResult GetSeries(string title)
|
||||
{
|
||||
lock (_handler)
|
||||
{
|
||||
var searchResults = SearchSeries(title);
|
||||
if (searchResults.Count == 0)
|
||||
return null;
|
||||
|
||||
foreach (var tvdbSearchResult in searchResults)
|
||||
{
|
||||
if (IsTitleMatch(tvdbSearchResult.SeriesName, title))
|
||||
{
|
||||
Logger.Debug("Search for '{0}' was successful", title);
|
||||
return tvdbSearchResult;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual int GetBestMatch(List<TvdbSearchResult> searchResults, string title)
|
||||
{
|
||||
if (searchResults.Count == 0)
|
||||
return 0;
|
||||
|
||||
foreach (var tvdbSearchResult in searchResults)
|
||||
{
|
||||
if (IsTitleMatch(tvdbSearchResult.SeriesName, title))
|
||||
{
|
||||
Logger.Debug("Search for '{0}' was successful", title);
|
||||
return tvdbSearchResult.Id;
|
||||
}
|
||||
}
|
||||
|
||||
return searchResults[0].Id;
|
||||
}
|
||||
|
||||
public virtual TvdbSeries GetSeries(int id, bool loadEpisodes)
|
||||
{
|
||||
lock (_handler)
|
||||
|
@ -116,34 +79,5 @@ namespace NzbDrone.Core.Providers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a title in a search result is equal to the title searched for.
|
||||
/// </summary>
|
||||
/// <param name = "directoryName">Name of the directory.</param>
|
||||
/// <param name = "tvdbTitle">The TVDB title.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the titles are found to be same; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public static bool IsTitleMatch(string directoryName, string tvdbTitle)
|
||||
{
|
||||
var result = false;
|
||||
|
||||
if (String.IsNullOrEmpty(directoryName))
|
||||
throw new ArgumentException("directoryName");
|
||||
if (String.IsNullOrEmpty(tvdbTitle))
|
||||
throw new ArgumentException("tvdbTitle");
|
||||
|
||||
if (String.Equals(directoryName, tvdbTitle, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if (String.Equals(CleanUpRegex.Replace(directoryName, ""), CleanUpRegex.Replace(tvdbTitle, ""),
|
||||
StringComparison.InvariantCultureIgnoreCase))
|
||||
result = true;
|
||||
|
||||
Logger.Debug("Match between '{0}' and '{1}' was {2}", tvdbTitle, directoryName, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue