Пример #1
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;
 }
Пример #2
0
        public Season GetOrAddSeason(int num, int seasonID)
        {
            if (this.Seasons.ContainsKey(num))
                return this.Seasons[num];

            Season s = new Season(this, num, seasonID);
            this.Seasons[num] = s;

            return s;
        }
Пример #3
0
        public Episode(Episode O)
        {
            this.EpisodeID = O.EpisodeID;
            this.SeriesID = O.SeriesID;
            this.EpNum = O.EpNum;
            this.FirstAired = O.FirstAired;
            this.Srv_LastUpdated = O.Srv_LastUpdated;
            this.Overview = O.Overview;
            this.EpisodeRating = O.EpisodeRating;
            this.EpisodeGuestStars = O.EpisodeGuestStars;
            this.EpisodeDirector = O.EpisodeDirector;
            this.Writer = O.Writer;
            this.Name = O.Name;
            this.TheSeason = O.TheSeason;
            this.TheSeries = O.TheSeries;
            this.SeasonID = O.SeasonID;
            this.Dirty = O.Dirty;

            this.Items = new System.Collections.Generic.Dictionary<string, string>();
            foreach (System.Collections.Generic.KeyValuePair<string, string> i in O.Items)
                this.Items.Add(i.Key, i.Value);
        }
Пример #4
0
        public Banner(Banner O)
        {

            this.BannerId = O.BannerId;
            this.BannerPath = O.BannerPath;
            this.BannerType = O.BannerType;
            this.BannerType2 = O.BannerType2;
            this.Language = O.Language;
            this.Rating = O.Rating;
            this.RatingCount = O.RatingCount;
            this.SeasonID = O.SeasonID;
            this.SeriesID = O.SeriesID;

            this.Colors = O.Colors;
            this.ThumbnailPath = O.ThumbnailPath;
            this.VignettePath = O.VignettePath;
            this.SeriesName = O.SeriesName;
            
            this.Name = O.Name;
            this.TheSeason = O.TheSeason;
            this.TheSeries = O.TheSeries;

        }
Пример #5
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);
        }
Пример #6
0
        public Episode(SeriesInfo ser, Season seas, XmlReader r, CommandLineArgs args)
        {
            // <Episode>
            //  <id>...</id>
            //  blah blah
            // </Episode>

            try
            {
                this.SetDefaults(ser, seas);

                r.Read();
                if (r.Name != "Episode")
                    return;

                r.Read();
                while (!r.EOF)
                {
                    if ((r.Name == "Episode") && (!r.IsStartElement()))
                        break;
                    if (r.Name == "id")
                        this.EpisodeID = r.ReadElementContentAsInt();
                    else if (r.Name == "seriesid")
                        this.SeriesID = r.ReadElementContentAsInt(); // thetvdb series id
                    else if (r.Name == "seasonid")
                        this.SeasonID = r.ReadElementContentAsInt();
                    else if (r.Name == "EpisodeNumber")
                        this.EpNum = r.ReadElementContentAsInt();
                    else if (r.Name == "SeasonNumber")
                    {
                        String sn = r.ReadElementContentAsString();
                        int.TryParse(sn, out this.ReadSeasonNum);
                    }
                    else if (r.Name == "lastupdated")
                        this.Srv_LastUpdated = r.ReadElementContentAsInt();
                    else if (r.Name == "Overview")
                        this.Overview = Helpers.ReadStringFixQuotesAndSpaces(r);
                    else if (r.Name == "Rating")        
                        this.EpisodeRating = Helpers.ReadStringFixQuotesAndSpaces(r);  
                    else if (r.Name == "GuestStars")
                        this.EpisodeGuestStars = Helpers.ReadStringFixQuotesAndSpaces(r);      
                    else if (r.Name == "Director")
                        this.EpisodeDirector = Helpers.ReadStringFixQuotesAndSpaces(r);      
                    else if (r.Name == "Writer")
                        this.Writer = Helpers.ReadStringFixQuotesAndSpaces(r);      
                    else if (r.Name == "EpisodeName")
                        this.Name = Helpers.ReadStringFixQuotesAndSpaces(r);
                    else if (r.Name == "FirstAired")
                    {
                        try
                        {
                            this.FirstAired = DateTime.ParseExact(r.ReadElementContentAsString(), "yyyy-MM-dd", new System.Globalization.CultureInfo(""));
                        }
                        catch
                        {
                            this.FirstAired = null;
                        }
                    }
                    else
                    {
                        if ((r.IsEmptyElement) || !r.IsStartElement())
                            r.ReadOuterXml();
                        else
                        {
                            XmlReader r2 = r.ReadSubtree();
                            r2.Read();
                            string name = r2.Name;
                            this.Items[name] = r2.ReadElementContentAsString();
                            r.Read();
                        }
                    }
                }
            }
            catch (XmlException e)
            {
                string message = "Error processing data from TheTVDB for an episode.";
                if (this.SeriesID != -1)
                    message += "\r\nSeries ID: " + this.SeriesID;
                if (this.EpisodeID != -1)
                    message += "\r\nEpisode ID: " + this.EpisodeID;
                if (this.EpNum != -1)
                    message += "\r\nEpisode Number: " + this.EpNum;
                if (!string.IsNullOrEmpty(this.Name))
                    message += "\r\nName: " + this.Name;

                message += "\r\n" + e.Message;

                if (!args.Unattended) 
                    MessageBox.Show(message, "TVRename", MessageBoxButtons.OK, MessageBoxIcon.Error);

                throw new TVDBException(e.Message);
            }
        }
Пример #7
0
        public void SetDefaults(SeriesInfo ser, Season seas)
        {
            this.TheSeason = seas;
            this.TheSeries = ser;


            this.BannerId = -1;
            this.BannerPath = "";
            this.BannerType = "";
            this.BannerType2 = "";
            this.Language = "";
            this.Rating = -1;
            this.RatingCount = 0;
            this.SeasonID = -1;
            this.SeriesID = -1;

            this.Colors = "";
            this.ThumbnailPath = "";
            this.VignettePath = "";
            this.SeriesName = "";

        }
