Пример #1
0
        public static void EnableDisableFanart(bool enabled, FanartContainer fanart, int animeID)
        {
            try
            {
                if (!enabled && fanart.IsImageDefault)
                    SetDefaultFanart(false, fanart, animeID);

                switch (fanart.ImageType)
                {
                    case ImageEntityType.TvDB_FanArt:
                        TvDB_ImageFanartVM tvFanart = fanart.FanartObject as TvDB_ImageFanartVM;
                        JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, tvFanart.TvDB_ImageFanartID, (int)ImageEntityType.TvDB_FanArt);
                        tvFanart.Enabled = enabled ? 1 : 0;
                        break;

                    case ImageEntityType.Trakt_Fanart:
                        Trakt_ImageFanartVM traktFanart = fanart.FanartObject as Trakt_ImageFanartVM;
                        JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, traktFanart.Trakt_ImageFanartID, (int)ImageEntityType.Trakt_Fanart);
                        traktFanart.Enabled = enabled ? 1 : 0;
                        break;

                    case ImageEntityType.MovieDB_FanArt:
                        MovieDB_FanartVM movieFanart = fanart.FanartObject as MovieDB_FanartVM;
                        JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, movieFanart.MovieDB_FanartID, (int)ImageEntityType.MovieDB_FanArt);
                        movieFanart.Enabled = enabled ? 1 : 0;
                        break;
                }
                fanart.IsImageEnabled = enabled;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
Пример #2
0
        public static void SetDefaultFanart(bool isDefault, FanartContainer fanart, int animeID)
        {
            if (!JMMServerVM.Instance.ServerOnline)
            {
                return;
            }

            try
            {
                switch (fanart.ImageType)
                {
                case ImageEntityType.TvDB_FanArt:
                    TvDB_ImageFanartVM tvFanart = fanart.FanartObject as TvDB_ImageFanartVM;
                    JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                                                                          tvFanart.TvDB_ImageFanartID, (int)ImageEntityType.TvDB_FanArt, (int)ImageSizeType.Fanart);
                    tvFanart.IsImageDefault = isDefault;
                    break;

                case ImageEntityType.Trakt_Fanart:
                    Trakt_ImageFanartVM traktFanart = fanart.FanartObject as Trakt_ImageFanartVM;
                    JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                                                                          traktFanart.Trakt_ImageFanartID, (int)ImageEntityType.Trakt_Fanart, (int)ImageSizeType.Fanart);
                    traktFanart.IsImageDefault = isDefault;
                    break;

                case ImageEntityType.MovieDB_FanArt:
                    MovieDB_FanartVM movieFanart = fanart.FanartObject as MovieDB_FanartVM;
                    JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                                                                          movieFanart.MovieDB_FanartID, (int)ImageEntityType.MovieDB_FanArt, (int)ImageSizeType.Fanart);
                    movieFanart.IsImageDefault = isDefault;
                    break;
                }
                fanart.IsImageDefault = isDefault;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
Пример #3
0
        public static void EnableDisableFanart(bool enabled, FanartContainer fanart, int animeID)
        {
            try
            {
                if (!enabled && fanart.IsImageDefault)
                {
                    SetDefaultFanart(false, fanart, animeID);
                }

                switch (fanart.ImageType)
                {
                case ImageEntityType.TvDB_FanArt:
                    TvDB_ImageFanartVM tvFanart = fanart.FanartObject as TvDB_ImageFanartVM;
                    JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, tvFanart.TvDB_ImageFanartID, (int)ImageEntityType.TvDB_FanArt);
                    tvFanart.Enabled = enabled ? 1 : 0;
                    break;

                case ImageEntityType.Trakt_Fanart:
                    Trakt_ImageFanartVM traktFanart = fanart.FanartObject as Trakt_ImageFanartVM;
                    JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, traktFanart.Trakt_ImageFanartID, (int)ImageEntityType.Trakt_Fanart);
                    traktFanart.Enabled = enabled ? 1 : 0;
                    break;

                case ImageEntityType.MovieDB_FanArt:
                    MovieDB_FanartVM movieFanart = fanart.FanartObject as MovieDB_FanartVM;
                    JMMServerVM.Instance.clientBinaryHTTP.EnableDisableImage(enabled, movieFanart.MovieDB_FanartID, (int)ImageEntityType.MovieDB_FanArt);
                    movieFanart.Enabled = enabled ? 1 : 0;
                    break;
                }
                fanart.IsImageEnabled = enabled;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
        void setFanartPreviewBackground(FanartContainer fanart)
        {
            if (fanart == null)
            {
                ClearGUIProperty(GuiProperty.FanArt_SelectedFanartResolution);
                ClearGUIProperty(GuiProperty.FanArt_SelectedPreview);
                ClearGUIProperty(GuiProperty.FanArt_SelectedFanartIsDisabled);
                ClearGUIProperty(GuiProperty.FanArt_SelectedFanartIsDefault);
                ClearGUIProperty(GuiProperty.FanArt_Source);
                return;
            }

            if (fanart.ImageType == ImageEntityType.TvDB_FanArt)
            {
                TvDB_ImageFanartVM fanartTvDb = fanart.FanartObject as TvDB_ImageFanartVM;
                if (fanartTvDb != null)
                    SetGUIProperty(GuiProperty.FanArt_SelectedFanartResolution, fanartTvDb.BannerType2);
                else
                    ClearGUIProperty(GuiProperty.FanArt_SelectedFanartResolution);
            }
            else
                ClearGUIProperty(GuiProperty.FanArt_SelectedFanartResolution);

            SetGUIProperty(GuiProperty.FanArt_SelectedFanartIsDisabled, fanart.IsImageEnabled ? Translation.No : Translation.Yes);
            SetGUIProperty(GuiProperty.FanArt_SelectedFanartIsDefault, fanart.IsImageDefault ? Translation.Yes : Translation.No);
            SetGUIProperty(GuiProperty.FanArt_Source, fanart.FanartSource);

            string preview;

            if (File.Exists(fanart.FullImagePath))
            {
                // Ensure Fanart on Disk is valid as well
                ImageAllocator.LoadImageFastFromFile(fanart.FullImagePath);
                // Should be safe to assign fullsize fanart if available
                preview = ImageAllocator.GetOtherImage(fanart.FullImagePath, default(System.Drawing.Size), false);
            }
            else
                preview = m_Facade.SelectedListItem.IconImageBig;

            SetGUIProperty(GuiProperty.FanArt_SelectedPreview, preview);
        }
