예제 #1
0
 public ActionDownload(ShowItem si, ProcessedEpisode pe, FileInfo dest, string bannerPath)
 {
     this.Episode = pe;
     this.SI = si;
     this.Destination = dest;
     this.BannerPath = bannerPath;
 }
예제 #2
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            

            if (TVSettings.Instance.FolderJpg)
            {
                ItemList TheActionList = new ItemList();
                FileInfo fi = FileHelper.FileInFolder(si.AutoAdd_FolderBase, defaultFileName);
                bool fileDoesntExist = !doneFolderJPG.Contains(fi.FullName) && !fi.Exists;

                if (forceRefresh || fileDoesntExist)
                {
                    //default to poster when we want season posters for the season specific folders;
                    string itemToGet = (TVSettings.Instance.SeasonSpecificFolderJPG()) ? "poster" : TVSettings.Instance.ItemForFolderJpg();

                    string bannerPath = bannerPath = si.TheSeries().GetItem(itemToGet);

                    if (!string.IsNullOrEmpty(bannerPath))
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, false));
                    doneFolderJPG.Add(fi.FullName);
                }
                return TheActionList;

            }
            return null;
        }
예제 #3
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            // for each tv show, optionally write a tvshow.nfo file
            if (TVSettings.Instance.NFOs)
            {
                ItemList TheActionList = new ItemList();
                FileInfo tvshownfo = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "tvshow.nfo");

                bool needUpdate = !tvshownfo.Exists ||
                                  (si.TheSeries().Srv_LastUpdated > TimeZone.Epoch(tvshownfo.LastWriteTime)) ||
                    // was it written before we fixed the bug in <episodeguideurl> ?
                                  (tvshownfo.LastWriteTime.ToUniversalTime().CompareTo(new DateTime(2009, 9, 13, 7, 30, 0, 0, DateTimeKind.Utc)) < 0);

                bool alreadyOnTheList = DownloadXBMCMetaData.doneNFO.Contains(tvshownfo.FullName);

                if ((forceRefresh || needUpdate) && !alreadyOnTheList)
                {
                    TheActionList.Add(new ActionNFO(tvshownfo, si));
                    DownloadXBMCMetaData.doneNFO.Add(tvshownfo.FullName);
                }
                return TheActionList;

            }
            return base.ProcessShow(si, forceRefresh);
        }
예제 #4
0
        public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
        {
            if (TVSettings.Instance.FolderJpg)
            {
                // season folders JPGs

                ItemList TheActionList = new ItemList();
                FileInfo fi = FileHelper.FileInFolder(folder, defaultFileName);
                if (!doneFolderJPG.Contains(fi.FullName) && (!fi.Exists|| forceRefresh))
                // some folders may come up multiple times
                {

                    string bannerPath = "";

                    if (TVSettings.Instance.SeasonSpecificFolderJPG())
                    {
                        //We are getting a Series Level image
                        bannerPath = si.TheSeries().GetSeasonBannerPath(snum);
                    }
                    else
                    {
                        //We are getting a Show Level image
                        bannerPath = si.TheSeries().GetItem(TVSettings.Instance.ItemForFolderJpg());
                    }
                    if (!string.IsNullOrEmpty(bannerPath))
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath,
                                                                  TVSettings.Instance.ShrinkLargeMede8erImages));
                    doneFolderJPG.Add(fi.FullName);
                }
                return TheActionList;
            }

            
            return base.ProcessSeason(si,folder,snum,forceRefresh);
        }
예제 #5
0
 public ActionDownload(ShowItem si, ProcessedEpisode pe, FileInfo dest, string bannerPath, bool mede8erShrink)
 {
     this.Episode = pe;
     this.SI = si;
     this.Destination = dest;
     this.BannerPath = bannerPath;
     ShrinkLargeMede8erImage = mede8erShrink;
 }
 public ItemList ProcessShow(ShowItem si)
 {
     ItemList TheActionList = new ItemList(); 
     foreach (DownloadIdentifier di in Identifiers)
     {
         TheActionList.Add(di.ProcessShow(si));
     }
     return TheActionList;
 }
 public ItemList ProcessSeason(ShowItem si, string folder, int snum)
 {
     ItemList TheActionList = new ItemList(); 
     foreach (DownloadIdentifier di in Identifiers)
     {
         TheActionList.Add(di.ProcessSeason (si,folder,snum));
     }
     return TheActionList;
 }
예제 #8
0
 public ProcessedEpisode(SeriesInfo ser, Season seas, ShowItem si)
     : base(ser, seas)
 {
     this.NextToAir = false;
     this.OverallNumber = -1;
     this.Ignore = false;
     this.EpNum2 = this.EpNum;
     this.SI = si;
 }
예제 #9
0
 public ProcessedEpisode(ProcessedEpisode O)
     : base(O)
 {
     this.NextToAir = O.NextToAir;
     this.EpNum2 = O.EpNum2;
     this.Ignore = O.Ignore;
     this.SI = O.SI;
     this.OverallNumber = O.OverallNumber;
 }
