Пример #1
0
        private void SetCharacterProperties(CL_AniDB_Character aniChar, VM_AniDB_Anime anime = null)
        {
            SetGUIProperty(GuiProperty.Actors_Character_Name, aniChar.CharName);
            SetGUIProperty(GuiProperty.Actors_Character_KanjiName, aniChar.CharKanjiName);
            SetGUIProperty(GuiProperty.Actors_Character_Description, aniChar.CharDescription);
            SetGUIProperty(GuiProperty.Actors_Character_CharType, aniChar.CharType);

            string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png";

            if (File.Exists(aniChar.GetPosterPath()))
            {
                imagePath = aniChar.GetPosterPath();
            }

            SetGUIProperty(GuiProperty.Actors_Character_Poster, imagePath);

            if (anime != null)
            {
                SetGUIProperty(GuiProperty.Actors_Series_Title, anime.FormattedTitle);
                SetGUIProperty(GuiProperty.Actors_Series_Poster,
                               ImageAllocator.GetAnimeImageAsFileName(anime, GUIFacadeControl.Layout.List));
            }
            else
            {
                ClearGUIProperty(GuiProperty.Actors_Series_Title);
                ClearGUIProperty(GuiProperty.Actors_Series_Poster);
            }
        }
Пример #2
0
        private void SetCharacterProperties(AniDB_CharacterVM aniChar)
        {
            clearGUIProperty("Character.Name");
            clearGUIProperty("Character.KanjiName");
            clearGUIProperty("Character.Description");
            clearGUIProperty("Character.CharType");
            clearGUIProperty("Character.Poster");
            clearGUIProperty("Series.Poster");
            clearGUIProperty("Series.Title");

            setGUIProperty("Character.Name", aniChar.CharName);
            setGUIProperty("Character.KanjiName", aniChar.CharKanjiName);
            setGUIProperty("Character.Description", aniChar.CharDescription);
            setGUIProperty("Character.CharType", aniChar.CharType);

            string imagePath = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png";

            if (File.Exists(aniChar.PosterPath))
            {
                imagePath = aniChar.PosterPath;
            }

            setGUIProperty("Character.Poster", imagePath);

            if (aniChar.Anime != null)
            {
                setGUIProperty("Series.Title", aniChar.Anime.FormattedTitle);
                setGUIProperty("Series.Poster", ImageAllocator.GetAnimeImageAsFileName(aniChar.Anime, GUIFacadeControl.Layout.List));
            }
        }
