コード例 #1
0
ファイル: AzureWebAPI.cs プロジェクト: dizzydezz/jmm
		public static void Send_AnimeXML(AnimeXML data)
		{
			//if (!ServerSettings.WebCache_XRefFileEpisode_Send) return;

			string uri = string.Format(@"http://{0}/api/animexml", azureHostBaseAddress);
			string json = JSONHelper.Serialize<AnimeXML>(data);
			SendData(uri, json, "POST");
		}
コード例 #2
0
        public static void Send_AnimeXML(AnimeXML data)
        {
            //if (!ServerSettings.WebCache_XRefFileEpisode_Send) return;

            string uri  = string.Format(@"http://{0}/api/animexml", azureHostBaseAddress);
            string json = JSONHelper.Serialize <AnimeXML>(data);

            SendData(uri, json, "POST");
        }
コード例 #3
0
		public override void ProcessCommand()
		{
			
			try
			{
				bool process = (ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
					ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase));

				if (!process) return;

				AniDB_AnimeRepository rep = new AniDB_AnimeRepository();
				AniDB_Anime anime = rep.GetByAnimeID(AnimeID);
				if (anime == null) return;

				string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
				string filePath = Path.Combine(appPath, "Anime_HTTP");

				if (!Directory.Exists(filePath))
					Directory.CreateDirectory(filePath);

				string fileName = string.Format("AnimeDoc_{0}.xml", AnimeID);
				string fileNameWithPath = Path.Combine(filePath, fileName);

				string rawXML = "";
				if (File.Exists(fileNameWithPath))
				{
					StreamReader re = File.OpenText(fileNameWithPath);
					rawXML = re.ReadToEnd();
					re.Close();
				}

				AnimeXML xml = new AnimeXML();
				xml.AnimeID = AnimeID;
				xml.AnimeName = anime.MainTitle;
				xml.DateDownloaded = 0;
				xml.Username = ServerSettings.AniDB_Username;
				xml.XMLContent = rawXML;

				AzureWebAPI.Send_AnimeXML(xml);
			}
			catch (Exception ex)
			{
				logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex.ToString());
				return;
			}
		}