Пример #8
0
        public void TVDBFor(Season seas)
        {
            if (seas == null)
                return;

            Helpers.SysOpen(TheTVDB.Instance.WebsiteURL(seas.TheSeries.TVDBCode, -1, false));
        }
Пример #9
0
 internal static string SeasonName(Season s)
 {
     return(SeasonName(s.TheSeries.Show, s.SeasonNumber));
 }
Пример #10
0
        public AddEditShow([NotNull] ShowItem si)
        {
            selectedShow  = si;
            sampleSeason  = si.GetFirstAvailableSeason();
            sampleEpisode = si.GetFirstAvailableEpisode();
            InitializeComponent();

            lblSeasonWordPreview.Text      = TVSettings.Instance.SeasonFolderFormat + "-(" + CustomSeasonName.NameFor(si.GetFirstAvailableSeason(), TVSettings.Instance.SeasonFolderFormat) + ")";
            lblSeasonWordPreview.ForeColor = Color.DarkGray;

            SetupDropDowns(si);

            codeFinderForm =
                new TheTvdbCodeFinder(si.TvdbCode != -1 ? si.TvdbCode.ToString() : "")
            {
                Dock = DockStyle.Fill
            };

            pnlCF.SuspendLayout();
            pnlCF.Controls.Add(codeFinderForm);
            pnlCF.ResumeLayout();

            cntfw = null;
            chkCustomShowName.Checked = si.UseCustomShowName;
            if (chkCustomShowName.Checked)
            {
                txtCustomShowName.Text = si.CustomShowName;
            }

            chkCustomShowName_CheckedChanged(null, null);

            chkCustomLanguage.Checked = si.UseCustomLanguage;
            if (chkCustomLanguage.Checked)
            {
                Language languageFromCode = TheTVDB.Instance.LanguageList.GetLanguageFromCode(si.CustomLanguageCode);
                if (languageFromCode != null)
                {
                    cbLanguage.Text = languageFromCode.Name;
                }
            }

            chkCustomLanguage_CheckedChanged(null, null);

            cbSequentialMatching.Checked = si.UseSequentialMatch;
            chkShowNextAirdate.Checked   = si.ShowNextAirdate;
            chkSpecialsCount.Checked     = si.CountSpecials;
            txtBaseFolder.Text           = si.AutoAddFolderBase;

            cbDoRenaming.Checked     = si.DoRename;
            cbDoMissingCheck.Checked = si.DoMissingCheck;
            cbDoMissingCheck_CheckedChanged(null, null);

            SetAutoAdd(si);

            txtSeasonFormat.Text = si.AutoAddCustomFolderFormat;

            chkDVDOrder.Checked           = si.DvdOrder;
            cbIncludeFuture.Checked       = si.ForceCheckFuture;
            cbIncludeNoAirdate.Checked    = si.ForceCheckNoAirdate;
            chkReplaceAutoFolders.Checked = si.ManualFoldersReplaceAutomatic;

            SetIgnoreSeasons(si);

            SetManualFolders(si);

            txtSeasonNumber_TextChanged(null, null);
            txtFolder_TextChanged();

            ActiveControl = codeFinderForm; // set initial focus to the code entry/show finder control

            foreach (string aliasName in selectedShow.AliasNames)
            {
                lbShowAlias.Items.Add(aliasName);
            }

            SetTagListText();

            cbUseCustomSearch.Checked = si.UseCustomSearchUrl && !string.IsNullOrWhiteSpace(si.CustomSearchUrl);
            txtSearchURL.Text         = si.CustomSearchUrl ?? "";
            EnableDisableCustomSearch();
        }
Пример #11
0
 public ShowSummarySeasonData(int seasonNumber, int episodeCount, int episodeAiredCount, int episodeGotCount, Season season, bool ignored)
 {
     SeasonNumber           = seasonNumber;
     this.episodeCount      = episodeCount;
     this.episodeAiredCount = episodeAiredCount;
     this.episodeGotCount   = episodeGotCount;
     Season  = season;
     Ignored = ignored;
 }
Пример #12
0
        public Banner(SeriesInfo ser, Season seas, int? codeHint, XmlReader r, CommandLineArgs args)
        {
            // <Banner>
            //        <id>708811</id>
            //        <BannerPath>seasonswide/79488-5.jpg</BannerPath>
            //        <BannerType>season</BannerType>
            //        <BannerType2>seasonwide</BannerType2>
            //        <Language>en</Language>
            //        <Rating/>
            //        <RatingCount>0</RatingCount>
            //        <Season>5</Season>
            //  blah blah
            // </Banner>



            try
            {
                this.SetDefaults(ser, seas);

                this.SeriesID = (int) codeHint;

                r.Read();
                if (r.Name != "Banner")
                    return;

                r.Read();
                while (!r.EOF)
                {
                    if ((r.Name == "Banner") && (!r.IsStartElement()))
                        break;

                    if (r.Name == "id")
                        this.BannerId = r.ReadElementContentAsInt();
                    else if (r.Name == "seriesid")
                        this.SeriesID = r.ReadElementContentAsInt(); // thetvdb series id
                    else if (r.Name == "seasonid")
                        this.SeasonID = r.ReadElementContentAsInt();
                    else if (r.Name == "BannerPath")
                        this.BannerPath = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    else if (r.Name == "BannerType")
                        this.BannerType = r.ReadElementContentAsString();
                    else if (r.Name == "BannerType2")
                        this.BannerType2 = r.ReadElementContentAsString();
                    else if (r.Name == "Language")
                        this.Language = r.ReadElementContentAsString();
                    else if (r.Name == "Rating")
                        {
                        String sn = r.ReadElementContentAsString();
                        double.TryParse(sn, out this.Rating);
                        }
                    else if (r.Name == "RatingCount")
                        this.RatingCount  = r.ReadElementContentAsInt();
                    else if (r.Name == "Season")
                        this.SeasonID = r.ReadElementContentAsInt();
                    else if (r.Name == "Colors") this.Colors = r.ReadElementContentAsString();
                    else if (r.Name == "ThumbnailPath") this.ThumbnailPath = r.ReadElementContentAsString();
                    else if (r.Name == "VignettePath") this.VignettePath = r.ReadElementContentAsString();
                    else if (r.Name == "SeriesName") this.SeriesName = r.ReadElementContentAsString();
                    else
                    {
                        if ((r.IsEmptyElement) || !r.IsStartElement())
                            r.ReadOuterXml();
                        else
                            r.Read();
                    }
                }
            }
            catch (XmlException e)
            {
                string message = "Error processing data from TheTVDB for a banner.";
                if (this.SeriesID != -1)
                    message += "\r\nSeries ID: " + this.SeriesID;
                if (this.BannerId != -1)
                    message += "\r\nBanner ID: " + this.BannerId;
                if (!string.IsNullOrEmpty(this.BannerPath))
                    message += "\r\nBanner Path: " + this.BannerPath;
                if (!string.IsNullOrEmpty(this.Name))
                    message += "\r\nName: " + this.Name;

                message += "\r\n" + e.Message;

                if (!args.Unattended) 
                    MessageBox.Show(message, "TVRename", MessageBoxButtons.OK, MessageBoxIcon.Error);

                throw new TVDBException(e.Message);
            }
        }