예제 #10
0
 public ProcessedEpisode(Episode e, ShowItem si)
     : base(e)
 {
     this.OverallNumber = -1;
     this.NextToAir = false;
     this.EpNum2 = this.EpNum;
     this.Ignore = false;
     this.SI = si;
 }
 public ItemList ForceUpdateShow(DownloadIdentifier.DownloadType dt, ShowItem si)
 {
     ItemList TheActionList = new ItemList();
     foreach (DownloadIdentifier di in Identifiers)
     {
         if (dt == di.GetDownloadType())
             TheActionList.Add(di.ProcessShow(si,true));
     }
     return TheActionList;
 }
 public ItemList ForceUpdateSeason(DownloadIdentifier.DownloadType dt, ShowItem si, string folder, int snum)
 {
     ItemList TheActionList = new ItemList();
     foreach (DownloadIdentifier di in Identifiers)
     {
         if (dt == di.GetDownloadType())
             TheActionList.Add(di.ProcessSeason(si, folder,snum, true));
     }
     return TheActionList;
 }
예제 #13
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            //If we have XBMC New style images being downloaded then we want to check that 3 files exist
            //for the series:
            //http://wiki.xbmc.org/index.php?title=XBMC_v12_(Frodo)_FAQ#Local_images
            //poster
            //banner
            //fanart

            if (TVSettings.Instance.XBMCImages)
            {
                ItemList TheActionList = new ItemList();
                // base folder:
                if (!string.IsNullOrEmpty(si.AutoAdd_FolderBase) && (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");

                    if ((forceRefresh || (!posterJPG.Exists)) && (!donePosterJPG.Contains(si.AutoAdd_FolderBase)))
                    {
                        string path = si.TheSeries().GetItem("poster");
                        if (!string.IsNullOrEmpty(path))
                        {
                            TheActionList.Add(new ActionDownload(si, null, posterJPG, path, false));
                            donePosterJPG.Add(si.AutoAdd_FolderBase);
                        }
                    }

                    if ((forceRefresh || (!bannerJPG.Exists)) && (!doneBannerJPG.Contains(si.AutoAdd_FolderBase)))
                    {
                        string path = si.TheSeries().GetItem("banner");
                        if (!string.IsNullOrEmpty(path))
                        {
                            TheActionList.Add(new ActionDownload(si, null, bannerJPG, path, false));
                            doneBannerJPG.Add(si.AutoAdd_FolderBase);
                        }
                    }

                    if ((forceRefresh || (!fanartJPG.Exists)) && (!doneFanartJPG.Contains(si.AutoAdd_FolderBase)))
                    {
                        string path = si.TheSeries().GetItem("fanart");
                        if (!string.IsNullOrEmpty(path))
                        {
                            TheActionList.Add(new ActionDownload(si, null, fanartJPG, path));
                            doneFanartJPG.Add(si.AutoAdd_FolderBase);
                        }
                    }
                }
                return TheActionList;
            }

            return base.ProcessShow(si, forceRefresh);
        }
예제 #14
0
        public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList TheActionList = new ItemList();

                //Updates requested by [email protected] on 18/4/2013
                FileInfo viewxml = FileHelper.FileInFolder(folder, "view.xml");
                if (!viewxml.Exists) TheActionList.Add(new ActionMede8erViewXML(viewxml,si,snum));


                return TheActionList;
            }

            return base.ProcessSeason(si, folder, snum, forceRefresh);
        }
예제 #15
0
        public AddEditSeasEpFinders(List<FilenameProcessorRE> rex, List<ShowItem> sil, ShowItem initialShow, string initialFolder)
        {
            this.Rex = rex;
            this.SIL = sil;
            
            this.InitializeComponent();

            this.SetupGrid();
            this.FillGrid(this.Rex);

            foreach (ShowItem si in this.SIL)
            {
                this.cbShowList.Items.Add(si.ShowName);
                if (si == initialShow)
                    this.cbShowList.SelectedIndex = this.cbShowList.Items.Count - 1;
            }
            this.txtFolder.Text = initialFolder;
        }
예제 #16
0
        public EditRules(ShowItem si, List<ProcessedEpisode> originalEpList, int seasonNumber, CustomName style)
        {
            this.NameStyle = style;
            this.InitializeComponent();

            this.mSI = si;
            this.mOriginalEps = originalEpList;
            this.mSeasonNumber = seasonNumber;

            if (si.SeasonRules.ContainsKey(seasonNumber))
                this.WorkingRuleSet = new System.Collections.Generic.List<ShowRule>(si.SeasonRules[seasonNumber]);
            else
                this.WorkingRuleSet = new System.Collections.Generic.List<ShowRule>();

            this.txtShowName.Text = si.ShowName;
            this.txtSeasonNumber.Text = seasonNumber.ToString();

            this.FillRuleList(false, 0);
        }
예제 #17
0
        public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
        {
            if (TVSettings.Instance.SeriesJpg)
            {
                ItemList TheActionList = new ItemList();
                FileInfo fi = FileHelper.FileInFolder(folder, defaultFileName);
                if (forceRefresh ||(!doneJPG.Contains(fi.FullName) && !fi.Exists))
                {
                    string bannerPath = si.TheSeries().GetSeasonBannerPath(snum);
                    if (!string.IsNullOrEmpty(bannerPath))
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages));
                    doneJPG.Add(fi.FullName);
                }
                return TheActionList;
            }


            return base.ProcessSeason(si, folder, snum, forceRefresh);
        }
