Beispiel #1
0
        public AniDB_Anime_DefaultImageVM(JMMServerBinary.Contract_AniDB_Anime_DefaultImage contract)
        {
            this.AniDB_Anime_DefaultImageID = contract.AniDB_Anime_DefaultImageID;
            this.AnimeID         = contract.AnimeID;
            this.ImageParentID   = contract.ImageParentID;
            this.ImageParentType = contract.ImageParentType;
            this.ImageType       = contract.ImageType;

            MoviePoster  = null;
            MovieFanart  = null;
            TVPoster     = null;
            TVFanart     = null;
            TVWideBanner = null;
            TraktPoster  = null;
            TraktFanart  = null;

            if (contract.MovieFanart != null)
            {
                MovieFanart = new MovieDB_FanartVM(contract.MovieFanart);
            }

            if (contract.MoviePoster != null)
            {
                MoviePoster = new MovieDB_PosterVM(contract.MoviePoster);
            }

            if (contract.TVPoster != null)
            {
                TVPoster = new TvDB_ImagePosterVM(contract.TVPoster);
            }

            if (contract.TVFanart != null)
            {
                TVFanart = new TvDB_ImageFanartVM(contract.TVFanart);
            }

            if (contract.TVWideBanner != null)
            {
                TVWideBanner = new TvDB_ImageWideBannerVM(contract.TVWideBanner);
            }

            if (contract.TraktPoster != null)
            {
                TraktPoster = new Trakt_ImagePosterVM(contract.TraktPoster);
            }

            if (contract.TraktFanart != null)
            {
                TraktFanart = new Trakt_ImageFanartVM(contract.TraktFanart);
            }
        }
