Skip to content

Commit

Permalink
Merge pull request #364 from MarkSummerville/master
Browse files Browse the repository at this point in the history
Bug fixes and new timezone checker
  • Loading branch information
SirSparkles authored Mar 21, 2018
2 parents 21f259a + 5e99ef9 commit 6f8eb67
Show file tree
Hide file tree
Showing 23 changed files with 571 additions and 462 deletions.
8 changes: 8 additions & 0 deletions TVRename#/Custom Controls/TheTVDBCodeFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public void SetHint(string s)
this.mInternal = true;
this.txtFindThis.Text = s;
this.mInternal = false;
Search();
this.DoFind(true);

}

public int SelectedCode()
Expand Down Expand Up @@ -125,6 +127,7 @@ private void DoFind(bool chooseOnlyMatch)

bool numberMatch = numeric && num == matchnum;
string searchTerm = Regex.Replace(what, "[^\\w ]", "");
searchTerm = searchTerm.Trim();
if (numberMatch || (!numeric && (simpleS.Contains(searchTerm))) || (numeric && show.Contains(what)))
{
ListViewItem lvi = new ListViewItem();
Expand Down Expand Up @@ -156,6 +159,11 @@ private void DoFind(bool chooseOnlyMatch)
}

private void bnGoSearch_Click(object sender, EventArgs e)
{
Search();
}

private void Search()
{
// search on thetvdb.com site
this.txtSearchStatus.Text = "Searching on TheTVDB.com";
Expand Down
2 changes: 1 addition & 1 deletion TVRename#/DownloadIdentifers/DownloadEpisodeJPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bo
FileInfo imgjpg = FileHelper.FileInFolder(filo.Directory, basefn + ".jpg");

if (forceRefresh || !imgjpg.Exists)
TheActionList.Add(new ActionDownload(dbep.SI, dbep, imgjpg, ban, TVSettings.Instance.ShrinkLargeMede8erImages));
TheActionList.Add(new ActionDownloadImage(dbep.SI, 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 @@ -32,7 +32,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
string bannerPath = si.TheSeries().GetSeriesFanartPath();

if (!string.IsNullOrEmpty(bannerPath))
TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, false));
TheActionList.Add(new ActionDownloadImage(si, null, fi, bannerPath, false));
doneFanartJPG.Add(fi.FullName);
}
return TheActionList;
Expand Down
4 changes: 2 additions & 2 deletions TVRename#/DownloadIdentifers/DownloadJolderJPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)


if (!string.IsNullOrEmpty(downloadPath))
TheActionList.Add(new ActionDownload(si, null, fi, downloadPath, false));
TheActionList.Add(new ActionDownloadImage(si, null, fi, downloadPath, false));
doneFolderJPG.Add(fi.FullName);
}
return TheActionList;
Expand Down Expand Up @@ -78,7 +78,7 @@ public override ItemList ProcessSeason(ShowItem si, string folder, int snum, boo
bannerPath = si.TheSeries().GetImage(TVSettings.Instance.ItemForFolderJpg());
}
if (!string.IsNullOrEmpty(bannerPath))
TheActionList.Add(new ActionDownload(si, null, fi, bannerPath,
TheActionList.Add(new ActionDownloadImage(si, null, fi, bannerPath,
TVSettings.Instance.ShrinkLargeMede8erImages));
doneFolderJPG.Add(fi.FullName);
}
Expand Down
2 changes: 1 addition & 1 deletion TVRename#/DownloadIdentifers/DownloadSeriesJPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override ItemList ProcessSeason(ShowItem si, string folder, int snum, boo
{
string bannerPath = si.TheSeries().GetSeasonBannerPath(snum);
if (!string.IsNullOrEmpty(bannerPath))
TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages));
TheActionList.Add(new ActionDownloadImage(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages));
doneJPG.Add(fi.FullName);
}
return TheActionList;
Expand Down
20 changes: 10 additions & 10 deletions TVRename#/DownloadIdentifers/DownloadXBMCImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
string path = si.TheSeries().GetSeriesPosterPath();
if (!string.IsNullOrEmpty(path))
{
TheActionList.Add(new ActionDownload(si, null, posterJPG, path, false));
TheActionList.Add(new ActionDownloadImage(si, null, posterJPG, path, false));
donePosterJPG.Add(si.AutoAdd_FolderBase);
}
}
Expand All @@ -66,7 +66,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
string path = si.TheSeries().GetSeriesWideBannerPath();
if (!string.IsNullOrEmpty(path))
{
TheActionList.Add(new ActionDownload(si, null, bannerJPG, path, false));
TheActionList.Add(new ActionDownloadImage(si, null, bannerJPG, path, false));
doneBannerJPG.Add(si.AutoAdd_FolderBase);
}
}
Expand All @@ -76,7 +76,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
string path = si.TheSeries().GetSeriesFanartPath();
if (!string.IsNullOrEmpty(path))
{
TheActionList.Add(new ActionDownload(si, null, fanartJPG, path));
TheActionList.Add(new ActionDownloadImage(si, null, fanartJPG, path));
doneFanartJPG.Add(si.AutoAdd_FolderBase);
}
}
Expand Down Expand Up @@ -122,15 +122,15 @@ public override ItemList ProcessSeason(ShowItem si, string folder, int snum, boo
{
string path = si.TheSeries().GetSeasonBannerPath(snum);
if (!string.IsNullOrEmpty(path))
TheActionList.Add(new ActionDownload(si, null, posterJPG, path));
TheActionList.Add(new ActionDownloadImage(si, null, posterJPG, path));
}

FileInfo bannerJPG = FileHelper.FileInFolder(folder, filenamePrefix + "banner.jpg");
if (forceRefresh || !bannerJPG.Exists)
{
string path = si.TheSeries().GetSeasonWideBannerPath(snum);
if (!string.IsNullOrEmpty(path))
TheActionList.Add(new ActionDownload(si, null, bannerJPG, path));
TheActionList.Add(new ActionDownloadImage(si, null, bannerJPG, path));
}
}
if (TVSettings.Instance.DownloadEdenImages())
Expand All @@ -146,7 +146,7 @@ public override ItemList ProcessSeason(ShowItem si, string folder, int snum, boo
{
string path = si.TheSeries().GetSeasonBannerPath(snum);
if (!string.IsNullOrEmpty(path))
TheActionList.Add(new ActionDownload(si, null, posterTBN, path));
TheActionList.Add(new ActionDownloadImage(si, null, posterTBN, path));
}
}
return TheActionList;
Expand All @@ -171,13 +171,13 @@ public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bo
string filename =
TVSettings.Instance.FilenameFriendly(
TVSettings.Instance.NamingStyle.GetTargetEpisodeName(sourceEp,dbep.SI.ShowName, dbep.SI.GetTimeZone(), dbep.SI.DVDOrder));
ActionDownload b = DoEpisode(dbep.SI,sourceEp,new FileInfo(foldername+"/"+filename), ".jpg", forceRefresh);
ActionDownloadImage b = DoEpisode(dbep.SI,sourceEp,new FileInfo(foldername+"/"+filename), ".jpg", forceRefresh);
if (b != null) theActionList.Add(b);
}
}
else
{
ActionDownload a = DoEpisode(dbep.SI, dbep, filo, ".tbn", forceRefresh);
ActionDownloadImage a = DoEpisode(dbep.SI, dbep, filo, ".tbn", forceRefresh);
if (a != null) theActionList.Add(a);
}

