Пример #1
0
        public void DownloadAniDBCharactersCreatorsSync(AniDB_AnimeVM anime, bool forceDownload)
        {
            try
            {
                foreach (AniDB_CharacterVM chr in anime.Characters)
                {
                    if (!string.IsNullOrEmpty(chr.PicName))
                    {
                        string url = string.Format(Constants.URLS.AniDB_Images, chr.PicName);
                        string filename = chr.PosterPath;

                        ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.AniDB_Character, chr, 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(chr.PosterPath))
                                ProcessImageDownloadRequest(req);

                        }
                        else
                            ProcessImageDownloadRequest(req);

                    }

                    if (chr.Creator == null) continue;

                    if (!string.IsNullOrEmpty(chr.Creator.PicName))
                    {
                        string url = string.Format(Constants.URLS.AniDB_Images, chr.Creator.PicName);
                        string filename = chr.Creator.PosterPath;

                        ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.AniDB_Creator, chr.Creator, 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(chr.Creator.PosterPath))
                                ProcessImageDownloadRequest(req);

                        }
                        else
                            ProcessImageDownloadRequest(req);

                    }
                }

            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
        }
Пример #2
0
        private List<string> GetFanartFilenames(AniDB_AnimeVM anime)
        {
            List<string> allFanart = new List<string>();

            // check if user has specied a fanart to always be used
            if (anime.DefaultFanart != null)
            {
                if (!string.IsNullOrEmpty(anime.DefaultFanart.FullImagePath) && File.Exists(anime.DefaultFanart.FullImagePath))
                {
                    allFanart.Add(anime.DefaultFanart.FullImagePath);
                    return allFanart;
                }
            }

            //if (anime.AniDB_AnimeCrossRefs != nul
            foreach (FanartContainer fanart in anime.AniDB_AnimeCrossRefs.AllFanarts)
            {
                if (!fanart.IsImageEnabled) continue;
                if (!File.Exists(fanart.FullImagePath)) continue;

                allFanart.Add(fanart.FullImagePath);
            }

            return allFanart;
        }
Пример #3
0
        public void Populate(JMMServerBinary.Contract_AnimeSeries contract)
        {
            AniDB_Anime = new AniDB_AnimeVM(contract.AniDBAnime);

            if (contract.CrossRefAniDBTvDBV2 != null)
            {
                foreach (JMMServerBinary.Contract_CrossRef_AniDB_TvDBV2 contractTV in contract.CrossRefAniDBTvDBV2)
                    CrossRef_AniDB_TvDBV2.Add(new CrossRef_AniDB_TvDBVMV2(contractTV));
            }

            if (contract.TvDB_Series != null)
            {
                foreach (JMMServerBinary.Contract_TvDB_Series contractSer in contract.TvDB_Series)
                    TvDBSeriesV2.Add(new TvDB_SeriesVM(contractSer));
            }

            if (contract.CrossRefAniDBMovieDB != null)
                CrossRef_AniDB_MovieDB = new CrossRef_AniDB_OtherVM(contract.CrossRefAniDBMovieDB);
            else
                CrossRef_AniDB_MovieDB = null;

            if (contract.CrossRefAniDBMAL != null)
            {
                CrossRef_AniDB_MAL = new List<CrossRef_AniDB_MALVM>();
                foreach (JMMServerBinary.Contract_CrossRef_AniDB_MAL contractTemp in contract.CrossRefAniDBMAL)
                    CrossRef_AniDB_MAL.Add(new CrossRef_AniDB_MALVM(contractTemp));
            }
            else
                CrossRef_AniDB_MAL = null;

            // read only members
            this.AniDB_ID = contract.AniDB_ID;
            this.AnimeGroupID = contract.AnimeGroupID;
            this.AnimeSeriesID = contract.AnimeSeriesID;
            this.DateTimeUpdated = contract.DateTimeUpdated;
            this.DateTimeCreated = contract.DateTimeCreated;
            this.DefaultAudioLanguage = contract.DefaultAudioLanguage;
            this.DefaultSubtitleLanguage = contract.DefaultSubtitleLanguage;
            this.SeriesNameOverride = contract.SeriesNameOverride;

            this.LatestLocalEpisodeNumber = contract.LatestLocalEpisodeNumber;
            this.PlayedCount = contract.PlayedCount;
            this.StoppedCount = contract.StoppedCount;
            this.UnwatchedEpisodeCount = contract.UnwatchedEpisodeCount;
            this.WatchedCount = contract.WatchedCount;
            this.WatchedDate = contract.WatchedDate;
            this.EpisodeAddedDate = contract.EpisodeAddedDate;
            this.WatchedEpisodeCount = contract.WatchedEpisodeCount;

            this.MissingEpisodeCount = contract.MissingEpisodeCount;
            this.MissingEpisodeCountGroups = contract.MissingEpisodeCountGroups;

            HasMissingEpisodesAny = (MissingEpisodeCount > 0 || MissingEpisodeCountGroups > 0);
            HasMissingEpisodesAllDifferentToGroups = (MissingEpisodeCount > 0 && MissingEpisodeCount != MissingEpisodeCountGroups);
            HasMissingEpisodesGroups = MissingEpisodeCountGroups > 0;

            PosterPath = AniDB_Anime.DefaultPosterPath;
        }