Пример #3
0
        static public int StartFileDownload(string fullURL, Settings.Path localPath, string localFilename)
        {
            WebClient webClient = new WebClient();

            // .NET 4.0: Use TLS v1.2. Many download sources no longer support the older and now insecure TLS v1.0/1.1 and SSL v3.
            ServicePointManager.SecurityProtocol = ( SecurityProtocolType )0xc00;

            int nDownloadGUID = nDownloadGUIDGenerator;

            nDownloadGUIDGenerator++;

            string fullLocalPath = Helper.PathCombine(Settings.GetPath(localPath), localFilename);

            webClient.Headers.Add("user-agent", Settings.UserAgent);
            try
            {
                Directory.CreateDirectory(Path.GetDirectoryName(fullLocalPath));
                if (!File.Exists(fullLocalPath) || // only if the file doesn't exist
                    ImageAllocator.LoadImageFastFromFile(fullLocalPath) == null)       // or the file is damaged
                {
                    webClient.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(webClient_DownloadFileCompleted);
                    webClient.DownloadFileAsync(new Uri(fullURL), fullLocalPath, nDownloadGUID);
                    webClientList.Add(nDownloadGUID, webClient);
                    return(nDownloadGUID);
                }
                return(-1);
            }
            catch (WebException)
            {
                MPTVSeriesLog.Write("File download failed (" + fullURL + ") to " + fullLocalPath.Replace("/", @"\"));
                return(-1);
            }
        }
Пример #4
0
 private void DisplaySeries()
 {
     if (MainWindow.RandomWindow_CurrentSeries == null)
     {
         SetGUIProperty(GuiProperty.Random_Status, Translation.NoMatchesFound);
         ClearGUIProperty(GuiProperty.Random_Series_Title);
         ClearGUIProperty(GuiProperty.Random_Series_Description);
         ClearGUIProperty(GuiProperty.Random_Series_LastWatched);
         ClearGUIProperty(GuiProperty.Random_Series_EpisodesWatched);
         ClearGUIProperty(GuiProperty.Random_Series_EpisodesUnwatched);
         ClearGUIProperty(GuiProperty.Random_Series_Poster);
         ClearGUIProperty(GuiProperty.Random_NumberOfMatches);
         MainWindow.RandomWindow_MatchesFound  = 0;
         MainWindow.RandomWindow_CurrentSeries = null;
     }
     else
     {
         SetGUIProperty(GuiProperty.Random_Series_Title, MainWindow.RandomWindow_CurrentSeries.SeriesName);
         SetGUIProperty(GuiProperty.Random_Series_Description, MainWindow.RandomWindow_CurrentSeries.Description);
         SetGUIProperty(GuiProperty.Random_Series_LastWatched, MainWindow.RandomWindow_CurrentSeries.WatchedDate.HasValue ? MainWindow.RandomWindow_CurrentSeries.WatchedDate.Value.ToString("dd MMM yy", Globals.Culture) : "-");
         SetGUIProperty(GuiProperty.Random_Series_EpisodesWatched, MainWindow.RandomWindow_CurrentSeries.WatchedEpisodeCount.ToString(Globals.Culture));
         SetGUIProperty(GuiProperty.Random_Series_EpisodesUnwatched, MainWindow.RandomWindow_CurrentSeries.UnwatchedEpisodeCount.ToString(Globals.Culture));
         SetGUIProperty(GuiProperty.Random_Series_Poster, ImageAllocator.GetSeriesImageAsFileName(MainWindow.RandomWindow_CurrentSeries, GUIFacadeControl.Layout.List));
         dummyNoData.Visible = false;
     }
 }
Пример #5
0
        private void DisplaySeries()
        {
            clearGUIProperty("Series.Title");
            clearGUIProperty("Series.Description");
            clearGUIProperty("Series.LastWatched");
            clearGUIProperty("Series.EpisodesWatched");
            clearGUIProperty("Series.EpisodesUnwatched");
            clearGUIProperty("Series.Poster");

            clearGUIProperty("NumberOfMatches");

            if (MainWindow.RandomWindow_CurrentSeries == null)
            {
                setGUIProperty("Status", "No Matches Found");
                MainWindow.RandomWindow_MatchesFound  = 0;
                MainWindow.RandomWindow_CurrentSeries = null;
            }
            else
            {
                setGUIProperty("Series.Title", MainWindow.RandomWindow_CurrentSeries.SeriesName);
                setGUIProperty("Series.Description", MainWindow.RandomWindow_CurrentSeries.Description);
                setGUIProperty("Series.LastWatched", MainWindow.RandomWindow_CurrentSeries.WatchedDate.HasValue ? MainWindow.RandomWindow_CurrentSeries.WatchedDate.Value.ToString("dd MMM yy", Globals.Culture) : "-");
                setGUIProperty("Series.EpisodesWatched", MainWindow.RandomWindow_CurrentSeries.WatchedEpisodeCount.ToString());
                setGUIProperty("Series.EpisodesUnwatched", MainWindow.RandomWindow_CurrentSeries.UnwatchedEpisodeCount.ToString());
                setGUIProperty("Series.Poster", ImageAllocator.GetSeriesImageAsFileName(MainWindow.RandomWindow_CurrentSeries, GUIFacadeControl.Layout.List));

                dummyNoData.Visible = false;
            }
        }
Пример #6
0
        static public string DownloadBanner(string onlineFilename, Settings.Path localPath, string localFilename)
        {
            WebClient webClient     = new WebClient();
            string    fullLocalPath = Helper.PathCombine(Settings.GetPath(localPath), localFilename);
            string    fullURL       = (DBOnlineMirror.Banners.EndsWith("/") ? DBOnlineMirror.Banners : (DBOnlineMirror.Banners + "/")) + onlineFilename;

            webClient.Headers.Add("user-agent", Settings.UserAgent);

            // .NET 4.0: Use TLS v1.2. Many download sources no longer support the older and now insecure TLS v1.0/1.1 and SSL v3.
            ServicePointManager.SecurityProtocol = ( SecurityProtocolType )0xc00;

            try
            {
                Directory.CreateDirectory(Path.GetDirectoryName(fullLocalPath));
                if (!File.Exists(fullLocalPath) || // only if the file doesn't exist
                    ImageAllocator.LoadImageFastFromFile(fullLocalPath) == null)       // or the file is damaged
                {
                    MPTVSeriesLog.Write("Downloading new Image from: " + fullURL, MPTVSeriesLog.LogLevel.Debug);
                    webClient.DownloadFile(fullURL, fullLocalPath);
                    return(fullLocalPath);
                }
                return(string.Empty);
            }
            catch (WebException ex)
            {
                MPTVSeriesLog.Write($"Banner download failed from '{fullURL}' to '{fullLocalPath.Replace("/", @"\")}'. Reason='{ex.Message}'");
                return(null);
            }
        }
Пример #7
0
        private void SetSkinProperties()
        {
            setGUIProperty("AnimeInfo.Title", "-");
            setGUIProperty("AnimeInfo.PageTitle", "Information");

            if (serMain != null)
            {
                setGUIProperty("AnimeInfo.Poster", ImageAllocator.GetSeriesImageAsFileName(serMain, GUIFacadeControl.Layout.List));
                setGUIProperty("AnimeInfo.Title", serMain.SeriesName);
            }
        }
Пример #8
0
        private void SetSkinProperties()
        {
            SetGUIProperty(GuiProperty.AnimeInfo_PageTitle, Translation.Information);

            if (serMain != null)
            {
                SetGUIProperty(GuiProperty.AnimeInfo_Poster, ImageAllocator.GetSeriesImageAsFileName(serMain, GUIFacadeControl.Layout.List));
                SetGUIProperty(GuiProperty.AnimeInfo_Title, serMain.SeriesName);
            }
            else
            {
                ClearGUIProperty(GuiProperty.AnimeInfo_Title);
            }
        }
Пример #9
0
        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)
            {
                VM_TvDB_ImageFanart fanartTvDb = fanart.FanartObject as VM_TvDB_ImageFanart;
                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(Size), false);
            }
            else
            {
                preview = m_Facade.SelectedListItem.IconImageBig;
            }

            SetGUIProperty(GuiProperty.FanArt_SelectedPreview, preview);
        }