예제 #18
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            ItemList theActionList = new ItemList();

            if (!TVSettings.Instance.FolderJpg)
            {
                return(theActionList);
            }

            if (si is null)
            {
                return(theActionList);
            }

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

            if (forceRefresh || fileDoesntExist)
            {
                SeriesInfo series = si.TheSeries();

                if (series is null)
                {
                    return(theActionList);
                }

                //default to poster when we want season posters for the season specific folders
                string downloadPath = TVSettings.Instance.SeasonSpecificFolderJPG()
                    ? series.GetSeriesPosterPath()
                    : series.GetImage(TVSettings.Instance.ItemForFolderJpg());

                if (!string.IsNullOrEmpty(downloadPath))
                {
                    theActionList.Add(new ActionDownloadImage(si, null, fi, downloadPath, false));
                }

                doneFolderJpg.Add(fi.FullName);
            }
            return(theActionList);
        }
예제 #19
0
        private void ReviewDirInDownloadDirectory(string subDirPath)
        {
            //we are not checking for any file updates, so can return
            if (!TVSettings.Instance.RemoveDownloadDirectoriesFiles)
            {
                return;
            }

            if (!Directory.Exists(subDirPath))
            {
                return;
            }

            DirectoryInfo di = new DirectoryInfo(subDirPath);

            FileInfo neededFile = filesThatMayBeNeeded.FirstOrDefault(info => info.DirectoryName.Contains(di.FullName));

            if (neededFile != null)
            {
                LOGGER.Info($"Not removing {di.FullName} as it may be needed for {neededFile.FullName}");
                return;
            }

            List <ShowItem> matchingShows = showList.Where(si => si.NameMatch(di, TVSettings.Instance.UseFullPathNameToMatchSearchFolders)).ToList();

            if (!matchingShows.Any())
            {
                return;
            }

            ShowItem firstMatchingShow = matchingShows.FirstOrDefault(si => FinderHelper.FileNeeded(di, si, dfc));

            if (firstMatchingShow != null)
            {
                LOGGER.Info($"Not removing {di.FullName} as it may be needed for {firstMatchingShow.ShowName}");
                return;
            }

            returnActions.Add(SetupDirectoryRemoval(di, matchingShows));
        }
예제 #20
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            //We only want to do something if the fanart option is enabled. If the XBMC option is enabled then let it do the work.
            if ((TVSettings.Instance.FanArtJpg) && !TVSettings.Instance.XBMCImages)
            {
                ItemList TheActionList = new ItemList();
                FileInfo fi = FileHelper.FileInFolder(si.AutoAdd_FolderBase, defaultFileName);

                bool doesntExist =  !fi.Exists;
                if ((forceRefresh ||doesntExist) &&(!doneFanartJPG.Contains(fi.FullName)))
                {
                    string bannerPath = si.TheSeries().GetItem("fanart");

                    if (!string.IsNullOrEmpty(bannerPath))
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, false));
                    doneFanartJPG.Add(fi.FullName);
                }
                return TheActionList;

            }
            return base.ProcessShow(si, forceRefresh);
        }
예제 #21
0
        public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh)
        {
            if (!TVSettings.Instance.SeriesJpg)
            {
                return(null);
            }

            ItemList theActionList = new ItemList();
            FileInfo fi            = FileHelper.FileInFolder(folder, DEFAULT_FILE_NAME);

            if (forceRefresh || (!doneJpg.Contains(fi.FullName) && !fi.Exists))
            {
                string bannerPath = si.TheSeries()?.GetSeasonBannerPath(snum);
                if (!string.IsNullOrEmpty(bannerPath))
                {
                    theActionList.Add(new ActionDownloadImage(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages));
                }

                doneJpg.Add(fi.FullName);
            }
            return(theActionList);
        }
예제 #22
0
        public EditSeason([NotNull] ShowItem si, List <ProcessedEpisode> originalEpList, int seasonNumber, CustomEpisodeName style)
        {
            nameStyle = style;
            InitializeComponent();

            episodesToAddToSeen      = new List <ProcessedEpisode>();
            episodesToRemoveFromSeen = new List <ProcessedEpisode>();

            show          = si;
            mOriginalEps  = originalEpList;
            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);
        }
예제 #23
0
        private static string GetBestFolderLocationToOpen([NotNull] this ShowItem si, [NotNull] Season s)
        {
            Dictionary <int, List <string> > afl = si.AllExistngFolderLocations();

            if (afl.ContainsKey(s.SeasonNumber))
            {
                foreach (string folder in afl[s.SeasonNumber])
                {
                    if (Directory.Exists(folder))
                    {
                        return(folder);
                    }
                }
            }

            if (!string.IsNullOrEmpty(si.AutoAddFolderBase) && Directory.Exists(si.AutoAddFolderBase))
            {
                return(si.AutoAddFolderBase);
            }

            return(string.Empty);
        }
예제 #24
0
        public EditRules(ShowItem si, List <ProcessedEpisode> originalEpList, int seasonNumber, CustomEpisodeName style)
        {
            nameStyle = style;
            InitializeComponent();

            show          = si;
            mOriginalEps  = originalEpList;
            mSeasonNumber = seasonNumber;

            if (si.SeasonRules.ContainsKey(seasonNumber))
            {
                workingRuleSet = new List <ShowRule>(si.SeasonRules[seasonNumber]);
            }
            else
            {
                workingRuleSet = new List <ShowRule>();
            }

            txtShowName.Text     = si.ShowName;
            txtSeasonNumber.Text = seasonNumber.ToString();

            FillRuleList(false, 0);
        }
