public static void Send_CrossRef_AniDB_MAL(JMMServer.Entities.CrossRef_AniDB_MAL data) { //if (!ServerSettings.WebCache_XRefFileEpisode_Send) return; string uri = string.Format(@"http://{0}/api/CrossRef_AniDB_MAL", azureHostBaseAddress); CrossRef_AniDB_MAL fhr = data.ToContractAzure(); string json = JSONHelper.Serialize <CrossRef_AniDB_MAL>(fhr); SendData(uri, json, "POST"); }
public void Save(CrossRef_AniDB_MAL obj) { using (var session = JMMService.SessionFactory.OpenSession()) { // populate the database using (var transaction = session.BeginTransaction()) { session.SaveOrUpdate(obj); transaction.Commit(); } } }
public CrossRef_AniDB_MALInput(CrossRef_AniDB_MAL xref) { this.AnimeID = xref.AnimeID; this.MALID = xref.MALID; this.CrossRefSource = xref.CrossRefSource; this.MALTitle = xref.MALTitle; this.StartEpisodeType = xref.StartEpisodeType; this.StartEpisodeNumber = xref.StartEpisodeNumber; this.Username = ServerSettings.AniDB_Username; if (ServerSettings.WebCache_Anonymous) this.Username = Constants.AnonWebCacheUsername; }
private int GetUpperEpisodeLimit(List<CrossRef_AniDB_MAL> crossRefs, CrossRef_AniDB_MAL xrefBase) { foreach (CrossRef_AniDB_MAL xref in crossRefs) { if (xref.StartEpisodeType == xrefBase.StartEpisodeType) { if (xref.StartEpisodeNumber > xrefBase.StartEpisodeNumber) return xref.StartEpisodeNumber - 1; } } return int.MaxValue; }
public static void Send_CrossRefAniDBMAL(JMMServer.Entities.CrossRef_AniDB_MAL data) { if (!ServerSettings.WebCache_MAL_Send) { return; } string uri = string.Format(@"http://{0}/api/CrossRef_AniDB_MAL", azureHostBaseAddress); CrossRef_AniDB_MALInput input = new CrossRef_AniDB_MALInput(data); string json = JSONHelper.Serialize <CrossRef_AniDB_MALInput>(input); SendData(uri, json, "POST"); }
// default constructor public AddCrossRef_AniDB_MALRequest(CrossRef_AniDB_MAL data) { this.AnimeID = data.AnimeID; this.MALID = data.MALID; this.StartEpisodeType = data.StartEpisodeType; this.StartEpisodeNumber = data.StartEpisodeNumber; string username = ServerSettings.AniDB_Username; if (ServerSettings.WebCache_Anonymous) username = Constants.AnonWebCacheUsername; this.Username = username; this.MALTitle = data.MALTitle; }
public override void ProcessCommand() { try { CrossRef_AniDB_MALRepository repCrossRef = new CrossRef_AniDB_MALRepository(); JMMServer.Entities.CrossRef_AniDB_MAL xref = repCrossRef.GetByID(CrossRef_AniDB_MALID); if (xref == null) { return; } AzureWebAPI.Send_CrossRefAniDBMAL(xref); } catch (Exception ex) { logger.ErrorException("Error processing CommandRequest_WebCacheSendXRefAniDBMAL: {0}" + ex.ToString(), ex); return; } }
public static void LinkAniDBMAL(int animeID, int malID, string malTitle, int epType, int epNumber, bool fromWebCache) { CrossRef_AniDB_MAL xrefTemp = RepoFactory.CrossRef_AniDB_MAL.GetByMALID(malID); if (xrefTemp != null) { string msg = string.Format("Not using MAL link as this MAL ID ({0}) is already in use by {1}", malID, xrefTemp.AnimeID); logger.Warn(msg); return; } CrossRef_AniDB_MAL xref = new CrossRef_AniDB_MAL(); xref.AnimeID = animeID; xref.MALID = malID; xref.MALTitle = malTitle; xref.StartEpisodeType = epType; xref.StartEpisodeNumber = epNumber; if (fromWebCache) xref.CrossRefSource = (int) CrossRefSource.WebCache; else xref.CrossRefSource = (int) CrossRefSource.User; RepoFactory.CrossRef_AniDB_MAL.Save(xref); AniDB_Anime.UpdateStatsByAnimeID(animeID); logger.Trace("Changed MAL association: {0}", animeID); CommandRequest_MALUpdatedWatchedStatus cmd = new CommandRequest_MALUpdatedWatchedStatus(animeID); cmd.Save(); CommandRequest_WebCacheSendXRefAniDBMAL req = new CommandRequest_WebCacheSendXRefAniDBMAL(xref.CrossRef_AniDB_MALID); req.Save(); }
public static void Send_CrossRef_AniDB_MAL(CrossRef_AniDB_MAL data) { if (!ServerSettings.WebCache_XRefFileEpisode_Send) return; string uri = string.Format("http://{0}/AddCrossRef_AniDB_MAL.aspx", ServerSettings.WebCache_Address); AddCrossRef_AniDB_MALRequest fhr = new AddCrossRef_AniDB_MALRequest(data); string xml = fhr.ToXML(); SendData(uri, xml); }