Пример #13
0
 public void SelectSeason(Season seas)
 {
     foreach (TreeNode n in this.MyShowTree.Nodes)
     {
         foreach (TreeNode n2 in n.Nodes)
         {
             if (TreeNodeToSeason(n2) == seas)
             {
                 n2.EnsureVisible();
                 this.MyShowTree.SelectedNode = n2;
                 return;
             }
         }
     }
     this.FillEpGuideHTML(null);
 }
Пример #14
0
 private static List <ProcessedEpisode> GetBestEpisodes(ShowItem si, Season s)
 {
     return(si.SeasonEpisodes.ContainsKey(s.SeasonNumber)
         ? si.SeasonEpisodes[s.SeasonNumber]
         : ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si));
 }
Пример #15
0
        public Banner(SeriesInfo ser, Season seas, int?codeHint, XmlReader r, CommandLineArgs args)
        {
            // <Banner>
            //        <id>708811</id>
            //        <BannerPath>seasonswide/79488-5.jpg</BannerPath>
            //        <BannerType>season</BannerType>
            //        <BannerType2>seasonwide</BannerType2>
            //        <Language>en</Language>
            //        <Rating/>
            //        <RatingCount>0</RatingCount>
            //        <Season>5</Season>
            //  blah blah
            // </Banner>



            try
            {
                this.SetDefaults(ser, seas);

                this.SeriesID = (int)codeHint;

                r.Read();
                if (r.Name != "Banner")
                {
                    return;
                }

                r.Read();
                while (!r.EOF)
                {
                    if ((r.Name == "Banner") && (!r.IsStartElement()))
                    {
                        break;
                    }

                    if (r.Name == "id")
                    {
                        this.BannerId = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "seriesid")
                    {
                        this.SeriesID = r.ReadElementContentAsInt(); // thetvdb series id
                    }
                    else if (r.Name == "seasonid")
                    {
                        this.SeasonID = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "BannerPath")
                    {
                        this.BannerPath = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "BannerType")
                    {
                        this.BannerType = r.ReadElementContentAsString();
                    }
                    else if (r.Name == "LanguageId")
                    {
                        this.LanguageId = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "Resolution")
                    {
                        this.Resolution = r.ReadElementContentAsString();
                    }
                    else if (r.Name == "Rating")
                    {
                        String sn = r.ReadElementContentAsString();
                        double.TryParse(sn, out this.Rating);
                    }
                    else if (r.Name == "RatingCount")
                    {
                        this.RatingCount = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "Season")
                    {
                        this.SeasonID = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "ThumbnailPath")
                    {
                        this.ThumbnailPath = r.ReadElementContentAsString();
                    }
                    else
                    {
                        if ((r.IsEmptyElement) || !r.IsStartElement())
                        {
                            r.ReadOuterXml();
                        }
                        else
                        {
                            r.Read();
                        }
                    }
                }
            }
            catch (XmlException e)
            {
                string message = "Error processing data from TheTVDB for a banner.";
                if (this.SeriesID != -1)
                {
                    message += "\r\nSeries ID: " + this.SeriesID;
                }
                if (this.BannerId != -1)
                {
                    message += "\r\nBanner ID: " + this.BannerId;
                }
                if (!string.IsNullOrEmpty(this.BannerPath))
                {
                    message += "\r\nBanner Path: " + this.BannerPath;
                }

                logger.Error(e, message);

                throw new TVDBException(e.Message);
            }
        }
Пример #16
0
 public Banner(SeriesInfo ser, Season seas)
 {
     this.SetDefaults(ser, seas);
 }
Пример #17
0
 public static string NameFor(Season s, string styleString) => NameFor(s, styleString, false);
Пример #18
0
 public string NameFor(Season s) => NameFor(s, styleString);
Пример #19
0
 public void RightClickOnMyShows(Season seas, Point pt)
 {
     this.mLastShowsClicked =  new List<ShowItem>() { this.mDoc.GetShowItem(seas.TheSeries.TVDBCode) };
     this.mLastEpClicked = null;
     this.mLastSeasonClicked = seas;
     this.mLastActionsClicked = null;
     this.BuildRightClickMenu(pt);
 }
Пример #20
0
 private static IEnumerable <ProcessedEpisode> GetBestEpisodes([NotNull] ShowItem si, [NotNull] Season s)
 {
     return(si.SeasonEpisodes.ContainsKey(s.SeasonNumber)
         ? si.SeasonEpisodes[s.SeasonNumber]
         : ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si));
 }
