Skip to content

Commit

Permalink
Merge pull request #459 from TV-Rename/code-tidy
Browse files Browse the repository at this point in the history
Code tidy
  • Loading branch information
SirSparkles authored Aug 5, 2018
2 parents 4d953b9 + 13d873f commit 4c06121
Show file tree
Hide file tree
Showing 57 changed files with 1,762 additions and 1,762 deletions.
2 changes: 1 addition & 1 deletion TVRename/App/ApplicationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static void ConvertSeriesTimeZones(TVDoc doc, TheTVDB tvdb)

foreach (ShowItem si in doc.Library.GetShowItems())
{
string newTimeZone = tvdb.GetSeries(si.TVDBCode)?.TempTimeZone;
string newTimeZone = tvdb.GetSeries(si.TvdbCode)?.TempTimeZone;

if (string.IsNullOrWhiteSpace(newTimeZone)) continue;
if ( newTimeZone == TimeZone.DefaultTimeZone() ) continue;
Expand Down
8 changes: 4 additions & 4 deletions TVRename/App/AutoFolderMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,20 @@ void mScanDelayTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
switch (TVSettings.Instance.MonitoredFoldersScanType)
{
case TVSettings.ScanType.Full:
mainForm.Invoke(mainForm.AFMFullScan);
mainForm.Invoke(mainForm.AfmFullScan);
break;
case TVSettings.ScanType.Recent:
mainForm.Invoke(mainForm.AFMRecentScan);
mainForm.Invoke(mainForm.AfmRecentScan);
break;
case TVSettings.ScanType.Quick:
mainForm.Invoke(mainForm.AFMQuickScan);
mainForm.Invoke(mainForm.AfmQuickScan);
break;
case TVSettings.ScanType.SingleShow:
default:
throw new ArgumentException("Inappropriate action for auto-scan " + TVSettings.Instance.MonitoredFoldersScanType);
}

mainForm.Invoke(mainForm.AFMDoAll);
mainForm.Invoke(mainForm.AfmDoAll);

}

Expand Down
12 changes: 6 additions & 6 deletions TVRename/App/CommandLineArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public class CommandLineArgs
/// </summary>
public enum MissingFolderBehavior
{
Ask,
Ignore,
Create
ask,
ignore,
create
}

public bool Help { get; }
Expand Down Expand Up @@ -54,15 +54,15 @@ public CommandLineArgs(ReadOnlyCollection<string> args)

if (args.Contains("/createmissing", StringComparer.OrdinalIgnoreCase))
{
MissingFolder = MissingFolderBehavior.Create;
MissingFolder = MissingFolderBehavior.create;
}
else if (args.Contains("/ignoremissing", StringComparer.OrdinalIgnoreCase))
{
MissingFolder = MissingFolderBehavior.Ignore;
MissingFolder = MissingFolderBehavior.ignore;
}
else
{
MissingFolder = MissingFolderBehavior.Ask;
MissingFolder = MissingFolderBehavior.ask;
}
}

Expand Down
2 changes: 1 addition & 1 deletion TVRename/App/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private static void Main(string[] args)
ipc.RenameBehavior = false;
}

