Skip to content

Commit

Permalink
Merge pull request #415 from MarkSummerville/25
Browse files Browse the repository at this point in the history
25
  • Loading branch information
SirSparkles authored May 23, 2018
2 parents 24fa886 + 78e3c9a commit b232eb5
Show file tree
Hide file tree
Showing 13 changed files with 246 additions and 93 deletions.
2 changes: 1 addition & 1 deletion TVRename#/Exporter/ShowsHTML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void Run()

private static string CreateHTML(ShowItem si)
{
string posterURL = TheTVDB.GetBannerURL(si.TheSeries().GetImage(TVSettings.FolderJpgIsType.Poster));
string posterURL = TheTVDB.GetImageURL(si.TheSeries().GetImage(TVSettings.FolderJpgIsType.Poster));
int minYear = si.TheSeries().MinYear();
int maxYear = si.TheSeries().MaxYear();
string yearRange = (minYear==maxYear) ? minYear.ToString() : minYear + "-" + maxYear;
Expand Down
9 changes: 3 additions & 6 deletions TVRename#/Finders/FileFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,16 @@ private bool ReviewFile(ItemMissing me, ItemList addTo, DirCacheEntry dce)
TVDoc.MatchesSequentialNumber(dce.TheFile.Name, ref seasF, ref epF, me.Episode) && (seasF == season) &&
(epF == epnum)))
{
if (maxEp != -1 && TVSettings.Instance.AutoMergeEpisodes)
if (maxEp != -1 && TVSettings.Instance.AutoMergeDownloadEpisodes)
{
ShowRule sr = new ShowRule
{
DoWhatNow = RuleAction.kMerge,
First = epF,
Second = maxEp
};
if (!me.Episode.SI.SeasonRules.ContainsKey(seasF)) me.Episode.SI.SeasonRules[seasF] = new List<ShowRule>();
me.Episode.SI?.AddSeasonRule(seasF, sr);

me.Episode.SI.SeasonRules[seasF].Add(sr);
Logger.Info(
$"Looking at {me.Episode.SI.ShowName} and have identified that episode {epF} and {maxEp} of season {seasF} have been merged into one file {dce.TheFile.FullName}");
Logger.Info($"Added new rule automatically for {sr}");
Expand All @@ -302,11 +301,9 @@ private bool ReviewFile(ItemMissing me, ItemList addTo, DirCacheEntry dce)
this.Doc.Library.GenerateEpisodeDict(me.Episode.SI);

//Get the newly created processed episode we are after
List<ProcessedEpisode> newSeason = this.Doc.Library.ShowItem(me.Episode.SI.TVDBCode).SeasonEpisodes[seasF];
// ReSharper disable once InconsistentNaming
ProcessedEpisode newPE = me.Episode;

foreach (ProcessedEpisode pe in newSeason)
foreach (ProcessedEpisode pe in me.Episode.SI.SeasonEpisodes[seasF])
{
if (pe.AppropriateEpNum == epF && pe.EpNum2 == maxEp) newPE = pe;
}
Expand Down
4 changes: 2 additions & 2 deletions TVRename#/Forms/DupEpFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ public void duplicateRightClickMenu_ItemClicked(object sender,
sr.DoWhatNow = RuleAction.kMerge;
sr.First = this.mlastSelected.episodeOne.AppropriateEpNum;
sr.Second = this.mlastSelected.episodeTwo.AppropriateEpNum;
if (!si.SeasonRules.ContainsKey(this.mlastSelected.SeasonNumber)) si.SeasonRules[this.mlastSelected.SeasonNumber] = new List<ShowRule>();

si.SeasonRules[this.mlastSelected.SeasonNumber].Add(sr);
si?.AddSeasonRule(this.mlastSelected.SeasonNumber,sr);

this.lvDuplicates.Items.Remove(this.mlastClicked);
this.dupEps.Remove(this.mlastSelected);
break;
Expand Down
79 changes: 46 additions & 33 deletions TVRename#/Forms/Preferences.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions TVRename#/Forms/Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ private void OKButton_Click(object sender, System.EventArgs e)
S.LeaveOriginals = this.cbLeaveOriginals.Checked;
S.CheckuTorrent = this.cbCheckuTorrent.Checked;
S.LookForDateInFilename = this.cbLookForAirdate.Checked;
S.AutoMergeEpisodes = this.chkAutoMergeEpisodes.Checked;
S.AutoMergeDownloadEpisodes = this.chkAutoMergeDownloadEpisodes.Checked;
S.AutoMergeLibraryEpisodes = this.chkAutoMergeLibraryEpisodes.Checked;
S.RetainLanguageSpecificSubtitles = this.chkRetainLanguageSpecificSubtitles.Checked;
S.ForceBulkAddToUseSettingsOnly = this.chkForceBulkAddToUseSettingsOnly.Checked;

Expand Down Expand Up @@ -412,7 +413,8 @@ private void Preferences_Load(object sender, System.EventArgs e)
this.cbLookForAirdate.Checked = S.LookForDateInFilename;
this.chkRetainLanguageSpecificSubtitles.Checked = S.RetainLanguageSpecificSubtitles;
this.chkForceBulkAddToUseSettingsOnly.Checked = S.ForceBulkAddToUseSettingsOnly;
this.chkAutoMergeEpisodes.Checked = S.AutoMergeEpisodes;
this.chkAutoMergeDownloadEpisodes.Checked = S.AutoMergeDownloadEpisodes;
this.chkAutoMergeLibraryEpisodes.Checked = S.AutoMergeLibraryEpisodes;
this.cbMonitorFolder.Checked = S.MonitorFolders;
this.chkScheduledScan.Checked = S.RunPeriodicCheck();
this.chkScanOnStartup.Checked = S.RunOnStartUp();
Expand Down Expand Up @@ -1269,10 +1271,5 @@ private void domainUpDown1_KeyDown(object sender, KeyEventArgs e)
e.SuppressKeyPress = true;

}

private void cbShowsHTML_CheckedChanged(object sender, EventArgs e)
{

}
}
}
12 changes: 6 additions & 6 deletions TVRename#/Forms/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ private static string ImageSection(string title, int width, int height, string b