Пример #21
0
        public UI(TVDoc doc)
        {
            this.mDoc = doc;

            this.Busy = 0;
            this.mLastEpClicked = null;
            this.mLastFolderClicked = null;
            this.mLastSeasonClicked = null;
            this.mLastShowsClicked = null;
            this.mLastActionsClicked = null;

            this.mInternalChange = 0;
            this.mFoldersToOpen = new List<String>();

            this.InternalCheckChange = false;

            this.InitializeComponent();

            this.SetupIPC();

            try
            {
                this.LoadLayoutXML();
            }
            catch
            {
                // silently fail, doesn't matter too much
            }

            this.SetProgress += this.SetProgressActual;

            this.lvWhenToWatch.ListViewItemSorter = new DateSorterWTW();

            if (this.mDoc.Args.Hide)
            {
                this.WindowState = FormWindowState.Minimized;
                this.Visible = false;
                this.Hide();
            }

            this.Text = this.Text + " " + Version.DisplayVersionString();

            this.FillMyShows();
            this.UpdateSearchButton();
            this.SetGuideHTMLbody("");
            this.mDoc.DoWhenToWatch(true);
            this.FillWhenToWatchList();
            this.mDoc.WriteUpcomingRSSandXML();
            this.ShowHideNotificationIcon();

            int t = this.mDoc.Settings.StartupTab;
            if (t < this.tabControl1.TabCount)
                this.tabControl1.SelectedIndex = this.mDoc.Settings.StartupTab;
            this.tabControl1_SelectedIndexChanged(null, null);

            this.mAutoFolderMonitor = new TVRename.AutoFolderMonitor(mDoc,this);
            if (this.mDoc.Settings.MonitorFolders)
                this.mAutoFolderMonitor.StartMonitor();


        }
Пример #22
0
        public static string GetSeasonHtmlOverviewOffline([NotNull] this ShowItem si, [NotNull] Season s)
        {
            SeriesInfo ser  = s.TheSeries;
            int        snum = s.SeasonNumber;
            string     body = "";

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

            List <ProcessedEpisode> eis = si.SeasonEpisodes.ContainsKey(snum) ?
                                          si.SeasonEpisodes[snum] :
                                          ShowItem.ProcessedListFromEpisodes(s.Episodes.Values, si);

            string seasText = SeasonName(si, snum);

            if (eis.Count > 0 && eis[0].SeasonId > 0)
            {
                seasText = " - <A HREF=\"" + TheTVDB.Instance.WebsiteUrl(ser.TvdbCode, eis[0].SeasonId, false) + "\">" +
                           seasText + "</a>";
            }
            else
            {
                seasText = " - " + seasText;
            }

            body += "<h1><A HREF=\"" + TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true) + "\">" + si.ShowName +
                    "</A>" + seasText + "</h1>";

            DirFilesCache dfc = new DirFilesCache();

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

                string episodeUrl = TheTVDB.WebsiteUrl(ei.SeriesId, ei.SeasonId, ei.EpisodeId);

                body += "<A href=\"" + episodeUrl + "\" name=\"ep" + epl + "\">"; // anchor
                if (si.DvdOrder && snum == 0)
                {
                    body += "<b>" + ei.Name + "</b>";
                }
                else
                {
                    body += "<b>" + HttpUtility.HtmlEncode(CustomEpisodeName.NameForNoExt(ei, CustomEpisodeName.OldNStyle(6))) +
                            "</b>";
                }

                body += "</A>"; // anchor
                if (si.UseSequentialMatch && ei.OverallNumber != -1)
                {
                    body += " (#" + ei.OverallNumber + ")";
                }

                List <FileInfo> fl = dfc.FindEpOnDisk(ei);
                if (fl.Count > 0)
                {
                    foreach (FileInfo fi in fl)
                    {
                        string urlFilename = HttpUtility.UrlEncode(fi.FullName);
                        body += $" <A HREF=\"watch://{urlFilename}\" class=\"search\">Watch</A>";
                        body += $" <A HREF=\"explore://{urlFilename}\" class=\"search\">Show in Explorer</A>";
                    }
                }
                else
                {
                    body += " <A HREF=\"" + TVSettings.Instance.BTSearchURL(ei) + "\" class=\"search\">Search</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 (TVSettings.Instance.ShowEpisodePictures ||
                    TVSettings.Instance.HideMyShowsSpoilers && ei.HowLong() != "Aired")
                {
                    body += "<table><tr>";
                    body += "<td width=100% valign=top>" + GetOverview(ei) + "</td><td width=300 height=225>";
                    // 300x168 / 300x225
                    if (!string.IsNullOrEmpty(ei.Filename))
                    {
                        body += "<img src=" + TheTVDB.GetImageURL(ei.Filename) + ">";
                    }

                    body += "</td></tr></table>";
                }
                else
                {
                    body += GetOverview(ei);
                }

                body += "<p><hr><p>";
            } // for each episode in this season

            return(body);
        }