예제 #25
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Season   sn = (Season)value;
            ShowItem si = sn?.TheSeries?.Show;

            if (si is null)
            {
                return(Brushes.BlueViolet);
            }

            if (si.IgnoreSeasons.Contains(sn.SeasonNumber))
            {
                return(Brushes.Gray);
            }

            if (TVSettings.Instance.ShowStatusColors != null)
            {
                return(new SolidColorBrush(TVSettings.Instance.ShowStatusColors.GetEntry(true, false,
                                                                                         sn.Status(si.GetTimeZone()).ToString()) ?? Colors.Black));
            }

            return(Brushes.Black);
        }
예제 #26
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            //We only want to do something if the fanart option is enabled. If the KODI option is enabled then let it do the work.
            if ((TVSettings.Instance.FanArtJpg) && !TVSettings.Instance.KODIImages)
            {
                ItemList theActionList = new ItemList();
                FileInfo fi            = FileHelper.FileInFolder(si.AutoAddFolderBase, DEFAULT_FILE_NAME);

                bool doesntExist = !fi.Exists;
                if ((forceRefresh || doesntExist) && (!DoneFanartJpg.Contains(fi.FullName)))
                {
                    string bannerPath = si.TheSeries().GetSeriesFanartPath();

                    if (!string.IsNullOrEmpty(bannerPath))
                    {
                        theActionList.Add(new ActionDownloadImage(si, null, fi, bannerPath, false));
                    }
                    DoneFanartJpg.Add(fi.FullName);
                }
                return(theActionList);
            }
            return(base.ProcessShow(si, forceRefresh));
        }
예제 #27
0
        public AutoAddShow(string hint)
        {
            InitializeComponent();
            ShowItem   = new ShowItem();
            codeFinder = new TheTvdbCodeFinder("")
            {
                Dock = DockStyle.Fill
            };
            codeFinder.SetHint(hint);
            codeFinder.SelectionChanged += MTCCF_SelectionChanged;
            pnlCF.SuspendLayout();
            pnlCF.Controls.Add(codeFinder);
            pnlCF.ResumeLayout();
            ActiveControl = codeFinder; // set initial focus to the code entry/show finder control

            cbDirectory.SuspendLayout();
            cbDirectory.Items.Clear();
            cbDirectory.Items.AddRange(TVSettings.Instance.LibraryFolders.ToArray());
            cbDirectory.SelectedIndex = 0;
            cbDirectory.ResumeLayout();

            originalHint = hint;
        }
예제 #28
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            //We only want to do something if the fanart option is enabled. If the XBMC option is enabled then let it do the work.
            if ((TVSettings.Instance.FanArtJpg) && !TVSettings.Instance.XBMCImages)
            {
                ItemList TheActionList = new ItemList();
                FileInfo fi            = FileHelper.FileInFolder(si.AutoAdd_FolderBase, defaultFileName);

                bool doesntExist = !fi.Exists;
                if ((forceRefresh || doesntExist) && (!doneFanartJPG.Contains(fi.FullName)))
                {
                    string bannerPath = si.TheSeries().GetItem("fanart");

                    if (!string.IsNullOrEmpty(bannerPath))
                    {
                        TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, false));
                    }
                    doneFanartJPG.Add(fi.FullName);
                }
                return(TheActionList);
            }
            return(base.ProcessShow(si, forceRefresh));
        }
예제 #29
0
        private ShowSummaryData.ShowSummarySeasonData getSeasonDetails([NotNull] ShowItem si, [NotNull] SeriesInfo ser, int snum)
        {
            int           epCount      = 0;
            int           epGotCount   = 0;
            int           epAiredCount = 0;
            DirFilesCache dfc          = new DirFilesCache();
            Season        season       = null;

            Dictionary <int, Season> seasons = si.DvdOrder ? ser.DvdSeasons : ser.AiredSeasons;

            if (snum >= 0 && seasons.ContainsKey(snum))
            {
                season = seasons[snum];

                List <ProcessedEpisode> eis = si.SeasonEpisodes.ContainsKey(snum)
                    ? si.SeasonEpisodes[snum] // use processed episodes if they are available
                    : ShowItem.ProcessedListFromEpisodes(season.Episodes.Values, si);

                foreach (ProcessedEpisode ei in eis)
                {
                    epCount++;

                    // if has air date and has been aired in the past
                    if (ei.FirstAired != null && ei.FirstAired < DateTime.Now)
                    {
                        epAiredCount++;
                    }

                    List <FileInfo> fl = dfc.FindEpOnDisk(ei, false);
                    if (fl.Count != 0)
                    {
                        epGotCount++;
                    }
                }
            }
            return(new ShowSummaryData.ShowSummarySeasonData(snum, epCount, epAiredCount, epGotCount, season, si.IgnoreSeasons.Contains(snum)));
        }