if (string.IsNullOrEmpty(bannerPath)) return "";

string url = TheTVDB.GetBannerURL(bannerPath);
string url = TheTVDB.GetImageURL(bannerPath);

if ((string.IsNullOrEmpty(url))) return "";

Expand Down Expand Up @@ -883,8 +883,8 @@ private string GetShowHTMLOverview(ShowItem si, SeriesInfo ser)


if ((!string.IsNullOrEmpty(ser.GetSeriesWideBannerPath())) &&
(!string.IsNullOrEmpty(TheTVDB.GetBannerURL(ser.GetSeriesWideBannerPath()) )))
body += "<img width=758 height=140 src=\"" + TheTVDB.GetBannerURL(ser.GetSeriesWideBannerPath()) + "\"><br/>";
(!string.IsNullOrEmpty(TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath()) )))
body += "<img width=758 height=140 src=\"" + TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath()) + "\"><br/>";

body += $"<h1><A HREF=\"{TheTVDB.Instance.WebsiteURL(si.TVDBCode, -1, true)}\">{si.ShowName}</A> </h1>";

Expand Down Expand Up @@ -951,8 +951,8 @@ private string GetSeasonHTMLOverview(ShowItem si, SeriesInfo ser, int snum)
string body = "";

if (!string.IsNullOrEmpty(ser.GetSeriesWideBannerPath()) &&
!string.IsNullOrEmpty(TheTVDB.GetBannerURL(ser.GetSeriesWideBannerPath())))
body += "<img width=758 height=140 src=\"" + TheTVDB.GetBannerURL(ser.GetSeriesWideBannerPath()) + "\"><br/>";
!string.IsNullOrEmpty(TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath())))
body += "<img width=758 height=140 src=\"" + TheTVDB.GetImageURL(ser.GetSeriesWideBannerPath()) + "\"><br/>";

Season s = si.DVDOrder ? ser.DVDSeasons[snum]: ser.AiredSeasons[snum];

Expand Down Expand Up @@ -1017,7 +1017,7 @@ private string GetSeasonHTMLOverview(ShowItem si, SeriesInfo ser, int snum)
body += "<td width=100% valign=top>" + getOverview(ei) + "</td><td width=300 height=225>";
// 300x168 / 300x225
if (!string.IsNullOrEmpty(ei.GetFilename()))
body += "<img src=" + TheTVDB.GetThumbnailURL(ei.GetFilename()) +">";
body += "<img src=" + TheTVDB.GetImageURL(ei.GetFilename()) +">";
body += "</td></tr></table>";
}
else
Expand Down
10 changes: 7 additions & 3 deletions TVRename#/Settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ internal bool IncludeBetaUpdates()
public bool RetainLanguageSpecificSubtitles = true;


public bool AutoMergeEpisodes = false;
public bool AutoMergeDownloadEpisodes = false;
public bool AutoMergeLibraryEpisodes = false;
public string VideoExtensionsString = "";
public int WTWRecentDays = 7;
public string uTorrentPath = "";
Expand Down Expand Up @@ -610,7 +611,9 @@ public void load(XmlReader reader)
else if (reader.Name == "LookForDateInFilename")
this.LookForDateInFilename = reader.ReadElementContentAsBoolean();
else if (reader.Name == "AutoMergeEpisodes")
this.AutoMergeEpisodes = reader.ReadElementContentAsBoolean();
this.AutoMergeDownloadEpisodes = reader.ReadElementContentAsBoolean();
else if (reader.Name == "AutoMergeLibraryEpisodes")
this.AutoMergeLibraryEpisodes = reader.ReadElementContentAsBoolean();
else if (reader.Name == "RetainLanguageSpecificSubtitles")
this.RetainLanguageSpecificSubtitles = reader.ReadElementContentAsBoolean();
else if (reader.Name == "ForceBulkAddToUseSettingsOnly")
Expand Down Expand Up @@ -920,7 +923,8 @@ public void WriteXML(XmlWriter writer)
XMLHelper.WriteElementToXML(writer, "RetainLanguageSpecificSubtitles", this.RetainLanguageSpecificSubtitles);
XMLHelper.WriteElementToXML(writer, "ForceBulkAddToUseSettingsOnly", this.ForceBulkAddToUseSettingsOnly);
XMLHelper.WriteElementToXML(writer,"LookForDateInFilename",this.LookForDateInFilename);
XMLHelper.WriteElementToXML(writer, "AutoMergeEpisodes", this.AutoMergeEpisodes);
XMLHelper.WriteElementToXML(writer, "AutoMergeEpisodes", this.AutoMergeDownloadEpisodes);
XMLHelper.WriteElementToXML(writer, "AutoMergeLibraryEpisodes", this.AutoMergeLibraryEpisodes);
XMLHelper.WriteElementToXML(writer,"MonitorFolders",this.MonitorFolders);
XMLHelper.WriteElementToXML(writer, "StartupScan", this.runStartupCheck);
XMLHelper.WriteElementToXML(writer, "PeriodicScan", this.runPeriodicCheck);
Expand Down
Loading

0 comments on commit b232eb5

Please sign in to comment.