Пример #23
0
        public void PopulateGrid()
        {
            Cell colTitleModel = new Cell
            {
                ElementText   = new ActorsGrid.RotatedText(-90.0f),
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = ContentAlignment.BottomCenter
            };

            Cell topleftTitleModel = new Cell
            {
                BackColor     = Color.SteelBlue,
                ForeColor     = Color.White,
                TextAlignment = ContentAlignment.BottomLeft
            };

            grid1.Columns.Clear();
            grid1.Rows.Clear();

            int maxSeason = GetMaxSeason(showList);

            int cols = maxSeason + 2;
            int rows = showList.Count + 1;

            // Draw Header
            grid1.ColumnsCount = cols;
            grid1.RowsCount    = rows;
            grid1.FixedColumns = 1;
            grid1.FixedRows    = 1;
            grid1.Selection.EnableMultiSelection = false;

            grid1.Rows[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize;
            grid1.Rows[0].Height       = 65;

            ColumnHeader h = new ColumnHeader("Show")
            {
                AutomaticSortEnabled = false,
                ResizeEnabled        = false
            };

            grid1[0, 0]      = h;
            grid1[0, 0].View = topleftTitleModel;

            // Draw season
            for (int c = chkHideSpecials.Checked?1:0; c < maxSeason + 1; c++)
            {
                h = new ColumnHeader(Season.UIFullSeasonWord(c))
                {
                    AutomaticSortEnabled = false,
                    ResizeEnabled        = false
                };

                grid1[0, c + 1]      = h;
                grid1[0, c + 1].View = colTitleModel;

                grid1.Columns[c + 1].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize;
            }

            grid1.Columns[0].Width = 150;

            // Draw Shows

            int r = 0;

            foreach (ShowSummaryData show in showList)
            {
                //Ignore shows with no missing episodes
                if (chkHideComplete.Checked && !show.HasMssingEpisodes(chkHideSpecials.Checked, chkHideIgnored.Checked))
                {
                    continue;
                }

                //Ignore shows with no missing aired episodes
                if (chkHideUnaired.Checked && !show.HasAiredMssingEpisodes(chkHideSpecials.Checked, chkHideIgnored.Checked))
                {
                    continue;
                }

                //Ignore shows which do not have the missing check
                if (chkHideNotScanned.Checked && !show.ShowItem.DoMissingCheck)
                {
                    continue;
                }

                RowHeader rh = new RowHeader(show.ShowName)
                {
                    ResizeEnabled = false,
                    View          = new Cell {
                        ForeColor = show.ShowItem.DoMissingCheck ? Color.Black : Color.Gray
                    }
                };

                //Gray if the show is not checked for missing episodes in the scan

                grid1[r + 1, 0] = rh;
                grid1[r + 1, 0].AddController(new ShowClickEvent(this, show.ShowItem));

                foreach (ShowSummaryData.ShowSummarySeasonData seasonData in show.SeasonDataList)
                {
                    ShowSummaryData.SummaryOutput output = seasonData.GetOuput();

                    //Ignore Season if checkbox is checked
                    if (chkHideSpecials.Checked && output.Special)
                    {
                        continue;
                    }

                    //Ignore Season if checkbox is checked
                    if (chkHideIgnored.Checked && output.Ignored)
                    {
                        continue;
                    }

                    grid1[r + 1, seasonData.SeasonNumber + 1] =
                        new SourceGrid.Cells.Cell(output.Details, typeof(string))
                    {
                        View = new Cell
                        {
                            BackColor     = output.Color,
                            ForeColor     = Color.White,
                            TextAlignment = ContentAlignment.BottomRight
                        },
                        Editor = { EditableMode = EditableMode.None }
                    };

                    grid1[r + 1, seasonData.SeasonNumber + 1].AddController(new ShowClickEvent(this, show.ShowItem, seasonData.Season));
                }
                r++;
            }
            grid1.AutoSizeCells();
        }
Пример #24
0
            public override void OnMouseDown(SourceGrid.CellContext sender, MouseEventArgs e)
            {
                if (e.Button != MouseButtons.Right)
                {
                    return;
                }
                this.gridSummary.showRightClickMenu.Items.Clear();

                Season seas = this.season;

                this.gridSummary.mLastFL        = new List <Alphaleonis.Win32.Filesystem.FileInfo>();
                this.gridSummary.mFoldersToOpen = new List <String>();

                this.gridSummary.mLastShowClicked   = this.show;
                this.gridSummary.mLastSeasonClicked = this.season;

                List <String> added = new List <String>();

                if (this.show != null && seas == null)
                {
                    this.GenerateMenu(this.gridSummary.showRightClickMenu, "Force Refresh", RightClickCommands.kForceRefreshSeries);
                    this.GenerateSeparator(this.gridSummary.showRightClickMenu);
                    this.GenerateMenu(this.gridSummary.showRightClickMenu, "Visit thetvdb.com", RightClickCommands.kVisitTVDBSeries);
                }

                if (this.show != null && seas != null)
                {
                    this.GenerateMenu(this.gridSummary.showRightClickMenu, "Visit thetvdb.com", RightClickCommands.kVisitTVDBSeason);
                }

                if ((seas != null) && (this.show != null) && (this.show.AllFolderLocations().ContainsKey(seas.SeasonNumber)))
                {
                    int  n     = this.gridSummary.mFoldersToOpen.Count;
                    bool first = true;
                    foreach (string folder in this.show.AllFolderLocations()[seas.SeasonNumber])
                    {
                        if ((!string.IsNullOrEmpty(folder)) && Directory.Exists(folder) && !added.Contains(folder))
                        {
                            added.Add(folder); // don't show the same folder more than once
                            if (first)
                            {
                                this.GenerateSeparator(this.gridSummary.showRightClickMenu);
                                first = false;
                            }

                            this.GenerateMenu(this.gridSummary.showRightClickMenu, "Open: " + folder, (int)RightClickCommands.kOpenFolderBase + n);
                            this.gridSummary.mFoldersToOpen.Add(folder);
                            n++;
                        }
                    }
                }
                else if (this.show != null)
                {
                    int  n     = this.gridSummary.mFoldersToOpen.Count;
                    bool first = true;

                    foreach (KeyValuePair <int, List <String> > kvp in this.show.AllFolderLocations())
                    {
                        foreach (string folder in kvp.Value)
                        {
                            if ((!string.IsNullOrEmpty(folder)) && Directory.Exists(folder) && !added.Contains(folder))
                            {
                                added.Add(folder); // don't show the same folder more than once
                                if (first)
                                {
                                    this.GenerateSeparator(this.gridSummary.showRightClickMenu);
                                    first = false;
                                }

                                this.GenerateMenu(this.gridSummary.showRightClickMenu, "Open: " + folder, (int)RightClickCommands.kOpenFolderBase + n);
                                this.gridSummary.mFoldersToOpen.Add(folder);
                                n++;
                            }
                        }
                    }
                }

                if (seas != null && this.show != null)
                {
                    // for each episode in season, find it on disk
                    bool first = true;
                    foreach (ProcessedEpisode epds in this.show.SeasonEpisodes[seas.SeasonNumber])
                    {
                        List <Alphaleonis.Win32.Filesystem.FileInfo> fl = TVDoc.FindEpOnDisk(new DirFilesCache(), epds, false);
                        if ((fl != null) && (fl.Count > 0))
                        {
                            if (first)
                            {
                                this.GenerateSeparator(this.gridSummary.showRightClickMenu);
                                first = false;
                            }

                            int n = this.gridSummary.mLastFL.Count;
                            foreach (Alphaleonis.Win32.Filesystem.FileInfo fi in fl)
                            {
                                this.GenerateMenu(this.gridSummary.showRightClickMenu, "Watch: " + fi.FullName, (int)RightClickCommands.kWatchBase + n);
                                this.gridSummary.mLastFL.Add(fi);
                                n++;
                            }
                        }
                    }
                }

                Point pt = new Point(e.X, e.Y);

                this.gridSummary.showRightClickMenu.Show(sender.Grid.PointToScreen(pt));
            }
Пример #25
0
        public AddEditShow(ShowItem si)
        {
            selectedShow = si;
            sampleSeason = si.GetFirstAvailableSeason();
            InitializeComponent();

            lblSeasonWordPreview.Text      = TVSettings.Instance.SeasonFolderFormat + "-(" + CustomSeasonName.NameFor(si.GetFirstAvailableSeason(), TVSettings.Instance.SeasonFolderFormat) + ")";
            lblSeasonWordPreview.ForeColor = Color.DarkGray;

            SetupDropDowns(si);

            codeFinderForm =
                new TheTvdbCodeFinder(si.TvdbCode != -1 ? si.TvdbCode.ToString() : "")
            {
                Dock = DockStyle.Fill
            };

            pnlCF.SuspendLayout();
            pnlCF.Controls.Add(codeFinderForm);
            pnlCF.ResumeLayout();

            cntfw = null;
            chkCustomShowName.Checked = si.UseCustomShowName;
            if (chkCustomShowName.Checked)
            {
                txtCustomShowName.Text = si.CustomShowName;
            }
            chkCustomShowName_CheckedChanged(null, null);

            chkCustomLanguage.Checked = si.UseCustomLanguage;
            if (chkCustomLanguage.Checked)
            {
                cbLanguage.Text = TheTVDB.Instance.LanguageList.GetLanguageFromCode(si.CustomLanguageCode).Name;
            }
            chkCustomLanguage_CheckedChanged(null, null);

            cbSequentialMatching.Checked = si.UseSequentialMatch;
            chkShowNextAirdate.Checked   = si.ShowNextAirdate;
            chkSpecialsCount.Checked     = si.CountSpecials;
            txtBaseFolder.Text           = si.AutoAddFolderBase;

            cbDoRenaming.Checked     = si.DoRename;
            cbDoMissingCheck.Checked = si.DoMissingCheck;
            cbDoMissingCheck_CheckedChanged(null, null);

            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:
            default:
                chkAutoFolders.Checked          = true;
                rdoFolderLibraryDefault.Checked = true;
                break;
            }

            txtSeasonFormat.Text = si.AutoAddCustomFolderFormat;

            chkDVDOrder.Checked        = si.DvdOrder;
            cbIncludeFuture.Checked    = si.ForceCheckFuture;
            cbIncludeNoAirdate.Checked = si.ForceCheckNoAirdate;

            bool first = true;

            si.IgnoreSeasons.Sort();
            foreach (int i in si.IgnoreSeasons)
            {
                if (!first)
                {
                    txtIgnoreSeasons.Text += " ";
                }
                txtIgnoreSeasons.Text += i.ToString();
                first = false;
            }

            foreach (KeyValuePair <int, List <string> > kvp in si.ManualFolderLocations)
            {
                foreach (string s in kvp.Value)
                {
                    ListViewItem lvi = new ListViewItem {
                        Text = kvp.Key.ToString()
                    };
                    lvi.SubItems.Add(s);

                    lvSeasonFolders.Items.Add(lvi);
                }
            }
            lvSeasonFolders.Sort();

            txtSeasonNumber_TextChanged(null, null);
            txtFolder_TextChanged();

            ActiveControl = codeFinderForm; // set initial focus to the code entry/show finder control

            foreach (string aliasName in selectedShow.AliasNames)
            {
                lbShowAlias.Items.Add(aliasName);
            }

            StringBuilder tl = new StringBuilder();

            foreach (string s in CustomEpisodeName.TAGS)
            {
                tl.AppendLine(s);
            }
            txtTagList.Text = tl.ToString();

            cbUseCustomSearch.Checked = si.UseCustomSearchUrl && !string.IsNullOrWhiteSpace(si.CustomSearchUrl);
            txtSearchURL.Text         = si.CustomSearchUrl ?? "";
            EnableDisableCustomSearch();
        }
