Example #1
0
        public static AniDB GetAniDBInfo(HttpContext ctx, SVR_AniDB_Anime anime)
        {
            var aniDB = new AniDB
            {
                ID          = anime.AnimeID,
                Type        = GetAniDBSeriesType((AnimeType)anime.AnimeType),
                Restricted  = anime.Restricted == 1,
                Description = anime.Description,
                Rating      = new Rating
                {
                    Source   = "AniDB",
                    Value    = anime.Rating,
                    MaxValue = 1000,
                    Votes    = anime.VoteCount
                },
                Title  = anime.MainTitle,
                Titles = anime.GetTitles().Select(title => new Title
                {
                    Language = title.Language, Name = title.Title, Type = title.TitleType
                }).ToList(),
            };

            if (anime.AirDate != null)
            {
                var airdate = anime.AirDate.Value;
                if (airdate != DateTime.MinValue)
                {
                    aniDB.AirDate = airdate;
                }
            }
            if (anime.EndDate != null)
            {
                var enddate = anime.EndDate.Value;
                if (enddate != DateTime.MinValue)
                {
                    aniDB.EndDate = enddate;
                }
            }

            // Add Poster
            Images images = new Images();

            AddAniDBPoster(ctx, images, anime.AnimeID);
            aniDB.Poster = images.Posters.FirstOrDefault();

            return(aniDB);
        }
Example #2
0
            public AniDB(HttpContext ctx, SVR_AniDB_Anime anime)
            {
                ID          = anime.AnimeID;
                Type        = GetAniDBSeriesType((AnimeType)anime.AnimeType);
                Restricted  = anime.Restricted == 1;
                Description = anime.Description;
                Rating      = new Rating
                {
                    Source   = "AniDB",
                    Value    = anime.Rating,
                    MaxValue = 1000,
                    Votes    = anime.VoteCount
                };
                Title  = anime.MainTitle;
                Titles = anime.GetTitles().Select(title => new Title
                {
                    Name     = title.Title,
                    Language = title.Language,
                    Type     = title.TitleType,
                    Default  = string.Equals(title.Title, anime.MainTitle),
                    Source   = "AniDB",
                }
                                                  ).ToList();

                if (anime.AirDate != null)
                {
                    var airdate = anime.AirDate.Value;
                    if (airdate != DateTime.MinValue)
                    {
                        AirDate = airdate;
                    }
                }
                if (anime.EndDate != null)
                {
                    var enddate = anime.EndDate.Value;
                    if (enddate != DateTime.MinValue)
                    {
                        EndDate = enddate;
                    }
                }

                // Add Poster
                Images images = new Images();

                AddAniDBPoster(ctx, images, anime.AnimeID);
                Poster = images.Posters.FirstOrDefault();
            }