예제 #30
0
        public override ItemList ProcessShow(ShowItem si,bool forceRefresh)
        {
            if (TVSettings.Instance.Mede8erXML)
            {
                ItemList TheActionList = new ItemList();

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

                bool needUpdate = !tvshowxml.Exists ||
                                  (si.TheSeries().Srv_LastUpdated > TimeZone.Epoch(tvshowxml.LastWriteTime));

                if (forceRefresh || needUpdate)
                    TheActionList.Add(new ActionMede8erXML(tvshowxml, si));

                //Updates requested by [email protected] on 18/4/2013
                FileInfo viewxml = FileHelper.FileInFolder(si.AutoAdd_FolderBase, "view.xml");
                if (!viewxml.Exists) TheActionList.Add(new ActionMede8erViewXML(viewxml,si));


                return TheActionList;
            }

            return base.ProcessShow(si, forceRefresh);
        }
예제 #31
0
        private static void AppendSeason(this StringBuilder sb, Season s, ShowItem si, Color backgroundColour)
        {
            if (si == null)
            {
                return;
            }

            SeriesInfo ser         = s.TheSeries;
            string     seasonLink  = TheTVDB.Instance.WebsiteUrl(ser.TvdbCode, s.SeasonId, false);
            string     showLink    = TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true);
            string     urlFilename = HttpUtility.UrlEncode(si.GetBestFolderLocationToOpen(s));

            string explorerButton = CreateButton($"{UI.EXPLORE_PROXY}{urlFilename}", "<i class=\"far fa-folder-open\"></i>", "Open Containing Folder");
            string tvdbButton     = CreateButton(seasonLink, "TVDB.com", "View on TVDB");

            sb.AppendLine($@"<div class=""card card-body"" style=""background-color:{backgroundColour.HexColour()}"">
				{s.CreateHorizontalBannerHtml()}
				<br/>
                <div class=""row"">
                    <div class=""col-8""><h1><A HREF=""{showLink}"">{ser.Name}</A> - <A HREF=""{seasonLink}"">{SeasonName(si, s.SeasonNumber)}</a></h1></div>
                    <div class=""col-4"">{explorerButton}{tvdbButton}</div>
                </div>
				</div>"                );
        }
예제 #32
0
        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) && (!doneFilesAndFolders.Contains(di.FullName)))
                {
                    doneFilesAndFolders.Add(di.FullName);
                    return(new ItemList()
                    {
                        new ActionDateTouch(di, si, newUpdateTime.Value)
                    });
                }
            }
            return(null);
        }
예제 #33
0
        private static string CreateHtml([NotNull] ShowItem si)
        {
            SeriesInfo series = si.TheSeries();

            if (series is null)
            {
                return(string.Empty);
            }

            string posterUrl      = TheTVDB.GetImageURL(series.GetImage(TVSettings.FolderJpgIsType.Poster));
            int    minYear        = series.MinYear;
            int    maxYear        = series.MaxYear;
            string yearRange      = (minYear == maxYear) ? minYear.ToString() : minYear + "-" + maxYear;
            string episodeSummary = series.AiredSeasons.Sum(pair => pair.Value.Episodes.Count).ToString();
            string stars          = ShowHtmlHelper.StarRating(series.SiteRating / 2);
            string genreIcons     = string.Join("&nbsp;", series.Genres().Select(ShowHtmlHelper.GenreIconHtml));
            string siteRating     = series.SiteRating > 0 ? series.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} ({series.Status})</h6><small class=""text-muted"">{episodeSummary} Episodes</small></div>
                </div>
            <div><blockquote>{series.Overview}</blockquote></div>
            <div><blockquote>{string.Join(", ", series.GetActorNames())}</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"">{series.ContentRating}<br>{series.Network}</div>
                <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{string.Join(", ", series.Genres())}</div>
            </div>
            </div></div></div>");
        }
예제 #34
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            // for each tv show, optionally write a tvshow.nfo file
            if (TVSettings.Instance.NFOShows)
            {
                ItemList theActionList = new ItemList();
                FileInfo tvshownfo     = FileHelper.FileInFolder(si.AutoAddFolderBase, "tvshow.nfo");

                SeriesInfo seriesInfo = si.TheSeries();
                bool       needUpdate = !tvshownfo.Exists ||
                                        seriesInfo is null ||
                                        seriesInfo.SrvLastUpdated > TimeZoneHelper.Epoch(tvshownfo.LastWriteTime);

                bool alreadyOnTheList = DoneNfo.Contains(tvshownfo.FullName);

                if ((forceRefresh || needUpdate) && !alreadyOnTheList)
                {
                    theActionList.Add(new ActionNfo(tvshownfo, si));
                    DoneNfo.Add(tvshownfo.FullName);
                }
                return(theActionList);
            }
            return(base.ProcessShow(si, forceRefresh));
        }
예제 #35
0
        private void SetAutoAdd([NotNull] ShowItem si)
        {
            switch (si.AutoAddType)
            {
            case ShowItem.AutomaticFolderType.none:
                chkAutoFolders.Checked = false;
                break;

            case ShowItem.AutomaticFolderType.baseOnly:
                chkAutoFolders.Checked    = true;
                rdoFolderBaseOnly.Checked = true;
                break;

            case ShowItem.AutomaticFolderType.custom:
                chkAutoFolders.Checked  = true;
                rdoFolderCustom.Checked = true;
                break;

            case ShowItem.AutomaticFolderType.libraryDefault:
                chkAutoFolders.Checked          = true;
                rdoFolderLibraryDefault.Checked = true;
                break;
            }
        }