Пример #26
0
 public ShowSummarySeasonData(int seasonNumber, int episodeCount, int episodeAiredCount, int episodeGotCount, Season season)
 {
     this.seasonNumber      = seasonNumber;
     this.episodeCount      = episodeCount;
     this.episodeAiredCount = episodeAiredCount;
     this.episodeGotCount   = episodeGotCount;
     this.season            = season;
 }
Пример #27
0
        public void SetDefaults(SeriesInfo ser, Season seas)
        {
            this.Items = new System.Collections.Generic.Dictionary<string, string>();
            this.TheSeason = seas;
            this.TheSeries = ser;

            this.Overview = "";
            this.EpisodeRating = "";  
            this.EpisodeGuestStars = "";   
            this.EpisodeDirector = ""; 
            this.Writer = ""; 
            this.Name = "";
            this.EpisodeID = -1;
            this.SeriesID = -1;
            this.EpNum = -1;
            this.FirstAired = null;
            this.Srv_LastUpdated = -1;
            this.Dirty = false;
        }
Пример #28
0
 public ActionDateTouch(DirectoryInfo dir, Season sn, DateTime date)
 {
     season         = sn;
     whereDirectory = dir;
     updateTime     = date;
 }
Пример #29
0
 public Episode(SeriesInfo ser, Season seas)
 {
     this.SetDefaults(ser, seas);
 }
Пример #30
0
 public void AddSeason(Season generateSeason)
 {
     seasons.Add(generateSeason);
 }
Пример #31
0
 public void SetSeriesSeason(SeriesInfo ser, Season seas)
 {
     this.TheSeason = seas;
     this.TheSeries = ser;
 }
Пример #32
0
 public Episode(SeriesInfo ser, Season seas)
 {
     this.SetDefaults(ser, seas);
 }
Пример #33
0
 public void SetSeriesSeason(SeriesInfo ser, Season seas)
 {
     this.TheSeason = seas;
     this.TheSeries = ser;
 }