Beispiel #2
0
        public static void EnableDisableWideBanner(bool enabled, TvDB_ImageWideBannerVM banner, int animeID)
        {
            try
            {
                if (!enabled && banner.IsImageDefault)
                {
                    SetDefaultWideBanner(false, banner, animeID);
                }

                JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, banner.TvDB_ImageWideBannerID, (int)ImageEntityType.TvDB_Banner);
                banner.Enabled = enabled ? 1 : 0;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
Beispiel #3
0
        public static void SetDefaultWideBanner(bool isDefault, TvDB_ImageWideBannerVM banner, int animeID)
        {
            if (!JMMServerVM.Instance.ServerOnline)
            {
                return;
            }

            try
            {
                JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                                                                      banner.TvDB_ImageWideBannerID, (int)ImageEntityType.TvDB_Banner, (int)ImageSizeType.WideBanner);
                banner.IsImageDefault = isDefault;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
        public AniDB_Anime_DefaultImageVM(JMMServerBinary.Contract_AniDB_Anime_DefaultImage contract)
        {
            this.AniDB_Anime_DefaultImageID = contract.AniDB_Anime_DefaultImageID;
            this.AnimeID = contract.AnimeID;
            this.ImageParentID = contract.ImageParentID;
            this.ImageParentType = contract.ImageParentType;
            this.ImageType = contract.ImageType;

            MoviePoster = null;
            MovieFanart = null;
            TVPoster = null;
            TVFanart = null;
            TVWideBanner = null;
            TraktPoster = null;
            TraktFanart = null;

            if (contract.MovieFanart != null)
                MovieFanart = new MovieDB_FanartVM(contract.MovieFanart);

            if (contract.MoviePoster != null)
                MoviePoster = new MovieDB_PosterVM(contract.MoviePoster);

            if (contract.TVPoster != null)
                TVPoster = new TvDB_ImagePosterVM(contract.TVPoster);

            if (contract.TVFanart != null)
                TVFanart = new TvDB_ImageFanartVM(contract.TVFanart);

            if (contract.TVWideBanner != null)
                TVWideBanner = new TvDB_ImageWideBannerVM(contract.TVWideBanner);

            if (contract.TraktPoster != null)
                TraktPoster = new Trakt_ImagePosterVM(contract.TraktPoster);

            if (contract.TraktFanart != null)
                TraktFanart = new Trakt_ImageFanartVM(contract.TraktFanart);
        }
Beispiel #5
0
        private void SetWideBannerProperties(TvDB_ImageWideBannerVM banner)
        {
            string source = "The TV DB";

            string isDisabled = "No";
            isDisabled = banner.Enabled == 0 ? "Yes" : "No";

            string isDefault = "No";
            if (banner.IsImageDefault) isDefault = "Yes";

            MainWindow.setGUIProperty("WideBanners.SelectedSource", source);
            MainWindow.setGUIProperty("WideBanners.SelectedBannerIsDefault", isDefault);
            MainWindow.setGUIProperty("WideBanners.SelectedBannerIsDisabled", isDisabled);
        }
Beispiel #6
0
        public static void SetDefaultWideBanner(bool isDefault, TvDB_ImageWideBannerVM banner, int animeID)
        {
            if (!JMMServerVM.Instance.ServerOnline) return;

            try
            {

                JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                                banner.TvDB_ImageWideBannerID, (int)ImageEntityType.TvDB_Banner, (int)ImageSizeType.WideBanner);
                banner.IsImageDefault = isDefault;

            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
Beispiel #7
0
        public static void EnableDisableWideBanner(bool enabled, TvDB_ImageWideBannerVM banner, int animeID)
        {
            try
            {
                if (!enabled && banner.IsImageDefault)
                    SetDefaultWideBanner(false, banner, animeID);

                JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, banner.TvDB_ImageWideBannerID, (int)ImageEntityType.TvDB_Banner);
                banner.Enabled = enabled ? 1 : 0;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
Beispiel #8
0
        public void DownloadTvDBWideBanner(TvDB_ImageWideBannerVM wideBanner, bool forceDownload)
        {
            if (string.IsNullOrEmpty(wideBanner.BannerPath)) return;

            try
            {
                string url = string.Format(Constants.URLS.TvDB_Images, wideBanner.BannerPath);
                string filename = wideBanner.FullImagePath;

                ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.TvDB_Banner, wideBanner, forceDownload);

                // check if this file has already been downloaded and exists
                if (!req.ForceDownload)
                {
                    // check to make sure the file actually exists
                    if (!File.Exists(wideBanner.FullImagePath))
                    {
                        this.imagesToDownload.Add(req);
                        OnQueueUpdateEvent(new QueueUpdateEventArgs(this.QueueCount));
                        return;
                    }

                    // the file exists so don't download it again
                    return;
                }

                this.imagesToDownload.Add(req);
                OnQueueUpdateEvent(new QueueUpdateEventArgs(this.QueueCount));
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
        }
        public void Populate(JMMServerBinary.Contract_AniDB_AnimeCrossRefs details)
        {
            AnimeID = details.AnimeID;

            AniDB_AnimeVM anime = JMMServerHelper.GetAnime(AnimeID);

            if (anime == null)
            {
                return;
            }



            // Trakt
            if (details.CrossRef_AniDB_Trakt != null)
            {
                CrossRef_AniDB_Trakt = new CrossRef_AniDB_TraktVM(details.CrossRef_AniDB_Trakt);
            }

            if (details.TraktShow != null)
            {
                TraktShow = new Trakt_ShowVM(details.TraktShow);
            }

            if (details.TraktImageFanart != null)
            {
                TraktImageFanart = new Trakt_ImageFanartVM(details.TraktImageFanart);

                bool isDefault = false;
                if (anime != null && anime.DefaultFanart != null && anime.DefaultFanart.ImageParentType == (int)ImageEntityType.Trakt_Fanart &&
                    anime.DefaultFanart.ImageParentID == TraktImageFanart.Trakt_ImageFanartID)
                {
                    isDefault = true;
                }

                TraktImageFanart.IsImageDefault = isDefault;

                AllFanarts.Add(new FanartContainer(ImageEntityType.Trakt_Fanart, TraktImageFanart));
            }

            if (details.TraktImagePoster != null)
            {
                TraktImagePoster = new Trakt_ImagePosterVM(details.TraktImagePoster);

                bool isDefault = false;
                if (anime != null && anime.DefaultPoster != null && anime.DefaultPoster.ImageParentType == (int)ImageEntityType.Trakt_Poster &&
                    anime.DefaultPoster.ImageParentID == TraktImagePoster.Trakt_ImagePosterID)
                {
                    isDefault = true;
                }

                TraktImagePoster.IsImageDefault = isDefault;

                AllPosters.Add(new PosterContainer(ImageEntityType.Trakt_Poster, TraktImagePoster));
            }

            if (CrossRef_AniDB_Trakt == null || TraktShow == null)
            {
                TraktCrossRefExists = false;
            }
            else
            {
                TraktCrossRefExists = true;
            }

            // TvDB
            if (details.CrossRef_AniDB_TvDB != null)
            {
                CrossRef_AniDB_TvDB = new List <CrossRef_AniDB_TvDBVMV2>();
                foreach (JMMServerBinary.Contract_CrossRef_AniDB_TvDBV2 contract in details.CrossRef_AniDB_TvDB)
                {
                    CrossRef_AniDB_TvDBVMV2 xref = new CrossRef_AniDB_TvDBVMV2(contract);
                    CrossRef_AniDB_TvDB.Add(xref);
                }
            }

            if (details.TvDBSeries != null)
            {
                TvDBSeries = new List <TvDB_SeriesVM>();
                foreach (JMMServerBinary.Contract_TvDB_Series contract in details.TvDBSeries)
                {
                    TvDB_SeriesVM tv = new TvDB_SeriesVM(contract);
                    TvDBSeries.Add(tv);
                }
            }

            foreach (JMMServerBinary.Contract_TvDB_Episode contract in details.TvDBEpisodes)
            {
                TvDBEpisodes.Add(new TvDB_EpisodeVM(contract));
            }

            foreach (JMMServerBinary.Contract_TvDB_ImageFanart contract in details.TvDBImageFanarts)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultFanart != null && anime.DefaultFanart.ImageParentType == (int)ImageEntityType.TvDB_FanArt &&
                    anime.DefaultFanart.ImageParentID == contract.TvDB_ImageFanartID)
                {
                    isDefault = true;
                }

                TvDB_ImageFanartVM tvFanart = new TvDB_ImageFanartVM(contract);
                tvFanart.IsImageDefault = isDefault;
                TvDBImageFanarts.Add(tvFanart);

                AllFanarts.Add(new FanartContainer(ImageEntityType.TvDB_FanArt, tvFanart));
            }

            foreach (JMMServerBinary.Contract_TvDB_ImagePoster contract in details.TvDBImagePosters)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultPoster != null && anime.DefaultPoster.ImageParentType == (int)ImageEntityType.TvDB_Cover &&
                    anime.DefaultPoster.ImageParentID == contract.TvDB_ImagePosterID)
                {
                    isDefault = true;
                }

                TvDB_ImagePosterVM tvPoster = new TvDB_ImagePosterVM(contract);
                tvPoster.IsImageDefault = isDefault;
                TvDBImagePosters.Add(tvPoster);
                AllPosters.Add(new PosterContainer(ImageEntityType.TvDB_Cover, tvPoster));
            }

            foreach (JMMServerBinary.Contract_TvDB_ImageWideBanner contract in details.TvDBImageWideBanners)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultWideBanner != null && anime.DefaultWideBanner.ImageParentType == (int)ImageEntityType.TvDB_Banner &&
                    anime.DefaultWideBanner.ImageParentID == contract.TvDB_ImageWideBannerID)
                {
                    isDefault = true;
                }

                TvDB_ImageWideBannerVM tvBanner = new TvDB_ImageWideBannerVM(contract);
                tvBanner.IsImageDefault = isDefault;
                TvDBImageWideBanners.Add(tvBanner);
            }

            if ((CrossRef_AniDB_TvDB == null || CrossRef_AniDB_TvDB.Count == 0) ||
                (TvDBSeries == null || TvDBSeries.Count == 0))
            {
                TvDBCrossRefExists = false;
            }
            else
            {
                TvDBCrossRefExists = true;
            }

            // MovieDB
            if (details.CrossRef_AniDB_MovieDB != null)
            {
                CrossRef_AniDB_MovieDB = new CrossRef_AniDB_OtherVM(details.CrossRef_AniDB_MovieDB);
            }

            if (details.MovieDBMovie != null)
            {
                MovieDB_Movie = new MovieDB_MovieVM(details.MovieDBMovie);
            }

            foreach (JMMServerBinary.Contract_MovieDB_Fanart contract in details.MovieDBFanarts)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultFanart != null && anime.DefaultFanart.ImageParentType == (int)ImageEntityType.MovieDB_FanArt &&
                    anime.DefaultFanart.ImageParentID == contract.MovieDB_FanartID)
                {
                    isDefault = true;
                }

                MovieDB_FanartVM movieFanart = new MovieDB_FanartVM(contract);
                movieFanart.IsImageDefault = isDefault;
                MovieDBFanarts.Add(movieFanart);
                AllFanarts.Add(new FanartContainer(ImageEntityType.MovieDB_FanArt, movieFanart));
            }

            foreach (JMMServerBinary.Contract_MovieDB_Poster contract in details.MovieDBPosters)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultPoster != null && anime.DefaultPoster.ImageParentType == (int)ImageEntityType.MovieDB_Poster &&
                    anime.DefaultPoster.ImageParentID == contract.MovieDB_PosterID)
                {
                    isDefault = true;
                }

                MovieDB_PosterVM moviePoster = new MovieDB_PosterVM(contract);
                moviePoster.IsImageDefault = isDefault;
                MovieDBPosters.Add(moviePoster);
                AllPosters.Add(new PosterContainer(ImageEntityType.MovieDB_Poster, moviePoster));
            }

            if (CrossRef_AniDB_MovieDB == null || MovieDB_Movie == null)
            {
                MovieDBCrossRefExists = false;
            }
            else
            {
                MovieDBCrossRefExists = true;
            }
        }