Пример #5
0
        public static void SetDefaultFanart(bool isDefault, FanartContainer fanart, int animeID)
        {
            if (!JMMServerVM.Instance.ServerOnline) return;

            try
            {

                switch (fanart.ImageType)
                {
                    case ImageEntityType.TvDB_FanArt:
                        TvDB_ImageFanartVM tvFanart = fanart.FanartObject as TvDB_ImageFanartVM;
                        JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                            tvFanart.TvDB_ImageFanartID, (int)ImageEntityType.TvDB_FanArt, (int)ImageSizeType.Fanart);
                        tvFanart.IsImageDefault = isDefault;
                        break;

                    case ImageEntityType.Trakt_Fanart:
                        Trakt_ImageFanartVM traktFanart = fanart.FanartObject as Trakt_ImageFanartVM;
                        JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                            traktFanart.Trakt_ImageFanartID, (int)ImageEntityType.Trakt_Fanart, (int)ImageSizeType.Fanart);
                        traktFanart.IsImageDefault = isDefault;
                        break;

                    case ImageEntityType.MovieDB_FanArt:
                        MovieDB_FanartVM movieFanart = fanart.FanartObject as MovieDB_FanartVM;
                        JMMServerVM.Instance.clientBinaryHTTP.SetDefaultImage(isDefault, animeID,
                            movieFanart.MovieDB_FanartID, (int)ImageEntityType.MovieDB_FanArt, (int)ImageSizeType.Fanart);
                        movieFanart.IsImageDefault = isDefault;
                        break;
                }
                fanart.IsImageDefault = isDefault;

            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("SetDefaultPoster: " + ex.Message);
            }
        }
Пример #6
0
        void setFanartPreviewBackground(FanartContainer fanart)
        {
            MainWindow.setGUIProperty("FanArt.SelectedFanartResolution", " ");
            MainWindow.setGUIProperty("FanArt.SelectedPreview", " ");
            MainWindow.setGUIProperty("FanArt.SelectedFanartIsDisabled", " ");
            MainWindow.setGUIProperty("FanArt.SelectedFanartIsDefault", " ");
            MainWindow.setGUIProperty("FanArt.Source", " ");

            if (fanart == null) return;

            if (fanart.ImageType == ImageEntityType.TvDB_FanArt)
            {
                TvDB_ImageFanartVM fanartTvDB = fanart.FanartObject as TvDB_ImageFanartVM;
                MainWindow.setGUIProperty("FanArt.SelectedFanartResolution", fanartTvDB.BannerType2);
            }

            MainWindow.setGUIProperty("FanArt.SelectedFanartIsDisabled", fanart.IsImageEnabled ? "No" : "Yes");
            MainWindow.setGUIProperty("FanArt.SelectedFanartIsDefault", fanart.IsImageDefault ? "Yes" : "No");
            MainWindow.setGUIProperty("FanArt.Source", fanart.FanartSource);

            string preview = string.Empty;

            if (File.Exists(fanart.FullImagePath))
            {
                // Ensure Fanart on Disk is valid as well
                ImageAllocator.LoadImageFastFromFile(fanart.FullImagePath);

                // Should be safe to assign fullsize fanart if available
                preview = ImageAllocator.GetOtherImage(fanart.FullImagePath, default(System.Drawing.Size), false);
            }
            else
                preview = m_Facade.SelectedListItem.IconImageBig;

            MainWindow.setGUIProperty("FanArt.SelectedPreview", preview);
        }