예제 #36
0
        public override ItemList ProcessShow(ShowItem si, bool forceRefresh)
        {
            DateTime?newUpdateTime = si.TheSeries().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(si.AutoAdd_FolderBase);
                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);
        }
예제 #37
0
        public AutoAddShow(string hint, string filename)
        {
            InitializeComponent();
            ShowItem         = new ShowItem();
            lblFileName.Text = "Filename: " + filename;
            codeFinder       = new TheTvdbCodeFinder("")
            {
                Dock = DockStyle.Fill
            };
            codeFinder.SetHint(hint);
            codeFinder.SelectionChanged += MTCCF_SelectionChanged;
            pnlCF.SuspendLayout();
            pnlCF.Controls.Add(codeFinder);
            pnlCF.ResumeLayout();
            ActiveControl = codeFinder; // set initial focus to the code entry/show finder control

            cbDirectory.SuspendLayout();
            cbDirectory.Items.Clear();
            foreach (string folder in TVSettings.Instance.LibraryFolders)
            {
                cbDirectory.Items.Add(folder.TrimEnd(Path.DirectorySeparatorChar.ToString()));
            }

            if (TVSettings.Instance.DefShowAutoFolders && TVSettings.Instance.DefShowUseDefLocation)
            {
                cbDirectory.Text = TVSettings.Instance.DefShowLocation.TrimEnd(Path.DirectorySeparatorChar.ToString());
            }
            else
            {
                cbDirectory.SelectedIndex = 0;
            }

            cbDirectory.ResumeLayout();

            originalHint = hint;
        }
예제 #38
0
파일: UI.cs 프로젝트: madams74/tvrename
        private void FillEpGuideHTML(ShowItem si, int snum)
        {
            if (this.tabControl1.SelectedTab != this.tbMyShows)
                return;

            if (si == null)
            {
                this.SetGuideHTMLbody("");
                return;
            }
            TheTVDB db = this.mDoc.GetTVDB(true, "FillEpGuideHTML");
            SeriesInfo ser = db.GetSeries(si.TVDBCode);

            if (ser == null)
            {
                this.SetGuideHTMLbody("Not downloaded, or not available");
                return;
            }

            string body = "";

            List<string> skip = new List<String>
                                  {
                                      "Actors",
                                      "banner",
                                      "Overview",
                                      "Airs_Time",
                                      "Airs_DayOfWeek",
                                      "fanart",
                                      "poster",
                                      "zap2it_id"
                                  };

            if ((snum >= 0) && (ser.Seasons.ContainsKey(snum)))
            {
                if (!string.IsNullOrEmpty(ser.GetItem("banner")) && !string.IsNullOrEmpty(db.BannerMirror))
                    body += "<img width=758 height=140 src=\"" + db.BannerMirror + "/banners/" + ser.GetItem("banner") + "\"><br/>";

                Season s = ser.Seasons[snum];

                List<ProcessedEpisode> eis = null;
                // int snum = s.SeasonNumber;
                if (si.SeasonEpisodes.ContainsKey(snum))
                    eis = si.SeasonEpisodes[snum]; // use processed episodes if they are available
                else
                    eis = ShowItem.ProcessedListFromEpisodes(s.Episodes, si);

                string seasText = snum == 0 ? "Specials" : ("Season " + snum);
                if ((eis.Count > 0) && (eis[0].SeasonID > 0))
                    seasText = " - <A HREF=\"" + db.WebsiteURL(si.TVDBCode, eis[0].SeasonID, false) + "\">" + seasText + "</a>";
                else
                    seasText = " - " + seasText;

                body += "<h1><A HREF=\"" + db.WebsiteURL(si.TVDBCode, -1, true) + "\">" + si.ShowName + "</A>" + seasText + "</h1>";

                foreach (ProcessedEpisode ei in eis)
                {
                    string epl = ei.NumsAsString();

                    // http://www.thetvdb.com/?tab=episode&seriesid=73141&seasonid=5356&id=108303&lid=7
                    string episodeURL = "http://www.thetvdb.com/?tab=episode&seriesid=" + ei.SeriesID + "&seasonid=" + ei.SeasonID + "&id=" + ei.EpisodeID;

                    body += "<A href=\"" + episodeURL + "\" name=\"ep" + epl + "\">"; // anchor
                    body += "<b>" + CustomName.NameForNoExt(ei, CustomName.OldNStyle(6)) + "</b>";
                    body += "</A>"; // anchor
                    if (si.UseSequentialMatch && (ei.OverallNumber != -1))
                        body += " (#" + ei.OverallNumber + ")";

                    body += " <A HREF=\"" + this.mDoc.Settings.BTSearchURL(ei) + "\" class=\"search\">Search</A>";

                    System.Collections.Generic.List<System.IO.FileInfo> fl = this.mDoc.FindEpOnDisk(ei);
                    if (fl != null)
                    {
                        foreach (FileInfo fi in fl)
                            body += " <A HREF=\"file://" + fi.FullName + "\" class=\"search\">Watch</A>";
                    }

                    DateTime? dt = ei.GetAirDateDT(true);
                    if ((dt != null) && (dt.Value.CompareTo(DateTime.MaxValue) != 0))
                        body += "<p>" + dt.Value.ToShortDateString() + " (" + ei.HowLong() + ")";

                    body += "<p><p>";

                    if (this.mDoc.Settings.ShowEpisodePictures)
                    {
                        body += "<table><tr>";
                        body += "<td width=100% valign=top>" + ei.Overview + "</td><td width=300 height=225>";
                        // 300x168 / 300x225
                        if (!string.IsNullOrEmpty(ei.GetItem("filename")))
                            body += "<img src=" + db.BannerMirror + "/banners/_cache/" + ei.GetItem("filename") + ">";
                        body += "</td></tr></table>";
                    }
                    else
                        body += ei.Overview;

                    body += "<p><hr><p>";
                } // for each episode in this season
            }
            else
            {
                // no epnum specified, just show an overview
                if ((!string.IsNullOrEmpty(ser.GetItem("banner"))) && (!string.IsNullOrEmpty(db.BannerMirror)))
                    body += "<img width=758 height=140 src=\"" + db.BannerMirror + "/banners/" + ser.GetItem("banner") + "\"><br/>";

                body += "<h1><A HREF=\"" + db.WebsiteURL(si.TVDBCode, -1, true) + "\">" + si.ShowName + "</A> " + "</h1>";

                body += "<h2>Overview</h2>" + ser.GetItem("Overview");

                string actors = ser.GetItem("Actors");
                if (!string.IsNullOrEmpty(actors))
                {
                    bool first = true;
                    foreach (string aa in actors.Split('|'))
                    {
                        if (!string.IsNullOrEmpty(aa))
                        {
                            if (!first)
                                body += ", ";
                            else
                                body += "<h2>Actors</h2>";
                            body += "<A HREF=\"http://www.imdb.com/find?s=nm&q=" + aa + "\">" + aa + "</a>";
                            first = false;
                        }
                    }
                }

                string airsTime = ser.GetItem("Airs_Time");
                string airsDay = ser.GetItem("Airs_DayOfWeek");
                if ((!string.IsNullOrEmpty(airsTime)) && (!string.IsNullOrEmpty(airsDay)))
                {
                    body += "<h2>Airs</h2> " + airsTime + " " + airsDay;
                    string net = ser.GetItem("Network");
                    if (!string.IsNullOrEmpty(net))
                    {
                        skip.Add("Network");
                        body += ", " + net;
                    }
                }

                bool firstInfo = true;
                foreach (System.Collections.Generic.KeyValuePair<string, string> kvp in ser.Items)
                {
                    if (firstInfo)
                    {
                        body += "<h2>Information<table border=0>";
                        firstInfo = false;
                    }
                    if (!skip.Contains(kvp.Key))
                    {
                        if (kvp.Key == "SeriesID")
                            body += "<tr><td width=120px>tv.com</td><td><A HREF=\"http://www.tv.com/show/" + kvp.Value + "/summary.html\">Visit</a></td></tr>";
                        else if (kvp.Key == "IMDB_ID")
                            body += "<tr><td width=120px>imdb.com</td><td><A HREF=\"http://www.imdb.com/title/" + kvp.Value + "\">Visit</a></td></tr>";
                        else
                            body += "<tr><td width=120px>" + kvp.Key + "</td><td>" + kvp.Value + "</td></tr>";
                    }
                }
                if (!firstInfo)
                    body += "</table>";
            }
            db.Unlock("FillEpGuideHTML");
            this.SetGuideHTMLbody(body);
        }