Expand All @@ -186,7 +186,7 @@ public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bo
return base.ProcessEpisode(dbep, filo, forceRefresh);
}

private ActionDownload DoEpisode(ShowItem si, Episode ep, FileInfo filo,string extension, bool forceRefresh)
private ActionDownloadImage DoEpisode(ShowItem si, Episode ep, FileInfo filo,string extension, bool forceRefresh)
{
string ban = ep.GetFilename();
if (!string.IsNullOrEmpty(ban))
Expand All @@ -198,7 +198,7 @@ private ActionDownload DoEpisode(ShowItem si, Episode ep, FileInfo filo,string e
{
this.doneTBN.Add(imgtbn.FullName);

return new ActionDownload(si, (ep is ProcessedEpisode) ? (ProcessedEpisode)ep : new ProcessedEpisode(ep,si ), imgtbn, ban);
return new ActionDownloadImage(si, (ep is ProcessedEpisode) ? (ProcessedEpisode)ep : new ProcessedEpisode(ep,si ), imgtbn, ban);

}
}
Expand Down
6 changes: 3 additions & 3 deletions TVRename#/DownloadIdentifers/IncorrectFileDates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
if ((di.LastWriteTimeUtc != newUpdateTime.Value)&&(!this.doneFilesAndFolders.Contains(di.FullName)))
{
this.doneFilesAndFolders.Add(di.FullName);
return new ItemList() { new ItemDateTouch(di, si, newUpdateTime.Value) };
return new ItemList() { new ActionDateTouch(di, si, newUpdateTime.Value) };
}
}
return null;
Expand All @@ -46,7 +46,7 @@ public override ItemList ProcessSeason(ShowItem si, string folder, int snum, boo
if ((di.LastWriteTimeUtc != newUpdateTime.Value) &&(!this.doneFilesAndFolders.Contains(di.FullName)))
{
this.doneFilesAndFolders.Add(di.FullName);
return new ItemList() { new ItemDateTouch(di, si, newUpdateTime.Value) };
return new ItemList() { new ActionDateTouch(di, si, newUpdateTime.Value) };
}

}
Expand All @@ -66,7 +66,7 @@ public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bo
if ((filo.LastWriteTimeUtc != newUpdateTime) && (!this.doneFilesAndFolders.Contains(filo.FullName)))
{
this.doneFilesAndFolders.Add(filo.FullName);
return new ItemList() { new ItemDateTouch(filo,dbep, newUpdateTime) };
return new ItemList() { new ActionDateTouch(filo,dbep, newUpdateTime) };
}
}
return null;
Expand Down
6 changes: 4 additions & 2 deletions TVRename#/Forms/AutoAddShow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace TVRename.Forms
{
public partial class AutoAddShow : Form
{
private ShowItem mSI;
private readonly ShowItem mSI;
private readonly TheTVDBCodeFinder mTCCF;

public AutoAddShow(string hint)
Expand Down Expand Up @@ -41,7 +41,9 @@ private void SetShowItem()

this.mSI.TVDBCode = code;
this.mSI.AutoAdd_FolderBase = this.cbDirectory.Text+this.lblDirectoryName.Text;

this.mSI.PadSeasonToTwoDigits = true;
//Set Default Timezone based on Network??
//this.mSI.ShowTimeZone
}

private void btnOK_Click(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit 6f8eb67

Please sign in to comment.