private static string CreateHtml([NotNull] ShowConfiguration si) { CachedSeriesInfo cachedSeries = si.CachedShow; if (cachedSeries is null) { return(string.Empty); } string posterUrl = TheTVDB.API.GetImageURL(cachedSeries.GetImage(TVSettings.FolderJpgIsType.Poster)); string yearRange = ShowHtmlHelper.YearRange(cachedSeries); string episodeSummary = cachedSeries.Episodes.Count.ToString(); string stars = ShowHtmlHelper.StarRating(cachedSeries.SiteRating / 2); string genreIcons = string.Join(" ", cachedSeries.Genres.Select(ShowHtmlHelper.GenreIconHtml)); string siteRating = cachedSeries.SiteRating > 0 ? cachedSeries.SiteRating + "/10" : ""; return($@"<div class=""card card-body""> <div class=""row""> <div class=""col-md-4""> <img class=""show-poster rounded w-100"" src=""{posterUrl}"" alt=""{si.ShowName} Show Poster""></div> <div class=""col-md-8 d-flex flex-column""> <div class=""row""> <div class=""col-md-8""><h1>{si.ShowName}</h1></div> <div class=""col-md-4 text-right""><h6>{yearRange} ({cachedSeries.Status})</h6><small class=""text-muted"">{episodeSummary} Episodes</small></div> </div> <div><blockquote>{cachedSeries.Overview}</blockquote></div> <div><blockquote>{cachedSeries.GetActorNames().ToCsv()}</blockquote></div> <div class=""row align-items-bottom flex-grow-1""> <div class=""col-md-4 align-self-end"">{stars}<br>{siteRating}</div> <div class=""col-md-4 align-self-end text-center"">{cachedSeries.ContentRating}<br>{cachedSeries.Network}</div> <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{cachedSeries.Genres.ToCsv()}</div> </div> </div></div></div>"); }
public override ItemList?ProcessShow(ShowConfiguration si, bool forceRefresh) { if (TVSettings.Instance.Mede8erXML) { ItemList theActionList = new ItemList(); FileInfo tvshowxml = FileHelper.FileInFolder(si.AutoAddFolderBase, "cachedSeries.xml"); CachedSeriesInfo cachedSeriesInfo = si.CachedShow; bool needUpdate = !tvshowxml.Exists || cachedSeriesInfo is null || cachedSeriesInfo.SrvLastUpdated > TimeZoneHelper.Epoch(tvshowxml.LastWriteTime); if ((forceRefresh || needUpdate) && !doneFiles.Contains(tvshowxml.FullName)) { doneFiles.Add(tvshowxml.FullName); theActionList.Add(new ActionMede8erXML(tvshowxml, si)); } //Updates requested by [email protected] on 18/4/2013 FileInfo viewxml = FileHelper.FileInFolder(si.AutoAddFolderBase, "View.xml"); if (!viewxml.Exists && !doneFiles.Contains(viewxml.FullName)) { doneFiles.Add(viewxml.FullName); theActionList.Add(new ActionMede8erViewXML(viewxml, si)); } return(theActionList); } return(base.ProcessShow(si, forceRefresh)); }
private ActionDownloadImage?DoEpisode(ShowConfiguration si, [NotNull] Episode ep, FileInfo filo, string extension, bool forceRefresh) { string ban = ep.Filename; if (string.IsNullOrEmpty(ban)) { return(null); } string basefn = filo.RemoveExtension(); FileInfo imgtbn = FileHelper.FileInFolder(filo.Directory, basefn + extension); if (imgtbn.Exists && !forceRefresh) { return(null); } if (doneTbn.Contains(imgtbn.FullName)) { return(null); } doneTbn.Add(imgtbn.FullName); return(new ActionDownloadImage(si, ep is ProcessedEpisode episode ? episode : new ProcessedEpisode(ep, si), imgtbn, ban)); }
public EditSeason([NotNull] ShowConfiguration si, int seasonNumber, CustomEpisodeName style) { mOriginalEps = ShowLibrary.GenerateEpisodes(si, seasonNumber, false); nameStyle = style; InitializeComponent(); episodesToAddToSeen = new List <ProcessedEpisode>(); episodesToRemoveFromSeen = new List <ProcessedEpisode>(); show = si; mSeasonNumber = seasonNumber; workingRuleSet = si.SeasonRules.ContainsKey(seasonNumber) ? new List <ShowRule>(si.SeasonRules[seasonNumber]) : new List <ShowRule>(); txtShowName.Text = si.ShowName; txtSeasonNumber.Text = seasonNumber.ToString(); FillRuleList(false, 0); FillSeenEpisodes(false); lvSeenEpisodes.ListViewItemSorter = new NumberAsTextSorter(0); lvSeenEpisodes.Sort(); UpdatePreviouslySeenButtons(); UpdateRuleButtons(); }
public override ItemList?ProcessShow(ShowConfiguration si, bool forceRefresh) { DateTime?updateTime = si.LastAiredDate; if (!TVSettings.Instance.CorrectFileDates || !updateTime.HasValue) { return(null); } DateTime newUpdateTime = Helpers.GetMinWindowsTime(updateTime.Value); DirectoryInfo di = new DirectoryInfo(si.AutoAddFolderBase); try { if (di.LastWriteTimeUtc != newUpdateTime && !doneFilesAndFolders.Contains(di.FullName)) { doneFilesAndFolders.Add(di.FullName); return(new ItemList { new ActionDateTouchMedia(di, si, newUpdateTime) }); } } catch (Exception) { doneFilesAndFolders.Add(di.FullName); return(new ItemList { new ActionDateTouchMedia(di, si, newUpdateTime) }); } return(null); }
private void SetAutoAdd([NotNull] ShowConfiguration si) { switch (si.AutoAddType) { case ShowConfiguration.AutomaticFolderType.none: chkAutoFolders.Checked = false; break; case ShowConfiguration.AutomaticFolderType.baseOnly: chkAutoFolders.Checked = true; rdoFolderBaseOnly.Checked = true; break; case ShowConfiguration.AutomaticFolderType.custom: chkAutoFolders.Checked = true; rdoFolderCustom.Checked = true; break; case ShowConfiguration.AutomaticFolderType.libraryDefault: chkAutoFolders.Checked = true; rdoFolderLibraryDefault.Checked = true; break; default: throw new ArgumentOutOfRangeException(); } }
private void SetupDropDowns([NotNull] ShowConfiguration si) { cbTimeZone.BeginUpdate(); cbTimeZone.Items.Clear(); foreach (string s in TimeZoneHelper.ZoneNames()) { cbTimeZone.Items.Add(s); } cbTimeZone.EndUpdate(); cbTimeZone.Text = si.ShowTimeZone; if (TheTVDB.LocalCache.Instance.LanguageList != null) //This means that language shave been loaded { string pref = string.Empty; cbLanguage.BeginUpdate(); cbLanguage.Items.Clear(); foreach (Language l in TheTVDB.LocalCache.Instance.LanguageList) { cbLanguage.Items.Add(l.Name); if (si.CustomLanguageCode == l.Abbreviation) { pref = l.Name; } } cbLanguage.EndUpdate(); cbLanguage.Text = pref; } }
private void AddToLibrary([NotNull] PossibleNewTvShow ai) { // see if there is a matching show item ShowConfiguration found = mDoc.TvLibrary.GetShowItem(ai.TVDBCode); if (found is null) { // need to add a new showitem found = new ShowConfiguration(ai.TVDBCode, TVDoc.ProviderType.TheTVDB); //todo fix up for TVMAZE to allow searching vis TVMaze too (BulkAdd) mDoc.TvLibrary.Add(found); } found.AutoAddFolderBase = ai.Folder.FullName; if (ai.HasSeasonFoldersGuess) { found.AutoAddType = ai.SeasonFolderFormat == TVSettings.Instance.SeasonFolderFormat ? ShowConfiguration.AutomaticFolderType.libraryDefault : ShowConfiguration.AutomaticFolderType.custom; found.AutoAddCustomFolderFormat = ai.SeasonFolderFormat; } else { found.AutoAddType = ShowConfiguration.AutomaticFolderType.baseOnly; } mDoc.Stats().AutoAddedShows++; }
private ActionOutcome ReplaceMultipartFile() { ShowConfiguration si = Episode?.Show ?? SelectedShow; //We will replace the file as too difficult to update multiparts //We can't use XDocument as it's not fully valid XML List <XElement> episodeXmLs = new List <XElement>(); if (Episode != null) { foreach (Episode ep in Episode.SourceEpisodes) { XElement epNode = new XElement("episodedetails"); UpdateEpisodeFields(ep, si, epNode, true); episodeXmLs.Add(epNode); } } try { using (StreamWriter writer = File.CreateText(Where.FullName)) { foreach (XElement ep in episodeXmLs) { writer.WriteLine(ep); } } } catch (IOException e) { return(new ActionOutcome(e)); } return(ActionOutcome.Success()); }
public override ItemList?ProcessSeason(ShowConfiguration si, string folder, int snum, bool forceRefresh) { if (!TVSettings.Instance.FolderJpg) { return(null); } // season folders JPGs ItemList theActionList = new ItemList(); FileInfo fi = FileHelper.FileInFolder(folder, DEFAULT_FILE_NAME); if (!doneFolderJpg.Contains(fi.FullName) && (!fi.Exists || forceRefresh)) // some folders may come up multiple times { string bannerPath = TVSettings.Instance.SeasonSpecificFolderJPG() ? si.CachedShow?.GetSeasonBannerPath(snum) : si.CachedShow?.GetImage(TVSettings.Instance.ItemForFolderJpg()); if (!string.IsNullOrEmpty(bannerPath)) { theActionList.Add(new ActionDownloadImage(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages)); } doneFolderJpg.Add(fi.FullName); } return(theActionList); }
public override ItemList ProcessShow(ShowConfiguration si, bool forceRefresh) { ItemList theActionList = new ItemList(); if (!TVSettings.Instance.FolderJpg) { return(theActionList); } FileInfo fi = FileHelper.FileInFolder(si.AutoAddFolderBase, DEFAULT_FILE_NAME); bool fileDoesntExist = !doneFolderJpg.Contains(fi.FullName) && !fi.Exists; if (forceRefresh || fileDoesntExist) { CachedSeriesInfo cachedSeries = si.CachedShow; if (cachedSeries is null) { return(theActionList); } //default to poster when we want season posters for the season specific folders string downloadPath = TVSettings.Instance.SeasonSpecificFolderJPG() ? cachedSeries.GetSeriesPosterPath() : cachedSeries.GetImage(TVSettings.Instance.ItemForFolderJpg()); if (!string.IsNullOrEmpty(downloadPath)) { theActionList.Add(new ActionDownloadImage(si, null, fi, downloadPath, false)); } doneFolderJpg.Add(fi.FullName); } return(theActionList); }
protected override void Check(ShowConfiguration si, DirFilesCache dfc, TVDoc.ScanSettings settings) { if (!si.DoMissingCheck && !si.DoRename) { return; // skip } Dictionary <int, SafeList <string> > flocs = si.AllProposedFolderLocations(); List <string> ignoredLocations = new List <string>(); foreach (int snum in si.GetSeasonKeys()) { // show MissingFolderAction for any folders that are missing // throw Exception if user cancels if (si.IgnoreSeasons.Contains(snum)) { continue; // ignore this season } if (snum == 0 && si.CountSpecials) { continue; // no specials season, they're merged into the seasons themselves } if (snum == 0 && TVSettings.Instance.IgnoreAllSpecials) { continue; } SafeList <string> folders = new SafeList <string>(); if (flocs.ContainsKey(snum)) { folders = flocs[snum]; } if (si.SeasonEpisodes[snum].All(episode => !MightWeProcess(episode, folders))) { //All episodes in this season are ignored continue; } if (folders.Count == 0 && si.AutoAddNewSeasons()) { // no folders defined for this season, and autoadd didn't find any, so suggest the autoadd folder name instead folders.Add(si.AutoFolderNameForSeason(snum)); } if (folders.Count == 0 && !si.AutoAddNewSeasons()) { // no folders defined for this season, and autoadd didn't find any, so suggest the autoadd folder name instead folders.Add(string.Empty); } CreateSeasonFolders(si, snum, folders, ignoredLocations, settings.Owner); } // for each snum }
private void CreateSeasonFolders(ShowConfiguration si, int snum, [NotNull] IEnumerable <string> folders, ICollection <string> ignoredLocations, IDialogParent owner) { foreach (string folderExists in folders) { CreateSeasonFolder(si, snum, ignoredLocations, folderExists, owner); } // for each folder }
public void CheckIfActive(ShowConfiguration si, DirFilesCache dfc, TVDoc.ScanSettings settings) { if (Active()) { Check(si, dfc, settings); LogActionListSummary(); } }
public ProcessedSeason(ShowConfiguration theShow, int number, int seasonId, SeasonType t) { Show = theShow; SeasonNumber = number; SeasonId = seasonId; Episodes = new ConcurrentDictionary <int, Episode>(); type = t; }
public override ItemList?ProcessSeason(ShowConfiguration si, string folder, int snum, bool forceRefresh) { if (TVSettings.Instance.KODIImages) { ItemList theActionList = new ItemList(); //If we have KODI New style images being downloaded then we want to check that 3 files exist //for the cachedSeries: //http://wiki.xbmc.org/index.php?title=XBMC_v12_(Frodo)_FAQ#Local_images //poster //banner //fanart - we do not have the option in TVDB to get season specific fanart, so we'll leave that string filenamePrefix = string.Empty; if (si.InOneFolder()) { // We have multiple seasons in the same folder // We need to do slightly more work to come up with the filenamePrefix filenamePrefix = "season"; if (snum == 0) { filenamePrefix += "-specials"; } else if (snum < 10) { filenamePrefix += "0" + snum; } else { filenamePrefix += snum; } filenamePrefix += "-"; } FileInfo posterJpg = FileHelper.FileInFolder(folder, filenamePrefix + "poster.jpg"); if (forceRefresh || !posterJpg.Exists) { string path = si.CachedShow?.GetSeasonBannerPath(snum); if (!string.IsNullOrEmpty(path)) { theActionList.Add(new ActionDownloadImage(si, null, posterJpg, path)); } } FileInfo bannerJpg = FileHelper.FileInFolder(folder, filenamePrefix + "banner.jpg"); if (forceRefresh || !bannerJpg.Exists) { string path = si.CachedShow?.GetSeasonWideBannerPath(snum); if (!string.IsNullOrEmpty(path)) { theActionList.Add(new ActionDownloadImage(si, null, bannerJpg, path)); } } return(theActionList); } return(base.ProcessSeason(si, folder, snum, forceRefresh)); }
public bool Filter(ShowConfiguration si, [NotNull] ProcessedSeason sea) { if (sea.SeasonNumber == 0 && TVSettings.Instance.IgnoreAllSpecials) { return(true); } return(!HideIgnoredSeasons || !si.IgnoreSeasons.Contains(sea.SeasonNumber)); }
public AutoAddMedia(string hint, FileInfo file, bool assumeMovie) { InitializeComponent(); ShowConfiguration = new ShowConfiguration(); MovieConfiguration = new MovieConfiguration(); this.assumeMovie = assumeMovie; lblFileName.Text = "Filename: " + file.FullName; tvCodeFinder = new CombinedCodeFinder("", MediaConfiguration.MediaType.tv, TVDoc.ProviderType.libraryDefault) { Dock = DockStyle.Fill }; movieCodeFinder = new CombinedCodeFinder("", MediaConfiguration.MediaType.movie, TVDoc.ProviderType.libraryDefault) { Dock = DockStyle.Fill }; tvCodeFinder.SelectionChanged += MTCCF_SelectionChanged; movieCodeFinder.SelectionChanged += MTCCF_SelectionChanged; SingleTvShowFound = tvCodeFinder.SetHint(hint, TVSettings.Instance.DefaultProvider) && TVSettings.Instance.DefShowAutoFolders && TVSettings.Instance.DefShowUseDefLocation; SingleMovieFound = movieCodeFinder.SetHint(hint, TVSettings.Instance.DefaultMovieProvider) && TVSettings.Instance.DefMovieDefaultLocation.HasValue() && TVSettings.Instance.DefMovieUseDefaultLocation && assumeMovie; originalHint = hint; if (SingleTvShowFound) { string filenameFriendly = TVSettings.Instance.FilenameFriendly(FileHelper.MakeValidPath(tvCodeFinder.TvShowInitialFound.Name)); SetShowItem(tvCodeFinder.TvShowInitialFoundCode, tvCodeFinder.Source, TVSettings.Instance.DefShowLocation + System.IO.Path.DirectorySeparatorChar + filenameFriendly); if (ShowConfiguration.Code == -1) { SetShowItem(); } } if (SingleMovieFound) { SetMovieItem(movieCodeFinder.MovieInitialFoundCode, movieCodeFinder.Source, TVSettings.Instance.DefMovieDefaultLocation); if (MovieConfiguration.Code == -1) { SetMovieItem(); } } pnlCF.SuspendLayout(); pnlCF.Controls.Add(tvCodeFinder); pnlCF.ResumeLayout(); panel1.SuspendLayout(); panel1.Controls.Add(movieCodeFinder); panel1.ResumeLayout(); UpdateDirectoryDropDown(cbDirectory, TVSettings.Instance.LibraryFolders, TVSettings.Instance.DefShowLocation, TVSettings.Instance.DefShowAutoFolders && TVSettings.Instance.DefShowUseDefLocation, tpTV); UpdateDirectoryDropDown(cbMovieDirectory, TVSettings.Instance.MovieLibraryFolders, TVSettings.Instance.DefMovieDefaultLocation, true, tpMovie); }
public AddModifyRule(ShowRule rule, ShowConfiguration show, IEnumerable <ProcessedEpisode> s) { mRule = rule; eps = s; mOrder = show.Order; InitializeComponent(); FillDialog(); }
public static bool FileNeeded(FileInfo fi, ShowConfiguration si, DirFilesCache dfc) { if (FindSeasEp(fi, out int seasF, out int epF, out _, si, out _)) { return(EpisodeNeeded(si, dfc, seasF, epF, fi)); } //We may need the file return(true); }
public bool Filter([NotNull] ShowConfiguration show) { bool IsNetworkOk(ShowConfiguration showItem) { string?seriesInfoNetwork = showItem.CachedShow?.Network; if (seriesInfoNetwork is null) { return(true); } return(ShowNetworkInclude ? seriesInfoNetwork.Equals(ShowNetwork) : !seriesInfoNetwork.Equals(ShowNetwork)); } bool IsRatingOk(ShowConfiguration showItem) { string?seriesInfoContentRating = showItem.CachedShow?.ContentRating; if (seriesInfoContentRating is null) { return(true); } return(ShowRatingInclude ? seriesInfoContentRating.Equals(ShowRating) : !seriesInfoContentRating.Equals(ShowRating)); } bool IsStatusOk(ShowConfiguration showItem) { return(ShowStatusInclude ? showItem.ShowStatus.Equals(ShowStatus) :!showItem.ShowStatus.Equals(ShowStatus)); } //Filter on show name bool isNameOk = ShowName is null || show.ShowName.Contains(ShowName, StringComparison.OrdinalIgnoreCase); //Filter on show status bool isStatusOk = ShowStatus is null || IsStatusOk(show); //Filter on show network bool isNetworkOk = ShowNetwork is null || IsNetworkOk(show); //Filter on show rating bool isRatingOk = ShowRating is null || IsRatingOk(show); //Filter on show genres bool areGenresIgnored = Genres.Count == 0; bool doAnyGenresMatch = FindMatchingGenres(show); return(isNameOk && isStatusOk && isNetworkOk && isRatingOk && (areGenresIgnored || doAnyGenresMatch)); }
public override ItemList?ProcessShow(ShowConfiguration si, bool forceRefresh) { //If we have KODI New style images being downloaded then we want to check that 3 files exist //for the cachedSeries: //http://wiki.xbmc.org/index.php?title=XBMC_v12_(Frodo)_FAQ#Local_images //poster //banner //fanart if (TVSettings.Instance.KODIImages) { ItemList theActionList = new ItemList(); // base folder: if (!string.IsNullOrEmpty(si.AutoAddFolderBase) && si.AllFolderLocations(false).Count > 0) { 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.AutoAddFolderBase)) { string path = si.CachedShow?.GetSeriesPosterPath(); if (!string.IsNullOrEmpty(path)) { theActionList.Add(new ActionDownloadImage(si, null, posterJpg, path, false)); donePosterJpg.Add(si.AutoAddFolderBase); } } if ((forceRefresh || !bannerJpg.Exists) && !doneBannerJpg.Contains(si.AutoAddFolderBase)) { string path = si.CachedShow?.GetSeriesWideBannerPath(); if (!string.IsNullOrEmpty(path)) { theActionList.Add(new ActionDownloadImage(si, null, bannerJpg, path, false)); doneBannerJpg.Add(si.AutoAddFolderBase); } } if ((forceRefresh || !fanartJpg.Exists) && !doneFanartJpg.Contains(si.AutoAddFolderBase)) { string path = si.CachedShow?.GetSeriesFanartPath(); if (!string.IsNullOrEmpty(path)) { theActionList.Add(new ActionDownloadImage(si, null, fanartJpg, path)); doneFanartJpg.Add(si.AutoAddFolderBase); } } } return(theActionList); } return(base.ProcessShow(si, forceRefresh)); }
public ProcessedEpisode([NotNull] ProcessedEpisode e, [NotNull] ShowConfiguration si, List <Episode> episodes) : base(e) { OverallNumber = -1; NextToAir = false; Show = si; EpNum2 = Show.Order == ProcessedSeason.SeasonType.dvd ? DvdEpNum : AiredEpNum; Ignore = false; SourceEpisodes = episodes; Type = ProcessedEpisodeType.merged; TheAiredProcessedSeason = e.TheAiredProcessedSeason; TheDvdProcessedSeason = e.TheDvdProcessedSeason; }
public ProcessedEpisode([NotNull] Episode e, [NotNull] ShowConfiguration si) : base(e) { OverallNumber = -1; NextToAir = false; Ignore = false; Show = si; EpNum2 = Show.Order == ProcessedSeason.SeasonType.dvd ? DvdEpNum : AiredEpNum; Type = ProcessedEpisodeType.single; TheAiredProcessedSeason = si.GetOrAddAiredSeason(e.AiredSeasonNumber, e.SeasonId); TheDvdProcessedSeason = si.GetOrAddDvdSeason(e.DvdSeasonNumber, e.SeasonId); SourceEpisodes = new List <Episode>(); }
public ProcessedEpisode([NotNull] ProcessedEpisode o) : base(o) { NextToAir = o.NextToAir; EpNum2 = o.EpNum2; Ignore = o.Ignore; Show = o.Show; OverallNumber = o.OverallNumber; Type = o.Type; TheAiredProcessedSeason = o.TheAiredProcessedSeason; TheDvdProcessedSeason = o.TheDvdProcessedSeason; SourceEpisodes = new List <Episode>(); }
private void SetShowItem(int code, TVDoc.ProviderType type, string folderbase) { ShowConfiguration.SetId(type, code); ShowConfiguration.AutoAddFolderBase = folderbase; ShowConfiguration.ConfigurationProvider = type == TVSettings.Instance.DefaultProvider? TVDoc.ProviderType.libraryDefault: type; //Set Default Timezone and if not then set on Network ShowConfiguration.ShowTimeZone = TVSettings.Instance.DefaultShowTimezoneName ?? TimeZoneHelper.TimeZoneForNetwork(tvCodeFinder.SelectedShow()?.Network, ShowConfiguration.ShowTimeZone); if (!originalHint.Contains(tvCodeFinder.SelectedShow()?.Name ?? string.Empty, StringComparison.OrdinalIgnoreCase)) { ShowConfiguration.AliasNames.Add(originalHint); } }
protected override void Check(ShowConfiguration si, DirFilesCache dfc, TVDoc.ScanSettings settings) { Dictionary <int, SafeList <string> > allFolders = si.AllExistngFolderLocations(); if (allFolders.Count == 0) // no folders defined for this show { return; // so, nothing to do. } //This is the code that will iterate over the DownloadIdentifiers and ask each to ensure that //it has all the required files for that show if (!string.IsNullOrEmpty(si.AutoAddFolderBase) && allFolders.Any()) { Doc.TheActionList.Add(downloadIdentifiers.ProcessShow(si)); } //MS_TODO Put the banner refresh period into the settings file, we'll default to 3 months DateTime cutOff = DateTime.Now.AddMonths(-3); DateTime lastUpdate = si.BannersLastUpdatedOnDisk ?? DateTime.Now.AddMonths(-4); bool timeForBannerUpdate = cutOff.CompareTo(lastUpdate) == 1; if (TVSettings.Instance.NeedToDownloadBannerFile() && timeForBannerUpdate) { Doc.TheActionList.Add( downloadIdentifiers.ForceUpdateShow(DownloadIdentifier.DownloadType.downloadImage, si)); si.BannersLastUpdatedOnDisk = DateTime.Now; Doc.SetDirty(); } // process each folder for each season... foreach (int snum in si.ActiveSeasons.Keys()) { if (settings.Token.IsCancellationRequested) { return; } if (!allFolders.ContainsKey(snum)) { continue; } // all the folders for this particular season SafeList <string> folders = allFolders[snum]; CheckSeason(si, dfc, settings, snum, folders, timeForBannerUpdate); } // for each season of this show }
public static bool FindSeasEp(DirectoryInfo?di, out int seas, out int ep, ShowConfiguration si, out TVSettings.FilenameProcessorRE?re) { List <TVSettings.FilenameProcessorRE> rexps = TVSettings.Instance.FNPRegexs; re = null; if (di is null) { seas = -1; ep = -1; return(false); } return(FindSeasEp(di.Parent.FullName, di.Name, out seas, out ep, out int _, si, rexps, out re)); }
private void SetIgnoreSeasons([NotNull] ShowConfiguration si) { bool first = true; si.IgnoreSeasons.Sort(); foreach (int i in si.IgnoreSeasons.Distinct()) { if (!first) { txtIgnoreSeasons.Text += " "; } txtIgnoreSeasons.Text += i.ToString(); first = false; } }
private void SetupLanguages([NotNull] ShowConfiguration si) { chkCustomLanguage.Checked = si.UseCustomLanguage; if (chkCustomLanguage.Checked) { Language languageFromCode = TheTVDB.LocalCache.Instance.LanguageList?.GetLanguageFromCode(si.CustomLanguageCode); if (languageFromCode != null) { cbLanguage.Text = languageFromCode.Name; } } cbLanguage.Enabled = chkCustomLanguage.Checked; }