Пример #10
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="filename">Filename of the currently played episode</param>
        public NowPlayingSeries(string filename)
        {
            try
            {
                SQLCondition     query    = new SQLCondition(new DBEpisode(), DBEpisode.cFilename, filename, SQLConditionType.Equal);
                List <DBEpisode> episodes = DBEpisode.Get(query);

                if (episodes.Count > 0)
                {
                    episodeFound = true;

                    SeriesId    = episodes[0].onlineEpisode[DBOnlineEpisode.cSeriesID];
                    SeasonId    = episodes[0].onlineEpisode[DBOnlineEpisode.cSeasonID];
                    EpisodeId   = episodes[0].onlineEpisode[DBOnlineEpisode.cID];
                    CompositeId = episodes[0].fullItem[DBEpisode.cCompositeID];

                    Episode     = episodes[0].onlineEpisode[DBOnlineEpisode.cEpisodeIndex];
                    Season      = episodes[0].onlineEpisode[DBOnlineEpisode.cSeasonIndex];
                    Plot        = episodes[0].onlineEpisode[DBOnlineEpisode.cEpisodeSummary];
                    Title       = episodes[0].onlineEpisode[DBOnlineEpisode.cEpisodeName];
                    Director    = episodes[0].onlineEpisode[DBOnlineEpisode.cDirector];
                    Writer      = episodes[0].onlineEpisode[DBOnlineEpisode.cWriter];
                    Rating      = episodes[0].onlineEpisode[DBOnlineEpisode.cRating];
                    MyRating    = episodes[0].onlineEpisode[DBOnlineEpisode.cMyRating];
                    RatingCount = episodes[0].onlineEpisode[DBOnlineEpisode.cRatingCount];
                    AirDate     = episodes[0].onlineEpisode[DBOnlineEpisode.cFirstAired];

                    DBSeries s = Helper.getCorrespondingSeries(episodes[0].onlineEpisode[DBOnlineEpisode.cSeriesID]);
                    Series = s[DBOnlineSeries.cPrettyName];
                    Status = s[DBOnlineSeries.cStatus];
                    Genre  = s[DBOnlineSeries.cGenre];

                    // Get season poster path
                    DBSeason season = DBSeason.getRaw(SeriesId, episodes[0].onlineEpisode[DBOnlineEpisode.cSeasonIndex]);
                    ImageName = ImageAllocator.GetSeasonBannerAsFilename(season);

                    // Fall back to series poster if no season poster is available
                    if (String.IsNullOrEmpty(ImageName))
                    {
                        ImageName = ImageAllocator.GetSeriesPosterAsFilename(s);
                    }
                }
            }
            catch (Exception e)
            {
                WifiRemote.LogMessage("Error getting now playing tvseries: " + e.Message, WifiRemote.LogType.Error);
            }
        }