Beispiel #10
0
        public void Populate(JMMServerBinary.Contract_AniDB_AnimeCrossRefs details)
        {
            AnimeID = details.AnimeID;

            AniDB_AnimeVM anime = JMMServerHelper.GetAnime(AnimeID);
            if (anime == null) return;

            // Trakt
            if (details.CrossRef_AniDB_Trakt != null)
                CrossRef_AniDB_Trakt = new CrossRef_AniDB_TraktVM(details.CrossRef_AniDB_Trakt);

            if (details.TraktShow != null)
                TraktShow = new Trakt_ShowVM(details.TraktShow);

            if (details.TraktImageFanart != null)
            {
                TraktImageFanart = new Trakt_ImageFanartVM(details.TraktImageFanart);

                bool isDefault = false;
                if (anime != null && anime.DefaultFanart != null && anime.DefaultFanart.ImageParentType == (int)ImageEntityType.Trakt_Fanart
                    && anime.DefaultFanart.ImageParentID == TraktImageFanart.Trakt_ImageFanartID)
                {
                    isDefault = true;
                }

                TraktImageFanart.IsImageDefault = isDefault;

                AllFanarts.Add(new FanartContainer(ImageEntityType.Trakt_Fanart, TraktImageFanart));
            }

            if (details.TraktImagePoster != null)
            {
                TraktImagePoster = new Trakt_ImagePosterVM(details.TraktImagePoster);

                bool isDefault = false;
                if (anime != null && anime.DefaultPoster != null && anime.DefaultPoster.ImageParentType == (int)ImageEntityType.Trakt_Poster
                    && anime.DefaultPoster.ImageParentID == TraktImagePoster.Trakt_ImagePosterID)
                {
                    isDefault = true;
                }

                TraktImagePoster.IsImageDefault = isDefault;

                AllPosters.Add(new PosterContainer(ImageEntityType.Trakt_Poster, TraktImagePoster));
            }

            if (CrossRef_AniDB_Trakt == null || TraktShow == null)
                TraktCrossRefExists = false;
            else
                TraktCrossRefExists = true;

            // TvDB
            if (details.CrossRef_AniDB_TvDB != null)
            {
                CrossRef_AniDB_TvDB = new List<CrossRef_AniDB_TvDBVMV2>();
                foreach (JMMServerBinary.Contract_CrossRef_AniDB_TvDBV2 contract in details.CrossRef_AniDB_TvDB)
                {
                    CrossRef_AniDB_TvDBVMV2 xref = new CrossRef_AniDB_TvDBVMV2(contract);
                    CrossRef_AniDB_TvDB.Add(xref);
                }
            }

            if (details.TvDBSeries != null)
            {
                TvDBSeries = new List<TvDB_SeriesVM>();
                foreach (JMMServerBinary.Contract_TvDB_Series contract in details.TvDBSeries)
                {
                    TvDB_SeriesVM tv = new TvDB_SeriesVM(contract);
                    TvDBSeries.Add(tv);
                }
            }

            foreach (JMMServerBinary.Contract_TvDB_Episode contract in details.TvDBEpisodes)
                TvDBEpisodes.Add(new TvDB_EpisodeVM(contract));

            foreach (JMMServerBinary.Contract_TvDB_ImageFanart contract in details.TvDBImageFanarts)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultFanart != null && anime.DefaultFanart.ImageParentType == (int)ImageEntityType.TvDB_FanArt
                    && anime.DefaultFanart.ImageParentID == contract.TvDB_ImageFanartID)
                {
                    isDefault = true;
                }

                TvDB_ImageFanartVM tvFanart = new TvDB_ImageFanartVM(contract);
                tvFanart.IsImageDefault = isDefault;
                TvDBImageFanarts.Add(tvFanart);

                AllFanarts.Add(new FanartContainer(ImageEntityType.TvDB_FanArt, tvFanart));
            }

            foreach (JMMServerBinary.Contract_TvDB_ImagePoster contract in details.TvDBImagePosters)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultPoster != null && anime.DefaultPoster.ImageParentType == (int)ImageEntityType.TvDB_Cover
                    && anime.DefaultPoster.ImageParentID == contract.TvDB_ImagePosterID)
                {
                    isDefault = true;
                }

                TvDB_ImagePosterVM tvPoster = new TvDB_ImagePosterVM(contract);
                tvPoster.IsImageDefault = isDefault;
                TvDBImagePosters.Add(tvPoster);
                AllPosters.Add(new PosterContainer(ImageEntityType.TvDB_Cover, tvPoster));
            }

            foreach (JMMServerBinary.Contract_TvDB_ImageWideBanner contract in details.TvDBImageWideBanners)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultWideBanner != null && anime.DefaultWideBanner.ImageParentType == (int)ImageEntityType.TvDB_Banner
                    && anime.DefaultWideBanner.ImageParentID == contract.TvDB_ImageWideBannerID)
                {
                    isDefault = true;
                }

                TvDB_ImageWideBannerVM tvBanner = new TvDB_ImageWideBannerVM(contract);
                tvBanner.IsImageDefault = isDefault;
                TvDBImageWideBanners.Add(tvBanner);
            }

            if ((CrossRef_AniDB_TvDB == null || CrossRef_AniDB_TvDB.Count ==0) ||
                (TvDBSeries == null || TvDBSeries.Count == 0))
                TvDBCrossRefExists = false;
            else
                TvDBCrossRefExists = true;

            // MovieDB
            if (details.CrossRef_AniDB_MovieDB != null)
                CrossRef_AniDB_MovieDB = new CrossRef_AniDB_OtherVM(details.CrossRef_AniDB_MovieDB);

            if (details.MovieDBMovie != null)
                MovieDB_Movie = new MovieDB_MovieVM(details.MovieDBMovie);

            foreach (JMMServerBinary.Contract_MovieDB_Fanart contract in details.MovieDBFanarts)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultFanart != null && anime.DefaultFanart.ImageParentType == (int)ImageEntityType.MovieDB_FanArt
                    && anime.DefaultFanart.ImageParentID == contract.MovieDB_FanartID)
                {
                    isDefault = true;
                }

                MovieDB_FanartVM movieFanart = new MovieDB_FanartVM(contract);
                movieFanart.IsImageDefault = isDefault;
                MovieDBFanarts.Add(movieFanart);
                AllFanarts.Add(new FanartContainer(ImageEntityType.MovieDB_FanArt, movieFanart));
            }

            foreach (JMMServerBinary.Contract_MovieDB_Poster contract in details.MovieDBPosters)
            {
                bool isDefault = false;
                if (anime != null && anime.DefaultPoster != null && anime.DefaultPoster.ImageParentType == (int)ImageEntityType.MovieDB_Poster
                    && anime.DefaultPoster.ImageParentID == contract.MovieDB_PosterID)
                {
                    isDefault = true;
                }

                MovieDB_PosterVM moviePoster = new MovieDB_PosterVM(contract);
                moviePoster.IsImageDefault = isDefault;
                MovieDBPosters.Add(moviePoster);
                AllPosters.Add(new PosterContainer(ImageEntityType.MovieDB_Poster, moviePoster));
            }

            if (CrossRef_AniDB_MovieDB == null || MovieDB_Movie == null)
                MovieDBCrossRefExists = false;
            else
                MovieDBCrossRefExists = true;
        }