예제 #39
0
파일: UI.cs 프로젝트: madams74/tvrename
        public void TVDBFor(ShowItem si)
        {
            if (si == null)
                return;

            TVDoc.SysOpen(this.mDoc.GetTVDB(false, "").WebsiteURL(si.TVDBCode, -1, false));
        }
예제 #40
0
파일: UI.cs 프로젝트: madams74/tvrename
        private void EditSeason(ShowItem si, int seasnum)
        {
            this.MoreBusy();

            TheTVDB db = this.mDoc.GetTVDB(true, "EditSeason");
            SeriesInfo ser = db.GetSeries(si.TVDBCode);
            List<ProcessedEpisode> pel = TVDoc.GenerateEpisodes(si, ser, seasnum, false);

            EditRules er = new EditRules(si, pel, seasnum, this.mDoc.Settings.NamingStyle);
            System.Windows.Forms.DialogResult dr = er.ShowDialog();
            db.Unlock("EditSeason");
            if (dr == DialogResult.OK)
            {
                this.ShowAddedOrEdited(false);
                if (ser != null)
                    this.SelectSeason(ser.Seasons[seasnum]);
            }

            this.LessBusy();
        }
예제 #41
0
파일: UI.cs 프로젝트: madams74/tvrename
        private void EditShow(ShowItem si)
        {
            this.MoreBusy();
            TheTVDB db = this.mDoc.GetTVDB(true, "EditShow");
            SeriesInfo ser = db.GetSeries(si.TVDBCode);

            int oldCode = si.TVDBCode;

            AddEditShow aes = new AddEditShow(si, db);

            System.Windows.Forms.DialogResult dr = aes.ShowDialog();

            db.Unlock("EditShow");

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                if (ser != null)
                    ser.ShowTimeZone = aes.ShowTimeZone; // TODO: move into AddEditShow

                this.ShowAddedOrEdited(si.TVDBCode != oldCode);
                this.SelectShow(si);
            }
            this.LessBusy();
        }