Пример #11
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);
        }
Пример #12
0
        private void SetEpisode(VM_AnimeEpisode_User ep)
        {
            if (ep == null)
            {
                return;
            }

            /*AniDB_AnimeVM anime = ep.AnimeSeries.AniDB_Anime;
             *
             *    Dictionary<int, TvDB_Episode> dictTvDBEpisodes = anime.DictTvDBEpisodes;
             *    Dictionary<int, int> dictTvDBSeasons = anime.DictTvDBSeasons;
             *    Dictionary<int, int> dictTvDBSeasonsSpecials = anime.DictTvDBSeasonsSpecials;
             *    CrossRef_AniDB_TvDBVM tvDBCrossRef = anime.CrossRefTvDB;
             *    ep.SetTvDBInfo(dictTvDBEpisodes, dictTvDBSeasons, dictTvDBSeasonsSpecials, tvDBCrossRef);*/


            clearGUIProperty("Watching.Series.Title");
            clearGUIProperty("Watching.Series.Description");
            clearGUIProperty("Watching.Series.LastWatched");
            clearGUIProperty("Watching.Series.EpisodesAvailable");
            clearGUIProperty("Watching.Episode.Title");
            clearGUIProperty("Watching.Episode.AirDate");
            clearGUIProperty("Watching.Episode.RunTime");
            clearGUIProperty("Watching.Episode.FileInfo");
            clearGUIProperty("Watching.Episode.Overview");
            clearGUIProperty("Watching.Episode.Image");
            clearGUIProperty("Watching.Episode.Logos");


            setGUIProperty("Watching.Series.Title", ep.AnimeSeries.SeriesName);
            setGUIProperty("Watching.Series.Description", ep.AnimeSeries.Description);
            setGUIProperty("Watching.Series.LastWatched", ep.AnimeSeries.WatchedDate.HasValue ? ep.AnimeSeries.WatchedDate.Value.ToString("dd MMM yy", Globals.Culture) : "-");
            setGUIProperty("Watching.Series.EpisodesAvailable", ep.AnimeSeries.UnwatchedEpisodeCount.ToString());

            setGUIProperty("Watching.Episode.Title", ep.EpisodeNumberAndNameWithType);
            setGUIProperty("Watching.Episode.AirDate", ep.AirDateAsString);
            setGUIProperty("Watching.Episode.RunTime", Utils.FormatSecondsToDisplayTime(ep.AniDB_LengthSeconds));


            setGUIProperty("Watching.Series.Poster", ImageAllocator.GetSeriesImageAsFileName(ep.AnimeSeries, GUIFacadeControl.Layout.List));

            if (ep.EpisodeImageLocation.Length > 0)
            {
                setGUIProperty("Watching.Episode.Image", ep.EpisodeImageLocation);
            }

            try
            {
                Fanart fanart = new Fanart(ep.AnimeSeries);
                if (!string.IsNullOrEmpty(fanart.FileName))
                {
                    setGUIProperty("Watching.Series.Fanart", fanart.FileName);
                }
                else
                {
                    setGUIProperty("Watching.Series.Fanart", "-");
                }
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ep.AnimeSeries.SeriesName + " - " + ex);
            }

            // Overview
            string overview = ep.EpisodeOverview;

            if (BaseConfig.Settings.HidePlot)
            {
                if (ep.EpisodeOverview.Trim().Length > 0 && ep.IsWatched())
                {
                    overview = "*** Hidden to prevent spoilers ***";
                }
            }
            setGUIProperty("Watching.Episode.Overview", overview);

            // File Info
            List <VM_VideoDetailed> filesForEpisode = VM_ShokoServer.Instance.ShokoServices.GetFilesForEpisode(ep.AnimeEpisodeID,
                                                                                                               VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_VideoDetailed>();


            string finfo = "";

            foreach (VM_VideoDetailed vid in filesForEpisode)
            {
                finfo = vid.FileSelectionDisplay;
            }

            if (filesForEpisode.Count > 1)
            {
                finfo = filesForEpisode.Count + " Files Available";
            }

            setGUIProperty("Watching.Episode.FileInfo", finfo);

            // Logos
            string logos = Logos.buildLogoImage(ep);

            BaseConfig.MyAnimeLog.Write(logos);
            setGUIProperty("Watching.Episode.Logos", logos);
        }