Пример #34
0
        public Episode(SeriesInfo ser, Season seas, XmlReader r, CommandLineArgs args)
        {
            // <Episode>
            //  <id>...</id>
            //  blah blah
            // </Episode>

            try
            {
                this.SetDefaults(ser, seas);

                r.Read();
                if (r.Name != "Episode")
                {
                    return;
                }

                r.Read();
                while (!r.EOF)
                {
                    if ((r.Name == "Episode") && (!r.IsStartElement()))
                    {
                        break;
                    }
                    if (r.Name == "id")
                    {
                        this.EpisodeID = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "seriesid")
                    {
                        this.SeriesID = r.ReadElementContentAsInt(); // thetvdb series id
                    }
                    else if (r.Name == "seasonid")
                    {
                        this.SeasonID = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "EpisodeNumber")
                    {
                        this.EpNum = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "SeasonNumber")
                    {
                        String sn = r.ReadElementContentAsString();
                        int.TryParse(sn, out this.ReadSeasonNum);
                    }
                    else if (r.Name == "lastupdated")
                    {
                        this.Srv_LastUpdated = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "Overview")
                    {
                        this.Overview = Helpers.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "Rating")
                    {
                        this.EpisodeRating = Helpers.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "GuestStars")
                    {
                        this.EpisodeGuestStars = Helpers.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "Director")
                    {
                        this.EpisodeDirector = Helpers.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "Writer")
                    {
                        this.Writer = Helpers.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "EpisodeName")
                    {
                        this.Name = Helpers.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "FirstAired")
                    {
                        try
                        {
                            this.FirstAired = DateTime.ParseExact(r.ReadElementContentAsString(), "yyyy-MM-dd", new System.Globalization.CultureInfo(""));
                        }
                        catch
                        {
                            this.FirstAired = null;
                        }
                    }
                    else
                    {
                        if ((r.IsEmptyElement) || !r.IsStartElement())
                        {
                            r.ReadOuterXml();
                        }
                        else
                        {
                            XmlReader r2 = r.ReadSubtree();
                            r2.Read();
                            string name = r2.Name;
                            this.Items[name] = r2.ReadElementContentAsString();
                            r.Read();
                        }
                    }
                }
            }
            catch (XmlException e)
            {
                string message = "Error processing data from TheTVDB for an episode.";
                if (this.SeriesID != -1)
                {
                    message += "\r\nSeries ID: " + this.SeriesID;
                }
                if (this.EpisodeID != -1)
                {
                    message += "\r\nEpisode ID: " + this.EpisodeID;
                }
                if (this.EpNum != -1)
                {
                    message += "\r\nEpisode Number: " + this.EpNum;
                }
                if (!string.IsNullOrEmpty(this.Name))
                {
                    message += "\r\nName: " + this.Name;
                }

                message += "\r\n" + e.Message;

                if (!args.Unattended)
                {
                    MessageBox.Show(message, "TVRename", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                throw new TVDBException(e.Message);
            }
        }
Пример #35
0
 public Banner(SeriesInfo ser, Season seas)
 {
     this.SetDefaults(ser, seas);
 }
Пример #36
0
 public ActionDateTouch(DirectoryInfo dir, Season sn, DateTime date)
 {
     this.SN             = sn;
     this.WhereDirectory = dir;
     this.updateTime     = date;
 }
Пример #37
0
 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);
 }
Пример #38
0
        public Episode(SeriesInfo ser, Season seas, Season dvdseas, XmlReader r, CommandLineArgs args)
        {
            // <Episode>
            //  <id>...</id>
            //  blah blah
            // </Episode>

            try
            {
                SetDefaults(ser, seas, dvdseas);

                r.Read();
                if (r.Name != "Episode")
                {
                    return;
                }

                r.Read();
                while (!r.EOF)
                {
                    if ((r.Name == "Episode") && (!r.IsStartElement()))
                    {
                        break;
                    }
                    if (r.Name == "id")
                    {
                        this.EpisodeID = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "seriesid")
                    {
                        this.SeriesID = r.ReadElementContentAsInt(); // thetvdb series id
                    }
                    else if (r.Name == "seasonid")
                    {
                        this.SeasonID = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "EpisodeNumber")
                    {
                        this.AiredEpNum = r.ReadElementContentAsInt();
                    }
                    else if (r.Name == "dvdEpisodeNumber")
                    {
                        string den = r.ReadElementContentAsString();
                        int.TryParse(den, out this.DVDEpNum);
                    }
                    else if (r.Name == "SeasonNumber")
                    {
                        string sn = r.ReadElementContentAsString();
                        int.TryParse(sn, out this.ReadAiredSeasonNum);
                    }
                    else if (r.Name == "dvdSeason")
                    {
                        string dsn = r.ReadElementContentAsString();
                        int.TryParse(dsn, out this.ReadDVDSeasonNum);
                    }
                    else if (r.Name == "lastupdated")
                    {
                        this.Srv_LastUpdated = r.ReadElementContentAsLong();
                    }
                    else if (r.Name == "Overview")
                    {
                        this.Overview = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "Rating")
                    {
                        this.EpisodeRating = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "GuestStars")
                    {
                        this.EpisodeGuestStars = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "EpisodeDirector")
                    {
                        this.EpisodeDirector = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "Writer")
                    {
                        this.Writer = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "EpisodeName")
                    {
                        this.Name = XMLHelper.ReadStringFixQuotesAndSpaces(r);
                    }
                    else if (r.Name == "FirstAired")
                    {
                        try
                        {
                            String contents = r.ReadElementContentAsString();
                            if (contents == "")
                            {
                                logger.Info("Please confirm, but we are assuming that " + this.Name + "(episode Id =" + this.EpisodeID + ") has no airdate");
                                this.FirstAired = null;
                            }
                            else
                            {
                                this.FirstAired = DateTime.ParseExact(contents, "yyyy-MM-dd", new System.Globalization.CultureInfo(""));
                            }
                        }
                        catch
                        {
                            this.FirstAired = null;
                        }
                    }
                    else
                    {
                        if ((r.IsEmptyElement) || !r.IsStartElement())
                        {
                            r.ReadOuterXml();
                        }
                        else
                        {
                            XmlReader r2 = r.ReadSubtree();
                            r2.Read();
                            string name = r2.Name;
                            this.Items[name] = r2.ReadElementContentAsString();
                            r.Read();
                        }
                    }
                }
            }
            catch (XmlException e)
            {
                string message = "Error processing data from TheTVDB for an episode.";
                if (this.SeriesID != -1)
                {
                    message += "\r\nSeries ID: " + this.SeriesID;
                }
                if (this.EpisodeID != -1)
                {
                    message += "\r\nEpisode ID: " + this.EpisodeID;
                }
                if (this.DVDEpNum != -1)
                {
                    message += "\r\nEpisode (DVD) Number: " + this.DVDEpNum;
                }
                if (this.AiredEpNum != -1)
                {
                    message += "\r\nEpisode Aired Number: " + this.AiredEpNum;
                }
                if (!string.IsNullOrEmpty(this.Name))
                {
                    message += "\r\nName: " + this.Name;
                }


                logger.Error(e, message);

                throw new TheTVDB.TVDBException(e.Message);
            }
        }