if (clargs.MissingFolder != CommandLineArgs.MissingFolderBehavior.Ask)
if (clargs.MissingFolder != CommandLineArgs.MissingFolderBehavior.ask)
{
// Temporarily override behavior for missing folders
ipc.MissingFolderBehavior = clargs.MissingFolder;
Expand Down
2 changes: 1 addition & 1 deletion TVRename/Custom Controls/TheTVDBCodeFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private void Search()

//String ^url = "http://www.tv.com/search.php?stype=program&qs="+txtFindThis->Text+"&type=11&stype=search&tag=search%3Bbutton";

if (!String.IsNullOrEmpty(txtFindThis.Text))
if (!string.IsNullOrEmpty(txtFindThis.Text))
{
TheTVDB.Instance.Search(txtFindThis.Text);
DoFind(true);
Expand Down
2 changes: 1 addition & 1 deletion TVRename/DownloadIdentifers/DownloadEpisodeJPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bo
FileInfo imgjpg = FileHelper.FileInFolder(filo.Directory, basefn + DEFAULT_EXTENSION);

if (forceRefresh || !imgjpg.Exists)
theActionList.Add(new ActionDownloadImage(dbep.SI, dbep, imgjpg, ban, TVSettings.Instance.ShrinkLargeMede8erImages));
theActionList.Add(new ActionDownloadImage(dbep.Show, dbep, imgjpg, ban, TVSettings.Instance.ShrinkLargeMede8erImages));

return theActionList;
}
Expand Down
2 changes: 1 addition & 1 deletion TVRename/DownloadIdentifers/DownloadFanartJPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
if ((TVSettings.Instance.FanArtJpg) && !TVSettings.Instance.KODIImages)
{
ItemList theActionList = new ItemList();
FileInfo fi = FileHelper.FileInFolder(si.AutoAdd_FolderBase, DEFAULT_FILE_NAME);
FileInfo fi = FileHelper.FileInFolder(si.AutoAddFolderBase, DEFAULT_FILE_NAME);

bool doesntExist = !fi.Exists;
if ((forceRefresh ||doesntExist) &&(!DoneFanartJpg.Contains(fi.FullName)))
Expand Down
2 changes: 1 addition & 1 deletion TVRename/DownloadIdentifers/DownloadJolderJPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
if (!TVSettings.Instance.FolderJpg) return null;

ItemList theActionList = new ItemList();
FileInfo fi = FileHelper.FileInFolder(si.AutoAdd_FolderBase, DEFAULT_FILE_NAME);
FileInfo fi = FileHelper.FileInFolder(si.AutoAddFolderBase, DEFAULT_FILE_NAME);
bool fileDoesntExist = !doneFolderJpg.Contains(fi.FullName) && !fi.Exists;

if (forceRefresh || fileDoesntExist)
Expand Down
4 changes: 2 additions & 2 deletions TVRename/DownloadIdentifers/DownloadMede8erMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
{
ItemList theActionList = new ItemList();

FileInfo tvshowxml = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "series.xml");
FileInfo tvshowxml = FileHelper.FileInFolder(si.AutoAddFolderBase, "series.xml");

bool needUpdate = !tvshowxml.Exists ||
(si.TheSeries().SrvLastUpdated > TimeZone.Epoch(tvshowxml.LastWriteTime));
Expand All @@ -35,7 +35,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
}

//Updates requested by [email protected] on 18/4/2013
FileInfo viewxml = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "View.xml");
FileInfo viewxml = FileHelper.FileInFolder(si.AutoAddFolderBase, "View.xml");
if ((!viewxml.Exists) && (!doneFiles.Contains(viewxml.FullName)))
{
doneFiles.Add(viewxml.FullName);
Expand Down
32 changes: 16 additions & 16 deletions TVRename/DownloadIdentifers/DownloadXBMCImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,39 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
{
ItemList theActionList = new ItemList();
// base folder:
if (!string.IsNullOrEmpty(si.AutoAdd_FolderBase) && (si.AllFolderLocations(false).Count > 0))
if (!string.IsNullOrEmpty(si.AutoAddFolderBase) && (si.AllFolderLocations(false).Count > 0))
{
FileInfo posterJpg = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "poster.jpg");
FileInfo bannerJpg = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "banner.jpg");
FileInfo fanartJpg = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "fanart.jpg");
FileInfo posterJpg = FileHelper.FileInFolder(si.AutoAddFolderBase, "poster.jpg");
FileInfo bannerJpg = FileHelper.FileInFolder(si.AutoAddFolderBase, "banner.jpg");
FileInfo fanartJpg = FileHelper.FileInFolder(si.AutoAddFolderBase, "fanart.jpg");

if ((forceRefresh || (!posterJpg.Exists)) && (!donePosterJpg.Contains(si.AutoAdd_FolderBase)))
if ((forceRefresh || (!posterJpg.Exists)) && (!donePosterJpg.Contains(si.AutoAddFolderBase)))
{
string path = si.TheSeries().GetSeriesPosterPath();
if (!string.IsNullOrEmpty(path))
{
theActionList.Add(new ActionDownloadImage(si, null, posterJpg, path, false));
donePosterJpg.Add(si.AutoAdd_FolderBase);
donePosterJpg.Add(si.AutoAddFolderBase);
}
}

