private void bnAddRule_Click(object sender, System.EventArgs e) { ShowRule sr = new ShowRule(); AddModifyRule ar = new AddModifyRule(sr, show.GetSeason(mSeasonNumber), show.DvdOrder); bool res = ar.ShowDialog() == DialogResult.OK; if (res) { workingRuleSet.Add(sr); } FillRuleList(false, 0); }
public override ItemList ProcessSeason([NotNull] ShowItem si, string folder, int snum, bool forceRefresh) { DateTime?updateTime = si.GetSeason(snum)?.LastAiredDate(); if (!TVSettings.Instance.CorrectFileDates || !updateTime.HasValue) { return(null); } DateTime newUpdateTime = Helpers.GetMinWindowsTime(updateTime.Value); DirectoryInfo di = new DirectoryInfo(folder); try { if ((di.LastWriteTimeUtc != newUpdateTime) && (!doneFilesAndFolders.Contains(di.FullName))) { doneFilesAndFolders.Add(di.FullName); return(new ItemList() { new ActionDateTouch(di, si, newUpdateTime) }); } } catch (Exception) { doneFilesAndFolders.Add(di.FullName); return(new ItemList() { new ActionDateTouch(di, si, newUpdateTime) }); } return(null); }
public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh) { DateTime?newUpdateTime = si.GetSeason(snum).LastAiredDate(); if (TVSettings.Instance.CorrectFileDates && newUpdateTime.HasValue) { //Any series before 1980 will get 1980 as the timestamp if (newUpdateTime.Value.CompareTo(Helpers.windowsStartDateTime) < 0) { newUpdateTime = Helpers.windowsStartDateTime; } DirectoryInfo di = new DirectoryInfo(folder); if ((di.LastWriteTimeUtc != newUpdateTime.Value) && (!this.doneFilesAndFolders.Contains(di.FullName))) { this.doneFilesAndFolders.Add(di.FullName); return(new ItemList() { new ActionDateTouch(di, si, newUpdateTime.Value) }); } } return(null); }
private string GetTargetEpisodeName([NotNull] ShowItem show, [NotNull] Episode ep, bool urlEncode) { //note this is for an Episode and not a ProcessedEpisode string name = StyleString; string epname = ep.Name; name = name.ReplaceInsensitive("{ShowName}", show.ShowName); switch (show.Order) { case Season.SeasonType.dvd: name = name.ReplaceInsensitive("{Season}", ep.DvdSeasonNumber.ToString()); name = name.ReplaceInsensitive("{Season:2}", ep.DvdSeasonNumber.ToString("00")); name = name.ReplaceInsensitive("{SeasonNumber}", show.GetSeasonIndex(ep.DvdSeasonNumber).ToString()); name = name.ReplaceInsensitive("{SeasonNumber:2}", show.GetSeasonIndex(ep.DvdSeasonNumber).ToString("00")); name = name.ReplaceInsensitive("{Episode}", ep.DvdEpNum.ToString("00")); name = name.ReplaceInsensitive("{Episode2}", ep.DvdEpNum.ToString("00")); name = Regex.Replace(name, "{AllEpisodes}", ep.DvdEpNum.ToString("00")); break; case Season.SeasonType.aired: name = name.ReplaceInsensitive("{Season}", ep.AiredSeasonNumber.ToString()); name = name.ReplaceInsensitive("{Season:2}", ep.AiredSeasonNumber.ToString("00")); name = name.ReplaceInsensitive("{SeasonNumber}", show.GetSeasonIndex(ep.AiredSeasonNumber).ToString()); name = name.ReplaceInsensitive("{SeasonNumber:2}", show.GetSeasonIndex(ep.AiredSeasonNumber).ToString("00")); name = name.ReplaceInsensitive("{Episode}", ep.AiredEpNum.ToString("00")); name = name.ReplaceInsensitive("{Episode2}", ep.AiredEpNum.ToString("00")); name = Regex.Replace(name, "{AllEpisodes}", ep.AiredEpNum.ToString("00")); break; default: throw new ArgumentOutOfRangeException(); } name = name.ReplaceInsensitive("{EpisodeName}", epname); name = name.ReplaceInsensitive("{Number}", ""); name = name.ReplaceInsensitive("{Number:2}", ""); name = name.ReplaceInsensitive("{Number:3}", ""); name = name.ReplaceInsensitive("{Imdb}", ep.ImdbCode); SeriesInfo si = show.TheSeries(); name = name.ReplaceInsensitive("{ShowImdb}", si?.Imdb ?? string.Empty); name = name.ReplaceInsensitive("{Year}", si?.MinYear.ToString() ?? string.Empty); Season selectedSeason = show.GetSeason(ep.GetSeasonNumber(show.Order)); name = name.ReplaceInsensitive("{SeasonYear}", selectedSeason != null ? selectedSeason.MinYear().ToString() : string.Empty); name = ReplaceDates(urlEncode, name, ep.GetAirDateDt(show.GetTimeZone())); name = Regex.Replace(name, "([^\\\\])\\[.*?[^\\\\]\\]", "$1"); // remove optional parts name = name.Replace("\\[", "["); name = name.Replace("\\]", "]"); return(name.Trim()); }
public AddModifyRule(ShowRule rule, [NotNull] ShowItem show, int seasonNumber) { mRule = rule; mSeason = show.GetSeason(seasonNumber); mOrder = show.Order; InitializeComponent(); FillDialog(); }
private string GetTargetEpisodeName([NotNull] ShowItem show, [NotNull] Episode ep, DateTimeZone tz, bool dvdOrder, bool urlEncode) { //note this is for an Episode and not a ProcessedEpisode string name = StyleString; string epname = ep.Name; name = name.ReplaceInsensitive("{ShowName}", show.ShowName); if (dvdOrder) { name = name.ReplaceInsensitive("{Season}", ep.DvdSeasonNumber.ToString()); name = name.ReplaceInsensitive("{Season:2}", ep.DvdSeasonNumber.ToString("00")); name = name.ReplaceInsensitive("{SeasonNumber}", ep.DvdSeasonIndex.ToString()); name = name.ReplaceInsensitive("{SeasonNumber:2}", ep.DvdSeasonIndex.ToString("00")); name = name.ReplaceInsensitive("{Episode}", ep.DvdEpNum.ToString("00")); name = name.ReplaceInsensitive("{Episode2}", ep.DvdEpNum.ToString("00")); name = Regex.Replace(name, "{AllEpisodes}", ep.DvdEpNum.ToString("00")); } else { name = name.ReplaceInsensitive("{Season}", ep.AiredSeasonNumber.ToString()); name = name.ReplaceInsensitive("{Season:2}", ep.AiredSeasonNumber.ToString("00")); name = name.ReplaceInsensitive("{SeasonNumber}", ep.AiredSeasonIndex.ToString()); name = name.ReplaceInsensitive("{SeasonNumber:2}", ep.AiredSeasonIndex.ToString("00")); name = name.ReplaceInsensitive("{Episode}", ep.AiredEpNum.ToString("00")); name = name.ReplaceInsensitive("{Episode2}", ep.AiredEpNum.ToString("00")); name = Regex.Replace(name, "{AllEpisodes}", ep.AiredEpNum.ToString("00")); } name = name.ReplaceInsensitive("{EpisodeName}", epname); name = name.ReplaceInsensitive("{Number}", ""); name = name.ReplaceInsensitive("{Number:2}", ""); name = name.ReplaceInsensitive("{Number:3}", ""); name = name.ReplaceInsensitive("{Imdb}", ep.ImdbCode); SeriesInfo si = show.TheSeries(); name = name.ReplaceInsensitive("{ShowImdb}", si?.Imdb ?? string.Empty); name = name.ReplaceInsensitive("{Year}", si?.MinYear.ToString() ?? string.Empty); Season selectedSeason = show.GetSeason(dvdOrder ? ep.DvdSeasonNumber : ep.AiredSeasonNumber); name = name.ReplaceInsensitive("{SeasonYear}", selectedSeason != null ? selectedSeason.MinYear().ToString() : string.Empty); name = ReplaceDates(urlEncode, name, ep.GetAirDateDt(tz)); name = Regex.Replace(name, "([^\\\\])\\[.*?[^\\\\]\\]", "$1"); // remove optional parts name = name.Replace("\\[", "["); name = name.Replace("\\]", "]"); return(name.Trim()); }