Пример #13
0
        private void DisplayEpisode()
        {
            if (MainWindow.RandomWindow_CurrentEpisode == null)
            {
                SetGUIProperty(GuiProperty.Random_Status, Translation.NoMatchesFound);
                MainWindow.RandomWindow_MatchesFound   = 0;
                MainWindow.RandomWindow_CurrentSeries  = null;
                MainWindow.RandomWindow_CurrentEpisode = null;
            }
            else
            {
                SetGUIProperty(GuiProperty.Random_Series_Description, MainWindow.RandomWindow_CurrentSeries.Description);
                SetGUIProperty(GuiProperty.Random_Series_Title, MainWindow.RandomWindow_CurrentSeries.SeriesName);
                SetGUIProperty(GuiProperty.Random_Series_LastWatched, MainWindow.RandomWindow_CurrentSeries.WatchedDate.HasValue ? MainWindow.RandomWindow_CurrentSeries.WatchedDate.Value.ToString("dd MMM yy", Globals.Culture) : "-");
                SetGUIProperty(GuiProperty.Random_Series_EpisodesWatched, MainWindow.RandomWindow_CurrentSeries.WatchedEpisodeCount.ToString(Globals.Culture));
                SetGUIProperty(GuiProperty.Random_Series_EpisodesUnwatched, MainWindow.RandomWindow_CurrentSeries.UnwatchedEpisodeCount.ToString(Globals.Culture));
                SetGUIProperty(GuiProperty.Random_Series_Poster, ImageAllocator.GetSeriesImageAsFileName(MainWindow.RandomWindow_CurrentSeries, GUIFacadeControl.Layout.List));

                SetGUIProperty(GuiProperty.Random_Episode_Title, MainWindow.RandomWindow_CurrentEpisode.EpisodeNumberAndNameWithType);
                SetGUIProperty(GuiProperty.Random_Episode_AirDate, MainWindow.RandomWindow_CurrentEpisode.AirDateAsString);
                SetGUIProperty(GuiProperty.Random_Episode_RunTime, Utils.FormatSecondsToDisplayTime(MainWindow.RandomWindow_CurrentEpisode.AniDB_LengthSeconds));


                if (MainWindow.RandomWindow_CurrentEpisode.EpisodeImageLocation.Length > 0)
                {
                    SetGUIProperty(GuiProperty.Random_Episode_Image, MainWindow.RandomWindow_CurrentEpisode.EpisodeImageLocation);
                }
                else
                {
                    ClearGUIProperty(GuiProperty.Random_Episode_Image);
                }

                // Overview
                string overview = MainWindow.RandomWindow_CurrentEpisode.EpisodeOverview;
                if (BaseConfig.Settings.HidePlot)
                {
                    if (MainWindow.RandomWindow_CurrentEpisode.EpisodeOverview.Trim().Length > 0 &&
                        !MainWindow.RandomWindow_CurrentEpisode.IsWatched())
                    {
                        overview = "*** " + Translation.HiddenToPreventSpoiles + " ***";
                    }
                    SetGUIProperty(GuiProperty.Random_Episode_Overview, overview);
                }

                // File Info
                List <VM_VideoDetailed> filesForEpisode =
                    VM_ShokoServer.Instance.ShokoServices.GetFilesForEpisode(
                        MainWindow.RandomWindow_CurrentEpisode.AnimeEpisodeID,
                        VM_ShokoServer.Instance.CurrentUser.JMMUserID).CastList <VM_VideoDetailed>();


                string finfo = "";
                foreach (VM_VideoDetailed vid in filesForEpisode)
                {
                    finfo = vid.FileSelectionDisplay;
                }

                if (filesForEpisode.Count > 1)
                {
                    finfo = filesForEpisode.Count.ToString(Globals.Culture) + " " + Translation.FilesAvailable;
                }

                SetGUIProperty(GuiProperty.Random_Episode_FileInfo, finfo);
                // Logos
                string logos = Logos.buildLogoImage(MainWindow.RandomWindow_CurrentEpisode);

                BaseConfig.MyAnimeLog.Write(logos);
                SetGUIProperty(GuiProperty.Random_Episode_Logos, logos);

                dummyNoData.Visible = false;
            }
        }
