Skip to content
Permalink
Browse files

Add logging for HTTP Ban and a warning for when a ban or no data occu…

…rred during anime data update
  • Loading branch information...
da3dsoul committed Jan 26, 2019
1 parent e978bb3 commit d3dd599b7c508eb14582170dcb74d391ec3d7a5a
Showing with 6 additions and 1 deletion.
  1. +6 −1 Shoko.Server/AniDB_API/AniDBHTTPHelper.cs
@@ -61,13 +61,17 @@ public static XmlDocument GetAnimeXMLFromAPI(int animeID)
ShokoService.LogToSystem(Constants.DBLogType.APIAniDBHTTP, msg);

XmlDocument docAnime = null;
if (0 < rawXML.Trim().Length && !CheckForBan(rawXML))
if (rawXML.Trim().Length > 0 && !CheckForBan(rawXML))
{
APIUtils.WriteAnimeHTTPToFile(animeID, rawXML);

docAnime = new XmlDocument();
docAnime.LoadXml(rawXML);
}
else
{
logger.Warn($"When downloading anime data for {animeID}, ban or no data was receved.");
}

return docAnime;
}
@@ -142,6 +146,7 @@ public static bool CheckForBan(string xmlresult)
int index = xmlresult.IndexOf(@">banned<", StringComparison.InvariantCultureIgnoreCase);
if (-1 < index)
{
logger.Warn("HTTP Banned!");
ShokoService.AnidbProcessor.IsHttpBanned = true;
result = true;
}

0 comments on commit d3dd599

Please sign in to comment.
You can’t perform that action at this time.