Пример #39
0
        public void WTWRightClickOnShow(List<ProcessedEpisode> eps, Point pt)
        {
            if (eps.Count == 0)
                return;
            ProcessedEpisode ep = eps[0];

            List<ShowItem> sis = new List<ShowItem>();
            foreach (var e in eps)
            {
                sis.Add(e.SI);
            }

            this.mLastEpClicked = ep;
            this.mLastShowsClicked = sis;
            this.mLastSeasonClicked = ep != null ? ep.TheSeason : null;
            this.mLastActionsClicked = null;
            this.BuildRightClickMenu(pt);
        }
Пример #40
0
 public Episode(SeriesInfo ser, Season airSeason, Season dvdSeason)
 {
     SetDefaults(ser, airSeason, dvdSeason);
 }
Пример #41
0
        private void lvAction_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            UpdateSearchButton();

            LVResults lvr = new LVResults(this.lvAction, false);

            if (lvr.Count == 0)
            {
                // disable everything
                this.bnActionBTSearch.Enabled = false;
                return;
            }

            this.bnActionBTSearch.Enabled = lvr.Download.Count <= 0;

            this.mLastShowsClicked = null;
            this.mLastEpClicked = null;
            this.mLastSeasonClicked = null;
            this.mLastActionsClicked = null;

            this.showRightClickMenu.Items.Clear();
            this.mFoldersToOpen = new List<String>();
            this.mLastFL = new System.Collections.Generic.List<System.IO.FileInfo>();

            this.mLastActionsClicked = new ItemList();

            foreach (Item ai in lvr.FlatList)
                this.mLastActionsClicked.Add(ai);

            if ((lvr.Count == 1) && (this.lvAction.FocusedItem != null) && (this.lvAction.FocusedItem.Tag != null))
            {
                ScanListItem action = this.lvAction.FocusedItem.Tag as ScanListItem;
                if (action != null)
                {
                    this.mLastEpClicked = action.Episode;
                    if (action.Episode != null)
                    {
                        this.mLastSeasonClicked = action.Episode.TheSeason;
                        this.mLastShowsClicked = new List<ShowItem>() { action.Episode.SI };
                    }
                    else
                    {
                        this.mLastSeasonClicked = null;
                        this.mLastShowsClicked = null;
                    }

                    if ((this.mLastEpClicked != null) && (this.mDoc.Settings.AutoSelectShowInMyShows))
                        this.GotoEpguideFor(this.mLastEpClicked, false);
                }
            }
        }
Пример #42
0
 public ShowClickEvent(ShowSummary gridSummary, ShowItem show, Season season)
 {
     this.show        = show;
     this.season      = season;
     this.gridSummary = gridSummary;
 }
Пример #43
0
        public void TVDBFor(Season seas)
        {
            if (seas == null)
                return;

            TVDoc.SysOpen(this.mDoc.GetTVDB(false, "").WebsiteURL(seas.TheSeries.TVDBCode, -1, false));
        }
Пример #44
0
        public static List <ProcessedEpisode> GenerateEpisodes(ShowItem si, SeriesInfo ser, int snum, bool applyRules)
        {
            List <ProcessedEpisode> eis = new List <ProcessedEpisode>();

            if (ser == null)
            {
                return(null);
            }

            Dictionary <int, Season> seasonsToUse = si.DVDOrder ? ser.DVDSeasons : ser.AiredSeasons;

            if (!seasonsToUse.ContainsKey(snum))
            {
                return(null); // todo.. something?
            }
            Season seas = seasonsToUse[snum];

            if (seas == null)
            {
                return(null); // TODO: warn user
            }
            foreach (Episode e in seas.Episodes)
            {
                eis.Add(new ProcessedEpisode(e, si)); // add a copy
            }
            if (si.DVDOrder)
            {
                eis.Sort(new System.Comparison <ProcessedEpisode>(ProcessedEpisode.DVDOrderSorter));
                Renumber(eis);
            }
            else
            {
                eis.Sort(new System.Comparison <ProcessedEpisode>(ProcessedEpisode.EPNumberSorter));
            }

            if (si.CountSpecials && seasonsToUse.ContainsKey(0))
            {
                // merge specials in
                foreach (Episode ep in seasonsToUse[0].Episodes)
                {
                    string seasstr = ep.AirsBeforeSeason;
                    string epstr   = ep.AirsBeforeEpisode;
                    if ((string.IsNullOrEmpty(seasstr)) || (string.IsNullOrEmpty(epstr)))
                    {
                        continue;
                    }
                    int sease = int.Parse(seasstr);
                    if (sease != snum)
                    {
                        continue;
                    }
                    int epnum = int.Parse(epstr);
                    for (int i = 0; i < eis.Count; i++)
                    {
                        if ((eis[i].AppropriateSeasonNumber == sease) && (eis[i].AppropriateEpNum == epnum))
                        {
                            ProcessedEpisode pe = new ProcessedEpisode(ep, si)
                            {
                                TheAiredSeason = eis[i].TheAiredSeason,
                                TheDVDSeason   = eis[i].TheDVDSeason,
                                SeasonID       = eis[i].SeasonID
                            };
                            eis.Insert(i, pe);
                            break;
                        }
                    }
                }
                // renumber to allow for specials
                int epnumr = 1;
                foreach (ProcessedEpisode t in eis)
                {
                    t.EpNum2           = epnumr + (t.EpNum2 - t.AppropriateEpNum);
                    t.AppropriateEpNum = epnumr;
                    epnumr++;
                }
            }

            if (applyRules)
            {
                List <ShowRule> rules = si.RulesForSeason(snum);
                if (rules != null)
                {
                    ApplyRules(eis, rules, si);
                }
            }

            return(eis);
        }