Пример #14
0
        private void ShowRelations()
        {
            GUIControl.ClearControl(this.GetID, m_Facade.GetID);

            if (dummyRelationsExist != null)
            {
                if (relations.Count > 0)
                {
                    dummyRelationsExist.Visible = true;
                }
                else
                {
                    dummyRelationsExist.Visible = false;
                }
            }

            string imagePathMissing   = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_question_poster.png";
            string imagePathNoPicture = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png";

            foreach (AniDB_Anime_RelationVM ra in relations)
            {
                string imagePath = "";

                BaseConfig.MyAnimeLog.Write("AnimeID: " + mainAnime.AnimeID.ToString() + ", Related ID: " + ra.AniDB_Anime.AnimeID.ToString());
                BaseConfig.MyAnimeLog.Write("Poster Path: " + ra.AniDB_Anime.DefaultPosterPath);

                AniDB_AnimeVM anime = ra.AniDB_Anime;
                if (anime != null)
                {
                    // try and load the series
                    AnimeSeriesVM serAnime = ra.AnimeSeries;
                    if (serAnime != null)
                    {
                        string posterName = ImageAllocator.GetSeriesImageAsFileName(serAnime, GUIFacadeControl.Layout.Filmstrip);
                        if (File.Exists(posterName))
                        {
                            imagePath = posterName;
                        }
                    }

                    if (imagePath.Length == 0)
                    {
                        if (anime.DefaultPosterPath.Trim().Length > 0 && File.Exists(anime.DefaultPosterPath))
                        {
                            imagePath = anime.DefaultPosterPath;
                        }
                        else
                        {
                            imagePath = imagePathNoPicture;
                        }
                    }
                }
                else
                {
                    imagePath = imagePathMissing;
                }


                GUIListItem item = new GUIListItem();
                item.IconImage       = item.IconImageBig = imagePath;
                item.TVTag           = ra;
                item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected);
                m_Facade.Add(item);
            }

            if (m_Facade.Count > 0)
            {
                m_Facade.SelectedListItemIndex = 0;

                AniDB_Anime_RelationVM ra = m_Facade.SelectedListItem.TVTag as AniDB_Anime_RelationVM;
                if (ra != null)
                {
                    SetAnime(ra);
                }
            }

            //GUIControl.FocusControl(GetID, 50);
        }