Example #3
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_MovieDBSearchAnime: {0}", AnimeID);

            try
            {
                using (var session = DatabaseFactory.SessionFactory.OpenSession())
                {
                    ISessionWrapper sessionWrapper = session.Wrap();

                    // first check if the user wants to use the web cache
                    if (ServerSettings.Instance.WebCache.Enabled && ServerSettings.Instance.WebCache.TvDB_Get)
                    {
                        try
                        {
                            Azure_CrossRef_AniDB_Other crossRef =
                                AzureWebAPI.Get_CrossRefAniDBOther(AnimeID,
                                                                   CrossRefType.MovieDB);
                            if (crossRef != null)
                            {
                                int           movieID = int.Parse(crossRef.CrossRefID);
                                MovieDB_Movie movie   = RepoFactory.MovieDb_Movie.GetByOnlineID(sessionWrapper, movieID);
                                if (movie == null)
                                {
                                    // update the info from online
                                    MovieDBHelper.UpdateMovieInfo(session, movieID, true);
                                    movie = RepoFactory.MovieDb_Movie.GetByOnlineID(movieID);
                                }

                                if (movie != null)
                                {
                                    // since we are using the web cache result, let's save it
                                    MovieDBHelper.LinkAniDBMovieDB(AnimeID, movieID, true);
                                    return;
                                }
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }

                    // Use TvDB setting
                    if (!ServerSettings.Instance.TvDB.AutoLink)
                    {
                        return;
                    }

                    string          searchCriteria = string.Empty;
                    SVR_AniDB_Anime anime          = RepoFactory.AniDB_Anime.GetByAnimeID(sessionWrapper, AnimeID);
                    if (anime == null)
                    {
                        return;
                    }

                    searchCriteria = anime.MainTitle;

                    // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                    List <MovieDB_Movie_Result> results = MovieDBHelper.Search(searchCriteria);
                    logger.Trace("Found {0} moviedb results for {1} on TheTvDB", results.Count, searchCriteria);
                    if (ProcessSearchResults(session, results, searchCriteria))
                    {
                        return;
                    }


                    if (results.Count == 0)
                    {
                        foreach (AniDB_Anime_Title title in anime.GetTitles())
                        {
                            if (title.TitleType.ToUpper() != Shoko.Models.Constants.AnimeTitleType.Official.ToUpper())
                            {
                                continue;
                            }

                            if (searchCriteria.ToUpper() == title.Title.ToUpper())
                            {
                                continue;
                            }

                            results = MovieDBHelper.Search(title.Title);
                            logger.Trace("Found {0} moviedb results for search on {1}", results.Count, title.Title);
                            if (ProcessSearchResults(session, results, title.Title))
                            {
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_TvDBSearchAnime: {0} - {1}", AnimeID, ex);
            }
        }
Example #4
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_TvDBSearchAnime: {0}", AnimeID);

            try
            {
                // first check if the user wants to use the web cache
                if (ServerSettings.Instance.WebCache.TvDB_Get)
                {
                    try
                    {
                        List <Azure_CrossRef_AniDB_TvDB> cacheResults =
                            AzureWebAPI.Get_CrossRefAniDBTvDB(AnimeID);
                        if (cacheResults != null && cacheResults.Count > 0)
                        {
                            // check again to see if there are any links, user may have manually added links while
                            // this command was in the queue
                            List <CrossRef_AniDB_TvDB> xrefTemp =
                                RepoFactory.CrossRef_AniDB_TvDB.GetByAnimeID(AnimeID);
                            if (xrefTemp != null && xrefTemp.Count > 0)
                            {
                                return;
                            }

                            // Add overrides for specials
                            var specialXRefs = cacheResults.Where(a => a.TvDBSeasonNumber == 0)
                                               .OrderBy(a => a.AniDBStartEpisodeType).ThenBy(a => a.AniDBStartEpisodeNumber)
                                               .ToList();
                            if (specialXRefs.Count != 0)
                            {
                                var overrides = TvDBLinkingHelper.GetSpecialsOverridesFromLegacy(specialXRefs);
                                foreach (var episodeOverride in overrides)
                                {
                                    var exists =
                                        RepoFactory.CrossRef_AniDB_TvDB_Episode_Override.GetByAniDBAndTvDBEpisodeIDs(
                                            episodeOverride.AniDBEpisodeID, episodeOverride.TvDBEpisodeID);
                                    if (exists != null)
                                    {
                                        continue;
                                    }
                                    RepoFactory.CrossRef_AniDB_TvDB_Episode_Override.Save(episodeOverride);
                                }
                            }
                            foreach (Azure_CrossRef_AniDB_TvDB xref in cacheResults)
                            {
                                TvDB_Series tvser = TvDBApiHelper.GetSeriesInfoOnline(xref.TvDBID, false);
                                if (tvser != null)
                                {
                                    logger.Trace("Found tvdb match on web cache for {0}", AnimeID);
                                    TvDBApiHelper.LinkAniDBTvDB(AnimeID, xref.TvDBID, true);
                                }
                            }
                            return;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }

                if (!ServerSettings.Instance.TvDB.AutoLink)
                {
                    return;
                }

                // try to pull a link from a prequel/sequel
                var relations = RepoFactory.AniDB_Anime_Relation.GetFullLinearRelationTree(AnimeID);
                int?tvDBID    = relations.SelectMany(a => RepoFactory.CrossRef_AniDB_TvDB.GetByAnimeID(a))
                                .FirstOrDefault(a => a != null)?.TvDBID;

                if (tvDBID != null)
                {
                    TvDBApiHelper.LinkAniDBTvDB(AnimeID, tvDBID.Value, true);
                    return;
                }

                // search TvDB
                SVR_AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    return;
                }

                var searchCriteria = anime.MainTitle;

                // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                List <TVDB_Series_Search_Response> results = TvDBApiHelper.SearchSeries(searchCriteria);
                logger.Trace("Found {0} tvdb results for {1} on TheTvDB", results.Count, searchCriteria);
                if (ProcessSearchResults(results, searchCriteria))
                {
                    return;
                }


                if (results.Count != 0)
                {
                    return;
                }

                bool foundResult = false;
                foreach (AniDB_Anime_Title title in anime.GetTitles())
                {
                    if (!title.TitleType.Equals(Shoko.Models.Constants.AnimeTitleType.Official, StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }
                    if (!title.Language.Equals(Shoko.Models.Constants.AniDBLanguageType.English,
                                               StringComparison.InvariantCultureIgnoreCase) &&
                        !title.Language.Equals(Shoko.Models.Constants.AniDBLanguageType.Romaji,
                                               StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }

                    if (searchCriteria.Equals(title.Title, StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }

                    searchCriteria = title.Title;
                    results        = TvDBApiHelper.SearchSeries(searchCriteria);
                    if (results.Count > 0)
                    {
                        foundResult = true;
                    }
                    logger.Trace("Found {0} tvdb results for search on {1}", results.Count, title.Title);
                    if (ProcessSearchResults(results, title.Title))
                    {
                        return;
                    }
                }
                if (!foundResult)
                {
                    logger.Warn("Unable to find a matching TvDB series for {0}", anime.MainTitle);
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_TvDBSearchAnime: {0} - {1}", AnimeID, ex);
            }
        }
Example #5
0
        private static void FillSerie(Video p, SVR_AnimeSeries aser,
                                      Dictionary <SVR_AnimeEpisode, CL_AnimeEpisode_User> eps,
                                      SVR_AniDB_Anime anidb, CL_AnimeSeries_User ser, int userid)
        {
            using (ISession session = DatabaseFactory.SessionFactory.OpenSession())
            {
                ISessionWrapper sessionWrapper = session.Wrap();
                CL_AniDB_Anime  anime          = ser.AniDBAnime.AniDBAnime;
                p.Id        = ser.AnimeSeriesID;
                p.AnimeType = AnimeTypes.AnimeSerie.ToString();
                if (ser.AniDBAnime.AniDBAnime.Restricted > 0)
                {
                    p.ContentRating = "R";
                }
                p.Title   = aser.GetSeriesName();
                p.Summary = SummaryFromAnimeContract(ser);
                p.Type    = "show";
                p.AirDate = DateTime.MinValue;
                TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
                if (anime.GetAllTags().Count > 0)
                {
                    p.Genres = new List <Tag>();
                    anime.GetAllTags()
                    .ToList()
                    .ForEach(a => p.Genres.Add(new Tag {
                        Value = textInfo.ToTitleCase(a.Trim())
                    }));
                }
                //p.OriginalTitle
                if (anime.AirDate.HasValue)
                {
                    p.AirDate = anime.AirDate.Value;
                    p.OriginallyAvailableAt = anime.AirDate.Value.ToPlexDate();
                    p.Year = anime.AirDate.Value.Year;
                }
                p.LeafCount = anime.EpisodeCount;
                //p.ChildCount = p.LeafCount;
                p.ViewedLeafCount = ser.WatchedEpisodeCount;
                p.Rating          = (int)Math.Round((anime.Rating / 100D), 1);
                AniDB_Vote vote = RepoFactory.AniDB_Vote.GetByEntityAndType(anidb.AnimeID, AniDBVoteType.Anime) ??
                                  RepoFactory.AniDB_Vote.GetByEntityAndType(anidb.AnimeID, AniDBVoteType.AnimeTemp);
                if (vote != null)
                {
                    p.UserRating = (int)(vote.VoteValue / 100D);
                }

                List <CrossRef_AniDB_TvDBV2> ls = ser.CrossRefAniDBTvDBV2;
                if (ls != null && ls.Count > 0)
                {
                    foreach (CrossRef_AniDB_TvDBV2 c in ls)
                    {
                        if (c.TvDBSeasonNumber == 0)
                        {
                            continue;
                        }
                        p.Season = c.TvDBSeasonNumber.ToString();
                        p.Index  = c.TvDBSeasonNumber;
                    }
                }
                p.Thumb = p.ParentThumb = anime.DefaultImagePoster.GenPoster(null);
                p.Art   = anime?.DefaultImageFanart?.GenArt(null);
                if (anime?.Fanarts != null)
                {
                    p.Fanarts = new List <Contract_ImageDetails>();
                    anime.Fanarts.ForEach(
                        a =>
                        p.Fanarts.Add(new Contract_ImageDetails
                    {
                        ImageID   = a.AniDB_Anime_DefaultImageID,
                        ImageType = a.ImageType
                    }));
                }
                if (anime?.Banners != null)
                {
                    p.Banners = new List <Contract_ImageDetails>();
                    anime.Banners.ForEach(
                        a =>
                        p.Banners.Add(new Contract_ImageDetails
                    {
                        ImageID   = a.AniDB_Anime_DefaultImageID,
                        ImageType = a.ImageType
                    }));
                }

                if (eps != null)
                {
                    List <EpisodeType> types = eps.Keys.Where(a => a.AniDB_Episode != null)
                                               .Select(a => a.EpisodeTypeEnum).Distinct().ToList();
                    p.ChildCount = types.Count > 1 ? types.Count : eps.Keys.Count;
                }
                p.Roles = new List <RoleTag>();

                //TODO Character implementation is limited in JMM, One Character, could have more than one Seiyuu
                if (anime.Characters != null)
                {
                    foreach (CL_AniDB_Character c in anime.Characters)
                    {
                        string       ch     = c?.CharName;
                        AniDB_Seiyuu seiyuu = c?.Seiyuu;
                        if (String.IsNullOrEmpty(ch))
                        {
                            continue;
                        }
                        RoleTag t = new RoleTag
                        {
                            Value = seiyuu?.SeiyuuName
                        };
                        if (seiyuu != null)
                        {
                            t.TagPicture = ConstructSeiyuuImage(null, seiyuu.AniDB_SeiyuuID);
                        }
                        t.Role            = ch;
                        t.RoleDescription = c?.CharDescription;
                        t.RolePicture     = ConstructCharacterImage(null, c.CharID);
                        p.Roles.Add(t);
                    }
                }
                p.Titles = new List <AnimeTitle>();
                foreach (AniDB_Anime_Title title in anidb.GetTitles())
                {
                    p.Titles.Add(
                        new AnimeTitle {
                        Language = title.Language, Title = title.Title, Type = title.TitleType
                    });
                }
            }
        }
Example #6
0
        public static Serie GenerateFromAniDB_Anime(NancyContext ctx, SVR_AniDB_Anime anime, bool nocast, bool notag, bool allpics, int pic, TagFilter.Filter tagfilter)
        {
            Serie sr = new Serie
            {
                // 0 will load all
                id      = -1,
                aid     = anime.AnimeID,
                summary = anime.Description,
                rating  = Math.Round(anime.Rating / 100D, 1)
                          .ToString(CultureInfo.InvariantCulture),
                votes   = anime.VoteCount.ToString(),
                name    = anime.MainTitle,
                ismovie = anime.AnimeType == (int)AnimeType.Movie ? 1 : 0
            };

            if (anime.AirDate != null)
            {
                sr.year = anime.AirDate.Value.Year.ToString();
                var airdate = anime.AirDate.Value;
                if (airdate != DateTime.MinValue)
                {
                    sr.air = airdate.ToPlexDate();
                }
            }

            AniDB_Vote vote = RepoFactory.AniDB_Vote.GetByEntityAndType(anime.AnimeID, AniDBVoteType.Anime) ??
                              RepoFactory.AniDB_Vote.GetByEntityAndType(anime.AnimeID, AniDBVoteType.AnimeTemp);

            if (vote != null)
            {
                sr.userrating = Math.Round(vote.VoteValue / 100D, 1).ToString(CultureInfo.InvariantCulture);
            }
            sr.titles = anime.GetTitles().Select(title =>
                                                 new AnimeTitle {
                Language = title.Language, Title = title.Title, Type = title.TitleType
            }).ToList();

            PopulateArtFromAniDBAnime(ctx, anime, sr, allpics, pic);

            if (!nocast)
            {
                var xref_animestaff = RepoFactory.CrossRef_Anime_Staff.GetByAnimeIDAndRoleType(anime.AnimeID,
                                                                                               StaffRoleType.Seiyuu);
                foreach (var xref in xref_animestaff)
                {
                    if (xref.RoleID == null)
                    {
                        continue;
                    }
                    var character = RepoFactory.AnimeCharacter.GetByID(xref.RoleID.Value);
                    if (character == null)
                    {
                        continue;
                    }
                    var staff = RepoFactory.AnimeStaff.GetByID(xref.StaffID);
                    if (staff == null)
                    {
                        continue;
                    }
                    var role = new Role
                    {
                        character       = character.Name,
                        character_image = APIHelper.ConstructImageLinkFromTypeAndId(ctx, (int)ImageEntityType.Character,
                                                                                    xref.RoleID.Value),
                        staff       = staff.Name,
                        staff_image = APIHelper.ConstructImageLinkFromTypeAndId(ctx, (int)ImageEntityType.Staff,
                                                                                xref.StaffID),
                        role = xref.Role,
                        type = ((StaffRoleType)xref.RoleType).ToString()
                    };
                    if (sr.roles == null)
                    {
                        sr.roles = new List <Role>();
                    }
                    sr.roles.Add(role);
                }
            }

            if (!notag)
            {
                var tags = anime.GetAllTags();
                if (tags != null)
                {
                    sr.tags = TagFilter.ProcessTags(tagfilter, tags.ToList());
                }
            }

            return(sr);
        }
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_TraktSearchAnime: {0}", AnimeID);

            try
            {
                using (var session = DatabaseFactory.SessionFactory.OpenSession())
                {
                    ISessionWrapper sessionWrapper = session.Wrap();
                    bool            doReturn       = false;

                    // first check if the user wants to use the web cache
                    if (ServerSettings.WebCache_Trakt_Get)
                    {
                        try
                        {
                            List <Azure_CrossRef_AniDB_Trakt> contracts =
                                new List <Azure_CrossRef_AniDB_Trakt>();

                            List <Azure_CrossRef_AniDB_Trakt> resultsCache =
                                AzureWebAPI.Get_CrossRefAniDBTrakt(AnimeID);
                            if (resultsCache != null && resultsCache.Count > 0)
                            {
                                foreach (Azure_CrossRef_AniDB_Trakt xref in resultsCache)
                                {
                                    TraktV2ShowExtended showInfo = TraktTVHelper.GetShowInfoV2(xref.TraktID);
                                    if (showInfo == null)
                                    {
                                        continue;
                                    }

                                    logger.Trace("Found trakt match on web cache for {0} - id = {1}", AnimeID,
                                                 showInfo.title);
                                    TraktTVHelper.LinkAniDBTrakt(AnimeID,
                                                                 (EpisodeType)xref.AniDBStartEpisodeType,
                                                                 xref.AniDBStartEpisodeNumber,
                                                                 xref.TraktID, xref.TraktSeasonNumber, xref.TraktStartEpisodeNumber, true);
                                    doReturn = true;
                                }
                                if (doReturn)
                                {
                                    return;
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex, ex.ToString());
                        }
                    }


                    // lets try to see locally if we have a tvDB link for this anime
                    // Trakt allows the use of TvDB ID's or their own Trakt ID's
                    List <CrossRef_AniDB_TvDBV2> xrefTvDBs = RepoFactory.CrossRef_AniDB_TvDBV2.GetByAnimeID(AnimeID);
                    if (xrefTvDBs != null && xrefTvDBs.Count > 0)
                    {
                        foreach (CrossRef_AniDB_TvDBV2 tvXRef in xrefTvDBs)
                        {
                            // first search for this show by the TvDB ID
                            List <TraktV2SearchTvDBIDShowResult> searchResults =
                                TraktTVHelper.SearchShowByIDV2(TraktSearchIDType.tvdb,
                                                               tvXRef.TvDBID.ToString());
                            if (searchResults == null || searchResults.Count <= 0)
                            {
                                continue;
                            }
                            // since we are searching by ID, there will only be one 'show' result
                            TraktV2Show resShow = null;
                            foreach (TraktV2SearchTvDBIDShowResult res in searchResults)
                            {
                                if (res.ResultType != SearchIDType.Show)
                                {
                                    continue;
                                }
                                resShow = res.show;
                                break;
                            }

                            if (resShow == null)
                            {
                                continue;
                            }

                            TraktV2ShowExtended showInfo = TraktTVHelper.GetShowInfoV2(resShow.ids.slug);
                            if (showInfo?.ids == null)
                            {
                                continue;
                            }

                            // make sure the season specified by TvDB also exists on Trakt
                            Trakt_Show traktShow =
                                RepoFactory.Trakt_Show.GetByTraktSlug(session, showInfo.ids.slug);
                            if (traktShow == null)
                            {
                                continue;
                            }

                            Trakt_Season traktSeason = RepoFactory.Trakt_Season.GetByShowIDAndSeason(
                                session,
                                traktShow.Trakt_ShowID,
                                tvXRef.TvDBSeasonNumber);
                            if (traktSeason == null)
                            {
                                continue;
                            }

                            logger.Trace("Found trakt match using TvDBID locally {0} - id = {1}",
                                         AnimeID, showInfo.title);
                            TraktTVHelper.LinkAniDBTrakt(AnimeID,
                                                         (EpisodeType)tvXRef.AniDBStartEpisodeType,
                                                         tvXRef.AniDBStartEpisodeNumber, showInfo.ids.slug,
                                                         tvXRef.TvDBSeasonNumber, tvXRef.TvDBStartEpisodeNumber,
                                                         true);
                            doReturn = true;
                        }
                        if (doReturn)
                        {
                            return;
                        }
                    }

                    // Use TvDB setting due to similarity
                    if (!ServerSettings.TvDB_AutoLink)
                    {
                        return;
                    }

                    // finally lets try searching Trakt directly
                    string          searchCriteria = string.Empty;
                    SVR_AniDB_Anime anime          = RepoFactory.AniDB_Anime.GetByAnimeID(sessionWrapper, AnimeID);
                    if (anime == null)
                    {
                        return;
                    }

                    searchCriteria = anime.MainTitle;

                    // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                    List <TraktV2SearchShowResult> results = TraktTVHelper.SearchShowV2(searchCriteria);
                    logger.Trace("Found {0} trakt results for {1} ", results.Count, searchCriteria);
                    if (ProcessSearchResults(session, results, searchCriteria))
                    {
                        return;
                    }


                    if (results.Count != 0)
                    {
                        return;
                    }

                    foreach (AniDB_Anime_Title title in anime.GetTitles())
                    {
                        if (!string.Equals(title.TitleType, Shoko.Models.Constants.AnimeTitleType.Official, StringComparison.InvariantCultureIgnoreCase))
                        {
                            continue;
                        }

                        if (string.Equals(searchCriteria, title.Title, StringComparison.InvariantCultureIgnoreCase))
                        {
                            continue;
                        }

                        results = TraktTVHelper.SearchShowV2(searchCriteria);
                        logger.Trace("Found {0} trakt results for search on {1}", results.Count, title.Title);
                        if (ProcessSearchResults(session, results, title.Title))
                        {
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_TvDBSearchAnime: {0} - {1}", AnimeID, ex);
            }
        }
Example #8
0
        public override void Run(IProgress <ICommand> progress = null)
        {
            logger.Info("Processing CommandRequest_TraktSearchAnime: {0}", AnimeID);

            try
            {
                ReportInit(progress);
                bool doReturn = false;

                // first check if the user wants to use the web cache
                if (ServerSettings.Instance.WebCache.Trakt_Get)
                {
                    try
                    {
                        List <WebCache_CrossRef_AniDB_Provider> resultsCache = WebCacheAPI.Instance.GetCrossRef_AniDB_Provider(AnimeID, CrossRefType.TraktTV);
                        ReportUpdate(progress, 30);
                        if (resultsCache != null && resultsCache.Count > 0)
                        {
                            List <WebCache_CrossRef_AniDB_Provider> best = resultsCache.BestProvider();
                            if (best.Count > 0)
                            {
                                TraktTVHelper.RemoveAllAniDBTraktLinks(AnimeID, false);
                                ReportUpdate(progress, 70);
                                foreach (WebCache_CrossRef_AniDB_Provider xref in best)
                                {
                                    TraktTVHelper.LinkAniDBTraktFromWebCache(xref);
                                }
                                SVR_AniDB_Anime.UpdateStatsByAnimeID(AnimeID);
                                logger.Trace("Changed trakt association: {0}", AnimeID);
                                ReportFinish(progress);
                                return;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex, ex.ToString());
                    }
                }


                // lets try to see locally if we have a tvDB link for this anime
                // Trakt allows the use of TvDB ID's or their own Trakt ID's
                List <SVR_CrossRef_AniDB_Provider>
                xrefTvDBs = Repo.Instance.CrossRef_AniDB_Provider.GetByAnimeIDAndType(AnimeID, CrossRefType.TvDB);
                if (xrefTvDBs != null && xrefTvDBs.Count > 0)
                {
                    foreach (SVR_CrossRef_AniDB_Provider tvXRef in xrefTvDBs)
                    {
                        // first search for this show by the TvDB ID
                        List <TraktV2SearchTvDBIDShowResult> searchResults = TraktTVHelper.SearchShowByIDV2(TraktSearchIDType.tvdb, tvXRef.CrossRefID);
                        if (searchResults == null || searchResults.Count <= 0)
                        {
                            continue;
                        }
                        // since we are searching by ID, there will only be one 'show' result
                        TraktV2Show resShow = null;
                        foreach (TraktV2SearchTvDBIDShowResult res in searchResults)
                        {
                            if (res.ResultType != SearchIDType.Show)
                            {
                                continue;
                            }
                            resShow = res.show;
                            break;
                        }

                        if (resShow == null)
                        {
                            continue;
                        }

                        TraktV2ShowExtended showInfo = TraktTVHelper.GetShowInfoV2(resShow.ids.slug);
                        if (showInfo?.ids == null)
                        {
                            continue;
                        }

                        // make sure the season specified by TvDB also exists on Trakt
                        Trakt_Show traktShow =
                            Repo.Instance.Trakt_Show.GetByTraktSlug(showInfo.ids.slug);
                        if (traktShow == null)
                        {
                            continue;
                        }

                        Trakt_Season traktSeason = Repo.Instance.Trakt_Season.GetByShowIDAndSeason(traktShow.Trakt_ShowID, tvXRef.GetEpisodesWithOverrides().FirstOrDefault()?.Season ?? 0);
                        if (traktSeason == null)
                        {
                            continue;
                        }

                        logger.Trace("Found trakt match using TvDBID locally {0} - id = {1}",
                                     AnimeID, showInfo.title);
                        TraktTVHelper.LinkAniDBTrakt(AnimeID, showInfo.ids.slug, true);
                        doReturn = true;
                        ReportUpdate(progress, 60);
                    }
                    if (doReturn)
                    {
                        ReportFinish(progress);
                        return;
                    }
                }

                // Use TvDB setting due to similarity
                if (!ServerSettings.Instance.TvDB.AutoLink)
                {
                    ReportFinish(progress);
                    return;
                }

                // finally lets try searching Trakt directly
                SVR_AniDB_Anime anime = Repo.Instance.AniDB_Anime.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    ReportFinish(progress);
                    return;
                }

                var searchCriteria = anime.MainTitle;

                // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                List <TraktV2SearchShowResult> results = TraktTVHelper.SearchShowV2(searchCriteria);
                logger.Trace("Found {0} trakt results for {1} ", results.Count, searchCriteria);
                if (ProcessSearchResults(results, searchCriteria))
                {
                    ReportFinish(progress);
                    return;
                }

                if (results.Count != 0)
                {
                    ReportFinish(progress);
                    return;
                }

                ReportUpdate(progress, 80);
                foreach (AniDB_Anime_Title title in anime.GetTitles())
                {
                    if (!string.Equals(title.TitleType, Shoko.Models.Constants.AnimeTitleType.Official, StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }

                    if (string.Equals(searchCriteria, title.Title, StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }

                    results = TraktTVHelper.SearchShowV2(searchCriteria);
                    logger.Trace("Found {0} trakt results for search on {1}", results.Count, title.Title);
                    if (ProcessSearchResults(results, title.Title))
                    {
                        ReportFinish(progress);
                        return;
                    }
                }

                ReportFinish(progress);
            }
            catch (Exception ex)
            {
                ReportError(progress, $"Error processing CommandRequest_TvDBSearchAnime: {AnimeID} - {ForceRefresh} - {ex}", ex);
            }
        }
Example #9
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_TvDBSearchAnime: {0}", AnimeID);

            try
            {
                using (var session = DatabaseFactory.SessionFactory.OpenSession())
                {
                    // first check if the user wants to use the web cache
                    if (ServerSettings.WebCache_TvDB_Get)
                    {
                        try
                        {
                            List <Azure_CrossRef_AniDB_TvDB> cacheResults =
                                AzureWebAPI.Get_CrossRefAniDBTvDB(AnimeID);
                            if (cacheResults != null && cacheResults.Count > 0)
                            {
                                // check again to see if there are any links, user may have manually added links while
                                // this command was in the queue
                                List <CrossRef_AniDB_TvDBV2> xrefTemp =
                                    RepoFactory.CrossRef_AniDB_TvDBV2.GetByAnimeID(AnimeID);
                                if (xrefTemp != null && xrefTemp.Count > 0)
                                {
                                    return;
                                }

                                foreach (Azure_CrossRef_AniDB_TvDB xref in cacheResults)
                                {
                                    TvDB_Series tvser = TvDBApiHelper.GetSeriesInfoOnline(xref.TvDBID, false);
                                    if (tvser != null)
                                    {
                                        logger.Trace("Found tvdb match on web cache for {0}", AnimeID);
                                        TvDBApiHelper.LinkAniDBTvDB(AnimeID,
                                                                    (EpisodeType)xref.AniDBStartEpisodeType,
                                                                    xref.AniDBStartEpisodeNumber,
                                                                    xref.TvDBID, xref.TvDBSeasonNumber,
                                                                    xref.TvDBStartEpisodeNumber, true, true);
                                    }
                                }
                                return;
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }

                    if (!ServerSettings.TvDB_AutoLink)
                    {
                        return;
                    }

                    string          searchCriteria = string.Empty;
                    SVR_AniDB_Anime anime          = RepoFactory.AniDB_Anime.GetByAnimeID(AnimeID);
                    if (anime == null)
                    {
                        return;
                    }

                    searchCriteria = anime.MainTitle;

                    // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                    List <TVDB_Series_Search_Response> results = TvDBApiHelper.SearchSeries(searchCriteria);
                    logger.Trace("Found {0} tvdb results for {1} on TheTvDB", results.Count, searchCriteria);
                    if (ProcessSearchResults(results, searchCriteria))
                    {
                        return;
                    }


                    if (results.Count == 0)
                    {
                        bool foundResult = false;
                        foreach (AniDB_Anime_Title title in anime.GetTitles())
                        {
                            if (!title.TitleType.Equals(Shoko.Models.Constants.AnimeTitleType.Official, StringComparison.InvariantCultureIgnoreCase))
                            {
                                continue;
                            }
                            if (!title.Language.Equals(Shoko.Models.Constants.AniDBLanguageType.English,
                                                       StringComparison.InvariantCultureIgnoreCase) &&
                                !title.Language.Equals(Shoko.Models.Constants.AniDBLanguageType.Romaji,
                                                       StringComparison.InvariantCultureIgnoreCase))
                            {
                                continue;
                            }

                            if (searchCriteria.Equals(title.Title, StringComparison.InvariantCultureIgnoreCase))
                            {
                                continue;
                            }

                            searchCriteria = title.Title;
                            results        = TvDBApiHelper.SearchSeries(searchCriteria);
                            if (results.Count > 0)
                            {
                                foundResult = true;
                            }
                            logger.Trace("Found {0} tvdb results for search on {1}", results.Count, title.Title);
                            if (ProcessSearchResults(results, title.Title))
                            {
                                return;
                            }
                        }
                        if (!foundResult)
                        {
                            logger.Warn("Unable to find a matching TvDB series for {0}", anime.MainTitle);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_TvDBSearchAnime: {0} - {1}", AnimeID, ex);
            }
        }
Example #10
0
        public void GenerateFromAniDB_Anime(HttpContext ctx, SVR_AniDB_Anime anime)
        {
            anidb_id   = anime.AnimeID;
            restricted = anime.Restricted == 1;
            if (ctx.Items.ContainsKey("description"))
            {
                description = new List <Description>
                {
                    new Description {
                        source = "AniDB", language = "en", description = anime.Description
                    }
                };
            }

            ratings = new List <Rating>
            {
                new Rating
                {
                    source     = "AniDB",
                    rating     = (decimal)anime.Rating / 10,
                    max_rating = 100,
                    votes      = anime.VoteCount
                }
            };
            name        = anime.MainTitle;
            series_type = anime.AnimeType.ToString();

            if (anime.AirDate != null)
            {
                var airdate = anime.AirDate.Value;
                if (airdate != DateTime.MinValue)
                {
                    air_date = airdate.ToString("yyyy-MM-dd");
                }
            }
            if (anime.EndDate != null)
            {
                var enddate = anime.EndDate.Value;
                if (enddate != DateTime.MinValue)
                {
                    end_date = enddate.ToString("yyyy-MM-dd");
                }
            }

            AniDB_Vote vote = Repo.Instance.AniDB_Vote.GetByEntityAndType(anime.AnimeID, AniDBVoteType.Anime) ??
                              Repo.Instance.AniDB_Vote.GetByEntityAndType(anime.AnimeID, AniDBVoteType.AnimeTemp);

            if (vote != null)
            {
                string voteType = (AniDBVoteType)vote.VoteType == AniDBVoteType.Anime ? "Permanent" : "Temporary";
                user_rating = new Rating
                {
                    rating = (decimal)Math.Round(vote.VoteValue / 100D, 1), max_rating = 10, type = voteType,
                    source = "User"
                };
            }

            if (ctx.Items.ContainsKey("titles"))
            {
                titles = anime.GetTitles().Select(title => new Title
                {
                    language = title.Language, title = title.Title, type = title.TitleType
                }).ToList();
            }

            PopulateArtFromAniDBAnime(ctx, anime);

            if (ctx.Items.ContainsKey("cast"))
            {
                var xref_animestaff = Repo.Instance.CrossRef_Anime_Staff.GetByAnimeIDAndRoleType(anime.AnimeID,
                                                                                                 StaffRoleType.Seiyuu);
                foreach (var xref in xref_animestaff)
                {
                    if (xref.RoleID == null)
                    {
                        continue;
                    }
                    AnimeCharacter character = Repo.Instance.AnimeCharacter.GetByID(xref.RoleID.Value);
                    if (character == null)
                    {
                        continue;
                    }
                    AnimeStaff staff = Repo.Instance.AnimeStaff.GetByID(xref.StaffID);
                    if (staff == null)
                    {
                        continue;
                    }
                    Role role = new Role
                    {
                        character = new Role.Person
                        {
                            name        = character.Name, alternate_name = character.AlternateName,
                            image       = new Image(ctx, xref.RoleID.Value, ImageEntityType.Character),
                            description = character.Description
                        },
                        staff = new Role.Person
                        {
                            name           = staff.Name,
                            alternate_name = staff.AlternateName,
                            description    = staff.Description,
                            image          = new Image(ctx, xref.StaffID, ImageEntityType.Staff),
                        },
                        role         = ((StaffRoleType)xref.RoleType).ToString(),
                        role_details = xref.Role
                    };
                    if (cast == null)
                    {
                        cast = new List <Role>();
                    }
                    cast.Add(role);
                }
            }

            if (ctx.Items.ContainsKey("tags"))
            {
                var animeTags = anime.GetAllTags();
                if (animeTags != null)
                {
                    if (!ctx.Items.TryGetValue("tagfilter", out object tagfilter))
                    {
                        tagfilter = 0;
                    }
                    tags = TagFilter.ProcessTags((TagFilter.Filter)tagfilter, animeTags.ToList());
                }
            }
        }
        public override void Run(IProgress <ICommand> progress = null)
        {
            logger.Info("Processing CommandRequest_MovieDBSearchAnime: {0}", AnimeID);

            try
            {
                {
                    ReportInit(progress);
                    // first check if the user wants to use the web cache
                    if (ServerSettings.Instance.WebCache.TvDB_Get)
                    {
                        try
                        {
                            List <WebCache_CrossRef_AniDB_Provider> resultsCache = WebCacheAPI.Instance.GetCrossRef_AniDB_Provider(AnimeID, CrossRefType.MovieDB);
                            ReportUpdate(progress, 30);
                            if (resultsCache != null && resultsCache.Count > 0)
                            {
                                List <WebCache_CrossRef_AniDB_Provider> best = resultsCache.BestProvider();
                                if (best.Count > 0)
                                {
                                    int           movieID = int.Parse(best.First().CrossRefID);
                                    MovieDB_Movie movie   = Repo.Instance.MovieDb_Movie.GetByOnlineID(movieID);
                                    if (movie == null)
                                    {
                                        // update the info from online
                                        MovieDBHelper.UpdateMovieInfo(movieID, true);
                                        movie = Repo.Instance.MovieDb_Movie.GetByOnlineID(movieID);
                                    }
                                    ReportUpdate(progress, 20);

                                    if (movie != null)
                                    {
                                        // since we are using the web cache result, let's save it
                                        MovieDBHelper.LinkAniDBMovieDB(AnimeID, movieID, true);
                                        ReportFinish(progress);
                                        return;
                                    }
                                    return;
                                }
                            }
                        }
                        catch (Exception)
                        {
                            //Ignore
                        }
                    }

                    // Use TvDB setting
                    if (!ServerSettings.Instance.TvDB.AutoLink)
                    {
                        ReportFinish(progress);
                        return;
                    }

                    ReportUpdate(progress, 40);

                    SVR_AniDB_Anime anime = Repo.Instance.AniDB_Anime.GetByAnimeID(AnimeID);
                    if (anime == null)
                    {
                        ReportFinish(progress);
                        return;
                    }

                    string searchCriteria = anime.MainTitle;

                    // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                    List <MovieDB_Movie_Result> results = MovieDBHelper.Search(searchCriteria);
                    logger.Trace("Found {0} moviedb results for {1} on TheTvDB", results.Count, searchCriteria);
                    ReportUpdate(progress, 60);
                    if (ProcessSearchResults(results, searchCriteria))
                    {
                        ReportFinish(progress);
                        return;
                    }

                    ReportUpdate(progress, 80);

                    if (results.Count == 0)
                    {
                        foreach (AniDB_Anime_Title title in anime.GetTitles())
                        {
                            if (!string.Equals(title.TitleType, Shoko.Models.Constants.AnimeTitleType.Official, StringComparison.OrdinalIgnoreCase))
                            {
                                continue;
                            }

                            if (string.Equals(searchCriteria, title.Title, StringComparison.OrdinalIgnoreCase))
                            {
                                continue;
                            }

                            results = MovieDBHelper.Search(title.Title);
                            logger.Trace("Found {0} moviedb results for search on {1}", results.Count, title.Title);
                            if (ProcessSearchResults(results, title.Title))
                            {
                                ReportFinish(progress);
                                return;
                            }
                        }
                    }

                    ReportFinish(progress);
                }
            }
            catch (Exception ex)
            {
                ReportError(progress, $"Error processing CommandRequest_TvDBSearchAnime: {AnimeID} - {ex}", ex);
            }
        }
Example #12
0
        public override void Run(IProgress <ICommand> progress = null)
        {
            logger.Info("Processing CommandRequest_TvDBSearchAnime: {0}", AnimeID);

            try
            {
                ReportInit(progress);
                // first check if the user wants to use the web cache
                if (ServerSettings.Instance.WebCache.TvDB_Get)
                {
                    try
                    {
                        List <WebCache_CrossRef_AniDB_Provider> resultsCache = WebCacheAPI.Instance.GetCrossRef_AniDB_Provider(AnimeID, CrossRefType.TvDB);
                        ReportUpdate(progress, 30);
                        if (resultsCache != null && resultsCache.Count > 0)
                        {
                            List <WebCache_CrossRef_AniDB_Provider> best = resultsCache.BestProvider();
                            if (best.Count > 0)
                            {
                                TvDBApiHelper.RemoveAllAniDBTvDBLinks(AnimeID, false);
                                ReportUpdate(progress, 70);
                                foreach (WebCache_CrossRef_AniDB_Provider xref in best)
                                {
                                    TvDBApiHelper.LinkAniDBTvDBFromWebCache(xref);
                                }
                                SVR_AniDB_Anime.UpdateStatsByAnimeID(AnimeID);
                                logger.Trace("Changed trakt association: {0}", AnimeID);
                                ReportFinish(progress);
                                return;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex, ex.ToString());
                    }
                }

                if (!ServerSettings.Instance.TvDB.AutoLink)
                {
                    ReportFinish(progress);
                    return;
                }

                // try to pull a link from a prequel/sequel
                var    relations = Repo.Instance.AniDB_Anime_Relation.GetFullLinearRelationTree(AnimeID);
                string tvDBID    = relations.SelectMany(a => Repo.Instance.CrossRef_AniDB_Provider.GetByAnimeIDAndType(a, CrossRefType.TvDB))
                                   .FirstOrDefault(a => a != null)?.CrossRefID;
                ReportUpdate(progress, 25);

                if (tvDBID != null)
                {
                    TvDBApiHelper.LinkAniDBTvDB(AnimeID, int.Parse(tvDBID), true);
                    ReportFinish(progress);
                    return;
                }
                ReportUpdate(progress, 50);

                // search TvDB
                SVR_AniDB_Anime anime = Repo.Instance.AniDB_Anime.GetByAnimeID(AnimeID);
                if (anime == null)
                {
                    ReportFinish(progress);
                    return;
                }

                var searchCriteria = anime.MainTitle;

                // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                List <TVDB_Series_Search_Response> results = TvDBApiHelper.SearchSeries(searchCriteria);
                logger.Trace("Found {0} tvdb results for {1} on TheTvDB", results.Count, searchCriteria);
                if (ProcessSearchResults(results, searchCriteria))
                {
                    ReportFinish(progress);
                    return;
                }


                if (results.Count != 0)
                {
                    ReportFinish(progress);
                    return;
                }

                bool foundResult = false;
                ReportUpdate(progress, 75);
                foreach (AniDB_Anime_Title title in anime.GetTitles())
                {
                    if (!title.TitleType.Equals(Shoko.Models.Constants.AnimeTitleType.Official, StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }
                    if (!title.Language.Equals(Shoko.Models.Constants.AniDBLanguageType.English,
                                               StringComparison.InvariantCultureIgnoreCase) &&
                        !title.Language.Equals(Shoko.Models.Constants.AniDBLanguageType.Romaji,
                                               StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }

                    if (searchCriteria.Equals(title.Title, StringComparison.InvariantCultureIgnoreCase))
                    {
                        continue;
                    }

                    searchCriteria = title.Title;
                    results        = TvDBApiHelper.SearchSeries(searchCriteria);
                    if (results.Count > 0)
                    {
                        foundResult = true;
                    }
                    logger.Trace("Found {0} tvdb results for search on {1}", results.Count, title.Title);
                    if (ProcessSearchResults(results, title.Title))
                    {
                        ReportFinish(progress);
                        return;
                    }
                }
                if (!foundResult)
                {
                    logger.Warn("Unable to find a matching TvDB series for {0}", anime.MainTitle);
                }
                ReportFinish(progress);
            }
            catch (Exception ex)
            {
                ReportError(progress, $"Error processing CommandRequest_TvDBSearchAnime: {AnimeID} - {ex}", ex);
            }
        }
Example #13
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_TvDBSearchAnime: {0}", AnimeID);

            try
            {
                using (var session = DatabaseFactory.SessionFactory.OpenSession())
                {
                    // first check if the user wants to use the web cache
                    if (ServerSettings.WebCache_TvDB_Get)
                    {
                        try
                        {
                            List <Azure_CrossRef_AniDB_TvDB> cacheResults =
                                AzureWebAPI.Get_CrossRefAniDBTvDB(AnimeID);
                            if (cacheResults != null && cacheResults.Count > 0)
                            {
                                // check again to see if there are any links, user may have manually added links while
                                // this command was in the queue
                                List <CrossRef_AniDB_TvDBV2> xrefTemp =
                                    RepoFactory.CrossRef_AniDB_TvDBV2.GetByAnimeID(AnimeID);
                                if (xrefTemp != null && xrefTemp.Count > 0)
                                {
                                    return;
                                }

                                foreach (Azure_CrossRef_AniDB_TvDB xref in cacheResults)
                                {
                                    TvDB_Series tvser = TvDBHelper.GetSeriesInfoOnline(xref.TvDBID);
                                    if (tvser != null)
                                    {
                                        logger.Trace("Found tvdb match on web cache for {0}", AnimeID);
                                        TvDBHelper.LinkAniDBTvDB(AnimeID,
                                                                 (enEpisodeType)xref.AniDBStartEpisodeType,
                                                                 xref.AniDBStartEpisodeNumber,
                                                                 xref.TvDBID, xref.TvDBSeasonNumber,
                                                                 xref.TvDBStartEpisodeNumber, true, true);
                                    }
                                    else
                                    {
                                        //if we got a TvDB ID from the web cache, but couldn't find it on TheTvDB.com, it could mean 2 things
                                        //1. thetvdb.com is offline
                                        //2. the id is no longer valid
                                        // if the id is no longer valid we should remove it from the web cache

                                        /*if (TvDBHelper.ConfirmTvDBOnline())
                                         *                                      {
                                         *
                                         *                                      }*/
                                    }
                                }
                                return;
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }

                    string          searchCriteria = "";
                    SVR_AniDB_Anime anime          = RepoFactory.AniDB_Anime.GetByAnimeID(AnimeID);
                    if (anime == null)
                    {
                        return;
                    }

                    searchCriteria = anime.MainTitle;

                    // if not wanting to use web cache, or no match found on the web cache go to TvDB directly
                    List <TVDB_Series_Search_Response> results = ShokoService.TvdbHelper.SearchSeries(searchCriteria);
                    logger.Trace("Found {0} tvdb results for {1} on TheTvDB", results.Count, searchCriteria);
                    if (ProcessSearchResults(results, searchCriteria))
                    {
                        return;
                    }


                    if (results.Count == 0)
                    {
                        foreach (AniDB_Anime_Title title in anime.GetTitles())
                        {
                            if (title.TitleType.ToUpper() != Shoko.Models.Constants.AnimeTitleType.Official.ToUpper())
                            {
                                continue;
                            }

                            if (searchCriteria.ToUpper() == title.Title.ToUpper())
                            {
                                continue;
                            }

                            results = ShokoService.TvdbHelper.SearchSeries(title.Title);
                            logger.Trace("Found {0} tvdb results for search on {1}", results.Count, title.Title);
                            if (ProcessSearchResults(results, title.Title))
                            {
                                return;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_TvDBSearchAnime: {0} - {1}", AnimeID, ex.ToString());
                return;
            }
        }