public static void ScanForMatches() { if (string.IsNullOrEmpty(ServerSettings.MAL_Username) || string.IsNullOrEmpty(ServerSettings.MAL_Password)) { logger.Warn("Won't SCAN MAL, MAL credentials not provided"); return; } IReadOnlyList <AnimeSeries> allSeries = RepoFactory.AnimeSeries.GetAll(); foreach (AnimeSeries ser in allSeries) { AniDB_Anime anime = ser.GetAnime(); if (anime == null) { continue; } if (anime.IsMALLinkDisabled) { continue; } // don't scan if it is associated on the TvDB List <CrossRef_AniDB_MAL> xrefs = anime.GetCrossRefMAL(); if (xrefs == null || xrefs.Count == 0) { logger.Trace(string.Format("Found anime without MAL association: {0} ({1})", anime.AnimeID, anime.MainTitle)); CommandRequest_MALSearchAnime cmd = new CommandRequest_MALSearchAnime(ser.AniDB_ID, false); cmd.Save(); } } }
public override void ProcessCommand() { logger.Info("Processing CommandRequest_MALUpdatedWatchedStatus: {0}", AnimeID); try { // find the latest eps to update AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository(); AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID); if (anime == null) { return; } List <CrossRef_AniDB_MAL> crossRefs = anime.GetCrossRefMAL(); if (crossRefs == null || crossRefs.Count == 0) { return; } AnimeSeriesRepository repSeries = new AnimeSeriesRepository(); AnimeSeries ser = repSeries.GetByAnimeID(AnimeID); if (ser == null) { return; } MALHelper.UpdateMALSeries(ser); } catch (Exception ex) { logger.Error("Error processing CommandRequest_MALUpdatedWatchedStatus: {0} - {1}", AnimeID, ex.ToString()); return; } }