Пример #15
0
        private void ShowRelations()
        {
            GUIControl.ClearControl(this.GetID, m_Facade.GetID);

            if (dummyRelationsExist != null)
            {
                if (relations.Count > 0)
                {
                    dummyRelationsExist.Visible = true;
                }
                else
                {
                    dummyRelationsExist.Visible = false;
                }
            }


            string imagePathMissing   = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_question_poster.png";
            string imagePathNoPicture = GUIGraphicsContext.Skin + @"\Media\MyAnime3\anime3_blankchar.png";

            BaseConfig.MyAnimeLog.Write("CharWindow.GlobalSeriesID = {0}", MainWindow.GlobalSeriesID.ToString());
            BaseConfig.MyAnimeLog.Write("CharWindow.Relations count = " + relations.Count);

            if (relations?.Count > 0)
            {
                foreach (CL_AniDB_Anime_Relation ra in relations)
                {
                    string imagePath = "";

                    if (ra.AniDB_Anime != null && ra.AnimeSeries != null)
                    {
                        BaseConfig.MyAnimeLog.Write("AnimeID: " + MainWindow.GlobalSeriesID + ", Related ID: " +
                                                    ra.AniDB_Anime.AnimeID.ToString());
                        BaseConfig.MyAnimeLog.Write("Poster Path: " + ((VM_AniDB_Anime)ra.AniDB_Anime).DefaultPosterPath);

                        VM_AniDB_Anime anime = (VM_AniDB_Anime)ra.AniDB_Anime;
                        // try and load the series
                        VM_AnimeSeries_User serAnime = (VM_AnimeSeries_User)ra.AnimeSeries;

                        if (serAnime != null)
                        {
                            string posterName = ImageAllocator.GetSeriesImageAsFileName(serAnime,
                                                                                        GUIFacadeControl.Layout.Filmstrip);
                            if (File.Exists(posterName))
                            {
                                imagePath = posterName;
                            }
                        }

                        if (imagePath.Length == 0)
                        {
                            if (anime.DefaultPosterPath.Trim().Length > 0 && File.Exists(anime.DefaultPosterPath))
                            {
                                imagePath = anime.DefaultPosterPath;
                            }
                            else
                            {
                                imagePath = imagePathNoPicture;
                            }
                        }
                    }
                    else
                    {
                        imagePath = imagePathMissing;
                    }

                    // If it has no title skip it as it's probably an invalid item
                    if (!string.IsNullOrEmpty(ra.AniDB_Anime?.MainTitle))
                    {
                        GUIListItem item = new GUIListItem();
                        item.IconImage       = item.IconImageBig = imagePath;
                        item.TVTag           = ra;
                        item.OnItemSelected += new GUIListItem.ItemSelectedHandler(onFacadeItemSelected);
                        m_Facade.Add(item);
                    }
                }
            }

            if (m_Facade.Count > 0)
            {
                m_Facade.SelectedListItemIndex = 0;

                CL_AniDB_Anime_Relation ra = m_Facade.SelectedListItem?.TVTag as CL_AniDB_Anime_Relation;
                if (ra != null)
                {
                    SetAnime(ra);
                }
            }

            //GUIControl.FocusControl(GetID, 50);
        }
