Skip to content

Commit

Permalink
Merge pull request #454 from TV-Rename/code-tidy
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
SirSparkles authored Aug 4, 2018
2 parents 3167d73 + 2d38e72 commit 98b375c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
2 changes: 0 additions & 2 deletions TVRename/Finders/FileFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ internal class FileFinder:Finder
{
public FileFinder(TVDoc i) : base(i) { }

private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();

public override bool Active() => TVSettings.Instance.SearchLocally;

public override FinderDisplayType DisplayType() => FinderDisplayType.local;
Expand Down
32 changes: 15 additions & 17 deletions TVRename/Finders/RSSFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ internal class RSSFinder:Finder
{
public RSSFinder(TVDoc i) : base(i) { }

private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();

public override bool Active() => TVSettings.Instance.SearchRSS;

public override FinderDisplayType DisplayType() => FinderDisplayType.rss;
Expand Down Expand Up @@ -63,39 +61,39 @@ public override void Check(SetProgressDelegate prog, int startpct, int totPct)
}

//We now want to rationlise the newItems - just in case we've added duplicates
List<ActionRSS> duplicateActionRSS = new List<ActionRSS>();
List<ActionRSS> duplicateActionRss = new List<ActionRSS>();

foreach (Item x in newItems)
{
if (!(x is ActionRSS testActionRSSOne))
if (!(x is ActionRSS testActionRssOne))
continue;
foreach (Item y in newItems)
{
if (!(y is ActionRSS testActionRSSTwo))
if (!(y is ActionRSS testActionRssTwo))
continue;
if (x.Equals(y)) continue;

string[] preferredTerms = TVSettings.Instance.PreferredRSSSearchTerms();

if (testActionRSSOne.RSS.ShowName.ContainsOneOf(preferredTerms) &&
!testActionRSSTwo.RSS.ShowName.ContainsOneOf(preferredTerms))
if (testActionRssOne.RSS.ShowName.ContainsOneOf(preferredTerms) &&
!testActionRssTwo.RSS.ShowName.ContainsOneOf(preferredTerms))
{
duplicateActionRSS.Add(testActionRSSTwo);
Logger.Info($"Removing {testActionRSSTwo.RSS.URL} as it is not as good a match as {testActionRSSOne.RSS.URL }");
duplicateActionRss.Add(testActionRssTwo);
Logger.Info($"Removing {testActionRssTwo.RSS.URL} as it is not as good a match as {testActionRssOne.RSS.URL }");
}

if (testActionRSSOne.RSS.Title.ContainsOneOf(preferredTerms) &&
!testActionRSSTwo.RSS.Title.ContainsOneOf(preferredTerms))
if (testActionRssOne.RSS.Title.ContainsOneOf(preferredTerms) &&
!testActionRssTwo.RSS.Title.ContainsOneOf(preferredTerms))
{

duplicateActionRSS.Add(testActionRSSTwo);
duplicateActionRss.Add(testActionRssTwo);
Logger.Info(
$"Removing {testActionRSSTwo.RSS.URL} as it is not as good a match as {testActionRSSOne.RSS.URL}");
$"Removing {testActionRssTwo.RSS.URL} as it is not as good a match as {testActionRssOne.RSS.URL}");
}
}
}

foreach (ActionRSS x in duplicateActionRSS)
foreach (ActionRSS x in duplicateActionRss)
newItems.Remove(x);

foreach (Item i in toRemove)
Expand Down Expand Up @@ -133,14 +131,14 @@ public class RSSItemList : List<RSSItem>
private List<FilenameProcessorRE> regxps; // only trustable while in DownloadRSS or its called functions

// ReSharper disable once InconsistentNaming
public bool DownloadRSS(string URL, List<FilenameProcessorRE> rexps)
public bool DownloadRSS(string url, List<FilenameProcessorRE> rexps)
{
regxps = rexps;

System.Net.WebClient wc = new System.Net.WebClient();
try
{
byte[] r = wc.DownloadData(URL);
byte[] r = wc.DownloadData(url);

MemoryStream ms = new MemoryStream(r);

Expand Down Expand Up @@ -240,7 +238,7 @@ private bool ReadItem(XmlReader r)

string showName = "";

TVDoc.FindSeasEp("", title, out int season, out int episode, out int maxEp, null, regxps);
TVDoc.FindSeasEp("", title, out int season, out int episode, out int _, null, regxps);

try
{
Expand Down

0 comments on commit 98b375c

Please sign in to comment.