예제 #42
0
파일: UI.cs 프로젝트: madams74/tvrename
 private void bnMyShowsAdd_Click(object sender, System.EventArgs e)
 {
     this.MoreBusy();
     ShowItem si = new ShowItem(this.mDoc.GetTVDB(false, ""));
     TheTVDB db = this.mDoc.GetTVDB(true, "AddShow");
     AddEditShow aes = new AddEditShow(si, db);
     System.Windows.Forms.DialogResult dr = aes.ShowDialog();
     db.Unlock("AddShow");
     if (dr == System.Windows.Forms.DialogResult.OK)
     {
         this.mDoc.GetShowItems(true).Add(si);
         this.mDoc.UnlockShowItems();
         SeriesInfo ser = db.GetSeries(si.TVDBCode);
         if (ser != null)
             ser.ShowTimeZone = aes.ShowTimeZone;
         this.ShowAddedOrEdited(true);
         this.SelectShow(si);
     }
     this.LessBusy();
 }
예제 #43
0
파일: UI.cs 프로젝트: madams74/tvrename
        private void DeleteShow(ShowItem si)
        {
            System.Windows.Forms.DialogResult res = MessageBox.Show("Remove show \"" + si.ShowName + "\".  Are you sure?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (res != System.Windows.Forms.DialogResult.Yes)
                return;

            this.mDoc.GetShowItems(true).Remove(si);
            this.mDoc.UnlockShowItems();
            this.ShowAddedOrEdited(false);
        }
예제 #44
0
파일: UI.cs 프로젝트: madams74/tvrename
 public void SelectShow(ShowItem si)
 {
     foreach (TreeNode n in this.MyShowTree.Nodes)
     {
         if (this.TreeNodeToShowItem(n) == si)
         {
             n.EnsureVisible();
             this.MyShowTree.SelectedNode = n;
             //FillEpGuideHTML();
             return;
         }
     }
     this.FillEpGuideHTML(null);
 }
예제 #45
0
파일: UI.cs 프로젝트: madams74/tvrename
        ////// //////// ////// //////// ////// //////// ////// //////// ////// //////// ////// //////// ////// //////// 

        public TreeNode AddShowItemToTree(ShowItem si)
        {
            TheTVDB db = this.mDoc.GetTVDB(true, "AddShowItemToTree");
            string name = si.ShowName;

            SeriesInfo ser = db.GetSeries(si.TVDBCode);

            if (string.IsNullOrEmpty(name))
            {
                if (ser != null)
                    name = ser.Name;
                else
                    name = "-- Unknown : " + si.TVDBCode + " --";
            }

            TreeNode n = new TreeNode(name);
            n.Tag = si;

            if (ser != null)
            {
                if (mDoc.Settings.ShowStatusColors != null)
                {
                    if (mDoc.Settings.ShowStatusColors.IsShowStatusDefined(si.ShowStatus))
                    {
                        n.ForeColor = mDoc.Settings.ShowStatusColors.GetEntry(false, true, si.ShowStatus);
                    }
                    else
                    {
                        Color nodeColor = mDoc.Settings.ShowStatusColors.GetEntry(true, true, si.SeasonsAirStatus.ToString());
                        if (!nodeColor.IsEmpty)
                            n.ForeColor = nodeColor;
                    }
                }
                System.Collections.Generic.List<int> theKeys = new System.Collections.Generic.List<int>(ser.Seasons.Keys);
                // now, go through and number them all sequentially
                //foreach (int snum in ser.Seasons.Keys)
                //    theKeys.Add(snum);

                theKeys.Sort();
                

                foreach (int snum in theKeys)
                {
                    string nodeTitle = snum == 0 ? "Specials" : "Season " + snum;
                    TreeNode n2 = new TreeNode(nodeTitle);
                    if (si.IgnoreSeasons.Contains(snum))
                        n2.ForeColor = Color.Gray;
                    else
                    {
                        if (mDoc.Settings.ShowStatusColors != null)
                        {
                            Color nodeColor = mDoc.Settings.ShowStatusColors.GetEntry(true, false, ser.Seasons[snum].Status.ToString());
                            if (!nodeColor.IsEmpty)
                                n2.ForeColor = nodeColor;
                        }
                    }
                    n2.Tag = ser.Seasons[snum];
                    n.Nodes.Add(n2);
                }
            }

            this.MyShowTree.Nodes.Add(n);

            db.Unlock("AddShowItemToTree");

            return n;
        }
예제 #46
0
파일: UI.cs 프로젝트: madams74/tvrename
 public void RightClickOnMyShows(ShowItem si, Point pt)
 {
     this.mLastShowsClicked = new List<ShowItem>() { si };
     this.mLastEpClicked = null;
     this.mLastSeasonClicked = null;
     this.mLastActionsClicked = null;
     this.BuildRightClickMenu(pt);
 }
예제 #47
0
파일: UI.cs 프로젝트: madams74/tvrename
 public void GotoEpguideFor(ShowItem si, bool changeTab)
 {
     if (changeTab)
         this.tabControl1.SelectTab(this.tbMyShows);
     this.FillEpGuideHTML(si, -1);
 }
예제 #48
0
 public ActionDownload(ShowItem si, ProcessedEpisode pe, FileInfo dest, string bannerPath) : this(si, pe, dest, bannerPath, false) { }