Пример #16
0
        private void DisplayEpisode()
        {
            clearGUIProperty("Series.Title");
            clearGUIProperty("Series.Description");
            clearGUIProperty("Series.LastWatched");
            clearGUIProperty("Series.EpisodesWatched");
            clearGUIProperty("Series.EpisodesUnwatched");
            clearGUIProperty("Series.Poster");

            clearGUIProperty("NumberOfMatches");

            clearGUIProperty("Episode.Title");
            clearGUIProperty("Episode.AirDate");
            clearGUIProperty("Episode.RunTime");
            clearGUIProperty("Episode.FileInfo");
            clearGUIProperty("Episode.Overview");
            clearGUIProperty("Episode.Image");
            clearGUIProperty("Episode.Logos");

            if (MainWindow.RandomWindow_CurrentEpisode == null)
            {
                setGUIProperty("Status", "No Matches Found");
                MainWindow.RandomWindow_MatchesFound   = 0;
                MainWindow.RandomWindow_CurrentSeries  = null;
                MainWindow.RandomWindow_CurrentEpisode = null;
            }
            else
            {
                setGUIProperty("Series.Title", MainWindow.RandomWindow_CurrentSeries.SeriesName);
                setGUIProperty("Series.Description", MainWindow.RandomWindow_CurrentSeries.Description);
                setGUIProperty("Series.LastWatched", MainWindow.RandomWindow_CurrentSeries.WatchedDate.HasValue ? MainWindow.RandomWindow_CurrentSeries.WatchedDate.Value.ToString("dd MMM yy", Globals.Culture) : "-");
                setGUIProperty("Series.EpisodesWatched", MainWindow.RandomWindow_CurrentSeries.WatchedEpisodeCount.ToString());
                setGUIProperty("Series.EpisodesUnwatched", MainWindow.RandomWindow_CurrentSeries.UnwatchedEpisodeCount.ToString());
                setGUIProperty("Series.Poster", ImageAllocator.GetSeriesImageAsFileName(MainWindow.RandomWindow_CurrentSeries, GUIFacadeControl.Layout.List));

                setGUIProperty("Episode.Title", MainWindow.RandomWindow_CurrentEpisode.EpisodeNumberAndNameWithType);
                setGUIProperty("Episode.AirDate", MainWindow.RandomWindow_CurrentEpisode.AirDateAsString);
                setGUIProperty("Episode.RunTime", Utils.FormatSecondsToDisplayTime(MainWindow.RandomWindow_CurrentEpisode.AniDB_LengthSeconds));


                if (MainWindow.RandomWindow_CurrentEpisode.EpisodeImageLocation.Length > 0)
                {
                    setGUIProperty("Episode.Image", MainWindow.RandomWindow_CurrentEpisode.EpisodeImageLocation);
                }

                // Overview
                string overview = MainWindow.RandomWindow_CurrentEpisode.EpisodeOverview;
                if (BaseConfig.Settings.HidePlot)
                {
                    if (MainWindow.RandomWindow_CurrentEpisode.EpisodeOverview.Trim().Length > 0 && MainWindow.RandomWindow_CurrentEpisode.IsWatched == 0)
                    {
                        overview = "*** Hidden to prevent spoilers ***";
                    }
                }
                setGUIProperty("Episode.Overview", overview);

                // File Info
                List <VideoDetailedVM> filesForEpisode = new List <VideoDetailedVM>();
                List <JMMServerBinary.Contract_VideoDetailed> contracts = JMMServerVM.Instance.clientBinaryHTTP.GetFilesForEpisode(MainWindow.RandomWindow_CurrentEpisode.AnimeEpisodeID,
                                                                                                                                   JMMServerVM.Instance.CurrentUser.JMMUserID);

                foreach (JMMServerBinary.Contract_VideoDetailed fi in contracts)
                {
                    filesForEpisode.Add(new VideoDetailedVM(fi));
                }

                string finfo = "";
                foreach (VideoDetailedVM vid in filesForEpisode)
                {
                    finfo = vid.FileSelectionDisplay;
                }

                if (filesForEpisode.Count > 1)
                {
                    finfo = filesForEpisode.Count.ToString() + " Files Available";
                }

                setGUIProperty("Episode.FileInfo", finfo);

                // Logos
                string logos = Logos.buildLogoImage(MainWindow.RandomWindow_CurrentEpisode);

                BaseConfig.MyAnimeLog.Write(logos);
                setGUIProperty("Episode.Logos", logos);

                dummyNoData.Visible = false;
            }
        }