if ((forceRefresh || (!bannerJpg.Exists)) && (!doneBannerJpg.Contains(si.AutoAdd_FolderBase)))
if ((forceRefresh || (!bannerJpg.Exists)) && (!doneBannerJpg.Contains(si.AutoAddFolderBase)))
{
string path = si.TheSeries().GetSeriesWideBannerPath();
if (!string.IsNullOrEmpty(path))
{
theActionList.Add(new ActionDownloadImage(si, null, bannerJpg, path, false));
doneBannerJpg.Add(si.AutoAdd_FolderBase);
doneBannerJpg.Add(si.AutoAddFolderBase);
}
}

if ((forceRefresh || (!fanartJpg.Exists)) && (!doneFanartJpg.Contains(si.AutoAdd_FolderBase)))
if ((forceRefresh || (!fanartJpg.Exists)) && (!doneFanartJpg.Contains(si.AutoAddFolderBase)))
{
string path = si.TheSeries().GetSeriesFanartPath();
if (!string.IsNullOrEmpty(path))
{
theActionList.Add(new ActionDownloadImage(si, null, fanartJpg, path));
doneFanartJpg.Add(si.AutoAdd_FolderBase);
doneFanartJpg.Add(si.AutoAddFolderBase);
}
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ public override ItemList ProcessSeason(ShowItem si, string folder, int snum, boo
else if (snum < 10) filenamePrefix += "0" + snum;
else filenamePrefix += snum;

FileInfo posterTbn = FileHelper.FileInFolder(si.AutoAdd_FolderBase, filenamePrefix + ".tbn");
FileInfo posterTbn = FileHelper.FileInFolder(si.AutoAddFolderBase, filenamePrefix + ".tbn");
if (forceRefresh || !posterTbn.Exists)
{
string path = si.TheSeries().GetSeasonBannerPath(snum);
Expand All @@ -149,22 +149,22 @@ public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bo
if (TVSettings.Instance.EpTBNs || TVSettings.Instance.KODIImages)
{
ItemList theActionList = new ItemList();
if (dbep.type == ProcessedEpisode.ProcessedEpisodeType.merged)
if (dbep.Type == ProcessedEpisode.ProcessedEpisodeType.merged)
{
//We have a merged episode, so we'll also download the images for the episodes had they been separate.
foreach (Episode sourceEp in dbep.sourceEpisodes)
foreach (Episode sourceEp in dbep.SourceEpisodes)
{
string foldername = filo.DirectoryName;
string filename =
TVSettings.Instance.FilenameFriendly(
TVSettings.Instance.NamingStyle.GetTargetEpisodeName(sourceEp,dbep.SI.ShowName, dbep.SI.GetTimeZone(), dbep.SI.DVDOrder));
ActionDownloadImage b = DoEpisode(dbep.SI,sourceEp,new FileInfo(foldername+"/"+filename), ".jpg", forceRefresh);
TVSettings.Instance.NamingStyle.GetTargetEpisodeName(sourceEp,dbep.Show.ShowName, dbep.Show.GetTimeZone(), dbep.Show.DvdOrder));
ActionDownloadImage b = DoEpisode(dbep.Show,sourceEp,new FileInfo(foldername+"/"+filename), ".jpg", forceRefresh);
if (b != null) theActionList.Add(b);
}
}
else
{
ActionDownloadImage a = DoEpisode(dbep.SI, dbep, filo, ".tbn", forceRefresh);
ActionDownloadImage a = DoEpisode(dbep.Show, dbep, filo, ".tbn", forceRefresh);
if (a != null) theActionList.Add(a);
}
return theActionList;
Expand Down
2 changes: 1 addition & 1 deletion TVRename/DownloadIdentifers/DownloadXBMCMetaData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
if (TVSettings.Instance.NFOShows)
{
ItemList theActionList = new ItemList();
FileInfo tvshownfo = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "tvshow.nfo");
FileInfo tvshownfo = FileHelper.FileInFolder(si.AutoAddFolderBase, "tvshow.nfo");

bool needUpdate = !tvshownfo.Exists ||
(si.TheSeries().SrvLastUpdated > TimeZone.Epoch(tvshownfo.LastWriteTime)) ||
Expand Down
2 changes: 1 addition & 1 deletion TVRename/DownloadIdentifers/IncorrectFileDates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
if (newUpdateTime.Value.CompareTo(Helpers.WindowsStartDateTime) < 0)
newUpdateTime = Helpers.WindowsStartDateTime;

DirectoryInfo di = new DirectoryInfo(si.AutoAdd_FolderBase);
DirectoryInfo di = new DirectoryInfo(si.AutoAddFolderBase);
if ((di.LastWriteTimeUtc != newUpdateTime.Value)&&(!doneFilesAndFolders.Contains(di.FullName)))
{
doneFilesAndFolders.Add(di.FullName);
Expand Down
2 changes: 1 addition & 1 deletion TVRename/Exporter/MissingXML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override void Run()
ItemMissing missing = (ItemMissing)(action);
writer.WriteStartElement("MissingItem");

XmlHelper.WriteElementToXml(writer,"id",missing.Episode.SI.TVDBCode);
XmlHelper.WriteElementToXml(writer,"id",missing.Episode.Show.TvdbCode);
XmlHelper.WriteElementToXml(writer, "title",missing.Episode.TheSeries.Name);
XmlHelper.WriteElementToXml(writer, "season", Helpers.Pad(missing.Episode.AppropriateSeasonNumber));
XmlHelper.WriteElementToXml(writer, "episode", Helpers.Pad(missing.Episode.AppropriateEpNum));
Expand Down
4 changes: 2 additions & 2 deletions TVRename/Exporter/UpcomingRSS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ protected override bool Generate(System.IO.Stream str, List<ProcessedEpisode> el

writer.WriteStartElement("item");

XmlHelper.WriteElementToXml(writer,"title",ei.HowLong() + " " + ei.DayOfWeek() + " " + ei.TimeOfDay() + " " + ei.SI.ShowName + " " + niceName);
XmlHelper.WriteElementToXml(writer,"title",ei.HowLong() + " " + ei.DayOfWeek() + " " + ei.TimeOfDay() + " " + ei.Show.ShowName + " " + niceName);
XmlHelper.WriteElementToXml(writer, "link", TheTVDB.Instance.WebsiteUrl(ei.TheSeries.TVDBCode, ei.SeasonId, false));
XmlHelper.WriteElementToXml(writer,"description", ei.SI.ShowName + "<br/>" + niceName + "<br/>" + ei.Overview);
XmlHelper.WriteElementToXml(writer,"description", ei.Show.ShowName + "<br/>" + niceName + "<br/>" + ei.Overview);

writer.WriteStartElement("pubDate");
DateTime? dt = ei.GetAirDateDT(true);
Expand Down
2 changes: 1 addition & 1 deletion TVRename/Exporter/UpcomingXML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override bool Generate(System.IO.Stream str, List<ProcessedEpisode> e
List<FileInfo> fl = TVDoc.FindEpOnDisk(dfc, ei);
if ((fl != null) && (fl.Count > 0))
writer.WriteValue("true");
else if (ei.SI.DoMissingCheck)
else if (ei.Show.DoMissingCheck)
writer.WriteValue("false");
}

Expand Down
2 changes: 1 addition & 1 deletion TVRename/Exporter/UpcomingiCAL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected override bool Generate(System.IO.Stream str, List<ProcessedEpisode> el
if (!stTime.HasValue) continue;

DateTime startTime = stTime.Value;
String s = ei.SI.TheSeries().GetRuntime();
string s = ei.Show.TheSeries().GetRuntime();
DateTime endTime = stTime.Value.AddMinutes(int.Parse(s));

CalendarEvent e = new CalendarEvent
Expand Down
Loading

0 comments on commit 4c06121

Please sign in to comment.