Ejemplo n.º 1
0
        private void DoPosterLoad(object _param)
        {
            TvdbPosterBanner banner = (TvdbPosterBanner)_param;

            int index = m_index;

            if (!banner.IsLoaded)
            {
                SetImageThreadSafe(null);
                SetLoadingVisibleThreadSafe(true);
                banner.LoadBanner();
            }

            if (banner.IsLoaded && index == m_index)
            {//the current index is still (event after downloading the image) the images' index
                SetLoadingVisibleThreadSafe(false);
                SetImageThreadSafe(CreatePosterBitmap(banner.Banner));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create the series banner content
        /// </summary>
        /// <param name="bannerList">List of banners to store</param>
        /// <returns>xml content</returns>
        internal String CreateSeriesBannerContent(List <TvdbBanner> bannerList)
        {
            XElement xml = new XElement("Banners");

            foreach (TvdbBanner b in bannerList)
            {
                XElement banner = new XElement("Banner");
                banner.Add(new XElement("id", b.Id));
                banner.Add(new XElement("BannerPath", b.BannerPath));
                banner.Add(new XElement("LastUpdated", Util.DotNetToUnix(b.LastUpdated)));
                if (b.GetType() == typeof(TvdbSeriesBanner))
                {
                    TvdbSeriesBanner sb = (TvdbSeriesBanner)b;
                    banner.Add(new XElement("BannerType", "series"));
                    banner.Add(new XElement("BannerType2", sb.BannerType));
                    banner.Add(new XElement("Language", (sb.Language != null ? sb.Language.Abbriviation : "")));
                }
                else if (b.GetType() == typeof(TvdbFanartBanner))
                {
                    TvdbFanartBanner fb = (TvdbFanartBanner)b;
                    banner.Add(new XElement("BannerType", "fanart"));
                    banner.Add(new XElement("BannerType2", fb.Resolution.X + "x" + fb.Resolution.Y));
                    if (fb.Colors != null && fb.Colors.Count == 0)
                    {
                        StringBuilder colorString = new StringBuilder();
                        colorString.Append("|");
                        foreach (Color c in fb.Colors)
                        {
                            colorString.Append(c.R);
                            colorString.Append(",");
                            colorString.Append(c.G);
                            colorString.Append(",");
                            colorString.Append(c.B);
                            colorString.Append("|");
                        }
                        banner.Add(new XElement("Colors", colorString.ToString()));
                    }
                    else
                    {
                        banner.Add(new XElement("Colors", ""));
                    }
                    banner.Add(new XElement("VignettePath", fb.VignettePath));
                    banner.Add(new XElement("ThumbnailPath", fb.ThumbPath));
                    banner.Add(new XElement("Language", (fb.Language != null ? fb.Language.Abbriviation : "")));
                    banner.Add(new XElement("SeriesName", fb.ContainsSeriesName.ToString()));
                }
                else if (b.GetType() == typeof(TvdbSeasonBanner))
                {
                    TvdbSeasonBanner sb = (TvdbSeasonBanner)b;
                    banner.Add(new XElement("BannerType", "Season"));
                    banner.Add(new XElement("BannerType2", sb.BannerType));
                    banner.Add(new XElement("Language", (sb.Language != null ? sb.Language.Abbriviation : "")));
                    banner.Add(new XElement("Season", sb.Season));
                }
                else if (b.GetType() == typeof(TvdbPosterBanner))
                {
                    TvdbPosterBanner pb = (TvdbPosterBanner)b;
                    banner.Add(new XElement("BannerType", "Poster"));
                    banner.Add(new XElement("BannerType2", pb.Resolution.X + "x" + pb.Resolution.Y));
                    banner.Add(new XElement("Language", (pb.Language != null ? pb.Language.Abbriviation : "")));
                }
                else
                {
                    //this shouldn't happen, it's an invalid banner type (maybe new?) -> don't store it
                    continue;
                }
                xml.Add(banner);
            }

            return(xml.ToString());
        }
Ejemplo n.º 3
0
 private void SetPosterImage(TvdbPosterBanner _value)
 {
     new Thread(new ParameterizedThreadStart(DoPosterLoad)).Start(_value);
 }