Пример #4
0
 private void LoadInfo()
 {
     if (MainWindow.GlobalSeriesID > 0)
     {
         serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID);
         if (serMain != null)
             MainAnime = serMain.AniDB_Anime;
     }
 }
Пример #5
0
        public static string GetWideBannerAsFileName(AniDB_AnimeVM anime)
        {
            // check for user options
            List<string> banners = new List<string>();
            foreach (TvDB_ImageWideBannerVM wdban in anime.AniDB_AnimeCrossRefs.TvDBImageWideBanners)
            {
                if (wdban.IsImageDefault && File.Exists(wdban.FullImagePath)) return wdban.FullImagePath;

                if (File.Exists(wdban.FullImagePath)) banners.Add(wdban.FullImagePath);
            }

            if (banners.Count == 0) return "";

            return banners[bannerRandom.Next(0, banners.Count - 1)];
        }
Пример #6
0
        public static string GetPosterAsFileName(AniDB_AnimeVM anime)
        {
            // check for user options
            string fileName = "";
            // check if user has specied a poster to always be used
            fileName = anime.DefaultPosterPath;

            if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
            {
                string msg = string.Format("POSTER MISSING: {0} ({1}) - {2}", anime.FormattedTitle, anime.AnimeID, fileName);
                return fileName;
            }

            // if we can't find the specified poster, we will try and use a random one

            List<string> allPosters = new List<string>();

            foreach (PosterContainer pstr in anime.AniDB_AnimeCrossRefs.AllPosters)
            {
                if (!pstr.IsImageEnabled) continue;
                if (!File.Exists(pstr.FullImagePath)) continue;

                allPosters.Add(pstr.FullImagePath);
            }

            if (allPosters.Count > 0)
                fileName = allPosters[bannerRandom.Next(0, allPosters.Count - 1)];

            return fileName;
        }
Пример #7
0
        public static String GetAnimeImageAsFileName(AniDB_AnimeVM anime, GUIFacadeControl.Layout viewMode)
        {
            string imgFileName = "";

            switch (viewMode)
            {
                case GUIFacadeControl.Layout.LargeIcons:
                    imgFileName = GetWideBannerAsFileName(anime); break;
                case GUIFacadeControl.Layout.List:
                case GUIFacadeControl.Layout.AlbumView:
                case GUIFacadeControl.Layout.Filmstrip:
                case GUIFacadeControl.Layout.CoverFlow:
                    imgFileName = GetPosterAsFileName(anime); break;
            }

            //BaseConfig.MyAnimeLog.Write("GetSeriesBannerAsFileName::viewMode: {0} : {1} : {2}", viewMode, imgFileName, ser);

            return imgFileName;
        }
Пример #8
0
        public void PopulateAnime(JMMServerBinary.Contract_AniDBAnime animeContract)
        {
            if (animeContract != null)
                AniDB_Anime = new AniDB_AnimeVM(animeContract);

            EvaluateProperties();
        }
Пример #9
0
        public void Populate(JMMServerBinary.Contract_BookmarkedAnime contract)
        {
            this.BookmarkedAnimeID = contract.BookmarkedAnimeID;
            this.AnimeID = contract.AnimeID;
            this.Priority = contract.Priority;
            this.Notes = contract.Notes;
            this.Downloading = contract.Downloading;

            if (contract.Anime != null)
                AniDB_Anime = new AniDB_AnimeVM(contract.Anime);
        }
