public static void LinkAniDBMovieDB(int animeID, int movieDBID, bool fromWebCache) { // check if we have this information locally // if not download it now MovieDB_Movie movie = RepoFactory.MovieDb_Movie.GetByOnlineID(movieDBID); if (movie == null) { // we download the series info here just so that we have the basic info in the // database before the queued task runs later UpdateMovieInfo(movieDBID, false); movie = RepoFactory.MovieDb_Movie.GetByOnlineID(movieDBID); if (movie == null) { return; } } // download and update series info and images UpdateMovieInfo(movieDBID, true); CrossRef_AniDB_Other xref = RepoFactory.CrossRef_AniDB_Other.GetByAnimeIDAndType(animeID, CrossRefType.MovieDB); if (xref == null) { xref = new CrossRef_AniDB_Other(); } xref.AnimeID = animeID; if (fromWebCache) { xref.CrossRefSource = (int)CrossRefSource.WebCache; } else { xref.CrossRefSource = (int)CrossRefSource.User; } xref.CrossRefType = (int)CrossRefType.MovieDB; xref.CrossRefID = movieDBID.ToString(); RepoFactory.CrossRef_AniDB_Other.Save(xref); SVR_AniDB_Anime.UpdateStatsByAnimeID(animeID); logger.Trace("Changed moviedb association: {0}", animeID); if (ServerSettings.Instance.WebCache.Enabled) { CommandRequest_WebCacheSendXRefAniDBOther req = new CommandRequest_WebCacheSendXRefAniDBOther(xref.CrossRef_AniDB_OtherID); req.Save(); } }
public static void LinkAniDBMovieDB(int animeID, int movieDBID, bool fromWebCache) { // check if we have this information locally // if not download it now MovieDB_Movie movie = Repo.Instance.MovieDb_Movie.GetByMovieID(movieDBID).FirstOrDefault(); if (movie == null) { // we download the series info here just so that we have the basic info in the // database before the queued task runs later UpdateMovieInfo(movieDBID, false); movie = Repo.Instance.MovieDb_Movie.GetByMovieID(movieDBID).FirstOrDefault(); if (movie == null) { return; } } // download and update series info and images UpdateMovieInfo(movieDBID, true); CrossRef_AniDB_Other xref; using (var upd = Repo.Instance.CrossRef_AniDB_Other.BeginAddOrUpdate(() => Repo.Instance.CrossRef_AniDB_Other.GetByAnimeIDAndType(animeID, CrossRefType.MovieDB))) { upd.Entity.AnimeID = animeID; if (fromWebCache) { upd.Entity.CrossRefSource = (int)CrossRefSource.WebCache; } else { upd.Entity.CrossRefSource = (int)CrossRefSource.User; } upd.Entity.CrossRefType = (int)CrossRefType.MovieDB; upd.Entity.CrossRefID = movieDBID.ToString(); xref = upd.Commit(); } SVR_AniDB_Anime.UpdateStatsByAnimeID(animeID); logger.Trace("Changed moviedb association: {0}", animeID); CommandRequest_WebCacheSendXRefAniDBOther req = new CommandRequest_WebCacheSendXRefAniDBOther(xref.CrossRef_AniDB_OtherID); req.Save(); }