Exemple #1
0
        private void BuildData()
        {
            // find actors that have been in more than one thing
            // Dictionary<String^, List<String> ^> ^whoInWhat = gcnew Dictionary<String^, List<String> ^>;
            TheTVDB.Instance.GetLock("Actors");
            theData = new DataArr(mDoc.Library.Count);
            foreach (ShowItem ser in mDoc.Library.Shows)
            {
                SeriesInfo si = TheTVDB.Instance.GetSeries(ser.TvdbCode);
                foreach (Actor act in si.GetActors())
                {
                    string aa = act.ActorName.Trim();
                    if (!string.IsNullOrEmpty(aa))
                    {
                        theData.Set(si.Name, aa, true);
                    }
                }

                if (cbGuestStars.Checked)
                {
                    foreach (KeyValuePair <int, Season> kvp in si.AiredSeasons) //We can use AiredSeasons as it does not matter which order we do this in Aired or DVD
                    {
                        foreach (Episode ep in kvp.Value.Episodes.Values)
                        {
                            foreach (string g in ep.GuestStars)
                            {
                                string aa = g.Trim();
                                if (!string.IsNullOrEmpty(aa))
                                {
                                    theData.Set(si.Name, aa, false);
                                }
                            }
                        }
                    }
                }
            }

            TheTVDB.Instance.Unlock("Actors");
            theData.RemoveEmpties();
        }
Exemple #2
0
        private void BuildData()
        {
            // find actors that have been in more than one thing
            // Dictionary<String^, List<String> ^> ^whoInWhat = gcnew Dictionary<String^, List<String> ^>;
            TheTVDB.Instance.GetLock("Actors");
            this.TheData = new DataArr(TheTVDB.Instance.GetSeriesDict().Count);
            foreach (System.Collections.Generic.KeyValuePair <int, SeriesInfo> ser in TheTVDB.Instance.GetSeriesDict())
            {
                SeriesInfo si = ser.Value;
                foreach (string act in si.GetActors())
                {
                    string aa = act.Trim();
                    if (!string.IsNullOrEmpty(aa))
                    {
                        this.TheData.Set(si.Name, aa, true);
                    }
                }

                if (this.cbGuestStars.Checked)
                {
                    foreach (System.Collections.Generic.KeyValuePair <int, Season> kvp in si.Seasons)
                    {
                        foreach (Episode ep in kvp.Value.Episodes)
                        {
                            foreach (string g in ep.GetGuestStars())
                            {
                                string aa = g.Trim();
                                if (!string.IsNullOrEmpty(aa))
                                {
                                    this.TheData.Set(si.Name, aa, false);
                                }
                            }
                        }
                    }
                }
            }

            TheTVDB.Instance.Unlock("Actors");
            this.TheData.RemoveEmpties();
        }
Exemple #3
0
        private static void AppendShow(this StringBuilder sb, [CanBeNull] ShowItem si, Color backgroundColour, bool includeDirectoryLinks)
        {
            SeriesInfo ser = si?.TheSeries();

            if (ser is null)
            {
                return;
            }
            string horizontalBanner = CreateHorizontalBannerHtml(ser);
            string poster           = CreatePosterHtml(ser);
            string yearRange        = YearRange(ser);
            string episodeSummary   = ser.AiredSeasons.Sum(pair => pair.Value.Episodes.Count).ToString();
            string stars            = StarRating(ser.SiteRating / 2);
            string genreIcons       = string.Join("&nbsp;", ser.Genres().Select(GenreIconHtml));
            string siteRating       = ser.SiteRating > 0 ? ser.SiteRating + "/10" : "";
            string runTimeHtml      = string.IsNullOrWhiteSpace(ser.Runtime) ? string.Empty : $"<br/> {ser.Runtime} min";
            string actorLinks       = string.Join(", ", ser.GetActors().Select(ActorLinkHtml));
            string tvdbLink         = TheTVDB.Instance.WebsiteUrl(si.TvdbCode, -1, true);
            string airsTime         = ParseAirsTime(ser);
            string airsDay          = ser.AirsDay;
            string dayTime          = $"{airsDay} {airsTime}";

            string tvLink   = string.IsNullOrWhiteSpace(ser.SeriesId) ? string.Empty : "http://www.tv.com/show/" + ser.SeriesId + "/summary.html";
            string imdbLink = string.IsNullOrWhiteSpace(ser.Imdb) ? string.Empty : "http://www.imdb.com/title/" + ser.Imdb;

            string urlFilename = includeDirectoryLinks
                ? Uri.EscapeDataString(si.GetBestFolderLocationToOpen())
                : string.Empty;
            string explorerButton = includeDirectoryLinks
                ? CreateButton($"{UI.EXPLORE_PROXY}{urlFilename}", "<i class=\"far fa-folder-open\"></i>", "Open Containing Folder")
                : string.Empty;

            sb.AppendLine($@"<div class=""card card-body"" style=""background-color:{backgroundColour.HexColour()}"">
                <div class=""text-center"">
	             {horizontalBanner}
                </div>
                  <div class=""row"">
                   <div class=""col-md-4"">
                    {poster}
                   </div>
                   <div class=""col-md-8 d-flex flex-column"">
                    <div class=""row"">
                     <div class=""col-md-8""><h1>{ser.Name}</h1></div>
                     <div class=""col-md-4 text-right""><h6>{yearRange} ({ser.Status})</h6><small class=""text-muted"">{episodeSummary} Episodes{runTimeHtml}</small></div>
                    </div>
                    <div><p class=""lead"">{ser.Overview}</p></div>
			        <div><blockquote>{actorLinks}</blockquote></div> 
		            <div>
                     {explorerButton}
			         {CreateButton(tvdbLink, "TVDB.com", "View on TVDB")}
			         {CreateButton(imdbLink, "IMDB.com", "View on IMDB")}
			         {CreateButton(tvLink, "TV.com", "View on TV.com")}
			        </div>
		            <div>
                        &nbsp;
			        </div>
		            <div class=""row align-items-bottom"">
                     <div class=""col-md-4 align-self-end"">{stars}<br>{siteRating}{AddRatingCount(ser.SiteRatingVotes)}</div>
                     <div class=""col-md-4 align-self-end text-center"">{ser.ContentRating}<br>{ser.Network}, {dayTime}</div>
                     <div class=""col-md-4 align-self-end text-right"">{genreIcons}<br>{string.Join(", ", ser.Genres())}</div>
                    </div>
                   </div>
                  </div>
                 </div>");
            //Ideally we'd have <div class=""row align-items-bottom flex-grow-1""> in there as it looks better, but a bug in IE prevents it from looking correct
        }