Пример #10
0
 public void DownloadCharacterCreatorImages(AniDB_AnimeVM anime)
 {
     if (downloadCharacterCreatorImagesWorker.IsBusy) return;
     downloadCharacterCreatorImagesWorker.RunWorkerAsync(anime);
 }
Пример #11
0
        private void SetAnime(AniDB_AnimeVM anime)
        {
            if (dummyAnimeInCollection != null) dummyAnimeInCollection.Visible = false;
            if (dummyRelatedAnime != null) dummyRelatedAnime.Visible = false;

            if (anime == null) return;

            setGUIProperty("Calendar.Title", anime.FormattedTitle);
            setGUIProperty("Calendar.Description", anime.ParsedDescription);
            setGUIProperty("Calendar.AirDate", anime.AirDateAsString);
            setGUIProperty("Calendar.Genre", anime.CategoriesFormatted);
            setGUIProperty("Calendar.GenreShort", anime.CategoriesFormattedShort);
            setGUIProperty("Calendar.Restricted", "-");
        }
Пример #12
0
        public void DownloadAniDBCover(AniDB_AnimeVM anime, bool forceDownload)
        {
            if (string.IsNullOrEmpty(anime.Picname)) return;

            try
            {
                string url = string.Format(Constants.URLS.AniDB_Images, anime.Picname);
                string filename = anime.PosterPathNoDefault;

                ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.AniDB_Cover, anime, 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(anime.PosterPath))
                    {
                        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());
            }
        }
Пример #13
0
        private void ShowCharacters()
        {
            GUIControl.ClearControl(this.GetID, m_Facade.GetID);

            if (dummyMainCharExists != null) dummyMainCharExists.Visible = false;
            if (dummyMainActorExists != null) dummyMainActorExists.Visible = false;
            if (dummySeriesExists != null) dummySeriesExists.Visible = false;

            clearGUIProperty("Title");
            clearGUIProperty("Character.Name");
            clearGUIProperty("Character.KanjiName");
            clearGUIProperty("Actor.Name");
            clearGUIProperty("Actor.KanjiName");
            clearGUIProperty("Character.CharacterCount");

            BaseConfig.MyAnimeLog.Write("CharWindow.GlobalSeriesID = {0}", MainWindow.GlobalSeriesID.ToString());

            charList.Clear();

            mainAnime = null;
            serMain = null;

            serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID);
            if (serMain != null)
                mainAnime = serMain.AniDB_Anime;
            else
                return;

            if (mainAnime == null)
                return;

            setGUIProperty("Character.Main.Title", mainAnime.FormattedTitle);

            charList = mainAnime.Characters;
            if (dummyCharactersExist != null)
            {
                if (charList.Count > 0) dummyCharactersExist.Visible = true;
                else dummyCharactersExist.Visible = false;
            }
            setGUIProperty("Character.CharacterCount", charList.Count.ToString());

            setGUIProperty("Title", serMain.SeriesName);

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

            foreach (AniDB_CharacterVM aniChar in charList)
            {
                string imagePath = imagePathNoPicture;
                if (!string.IsNullOrEmpty(aniChar.PosterPath) && File.Exists(aniChar.PosterPath))
                    imagePath = aniChar.PosterPath;

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

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

                AniDB_CharacterVM aniChar = m_Facade.SelectedListItem.TVTag as AniDB_CharacterVM;
                if (aniChar != null)
                {
                    SetCharacterProperties(aniChar);
                }
            }
        }
Пример #14
0
 public static void SearchAnime(AniDB_AnimeVM anime)
 {
     MainWindow.currentDownloadSearch = new DownloadSearchCriteria(DownloadSearchType.Series, anime);
     GUIWindowManager.ActivateWindow(Constants.WindowIDs.DOWNLOADS);
     return;
 }
Пример #15
0
        private void LoadData()
        {
            relations.Clear();

            mainAnime = null;
            serMain = null;

            serMain = JMMServerHelper.GetSeries(MainWindow.GlobalSeriesID);
            if (serMain != null)
                mainAnime = serMain.AniDB_Anime;

            if (mainAnime == null)
                return;

            try
            {
                relations = mainAnime.RelatedAnimeLinks;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
        }
        private void LoadData()
        {
            relations.Clear();

            if (serMain != null)
                mainAnime = serMain.AniDB_Anime;

            if (mainAnime == null)
                return;

            try
            {
                relations = mainAnime.RelatedAnimeLinks;
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
        }