Skip to content

Commit

Permalink
Add logging for HTTP Ban and a warning for when a ban or no data occu…
Browse files Browse the repository at this point in the history
…rred during anime data update
  • Loading branch information
da3dsoul committed Jan 26, 2019
1 parent e978bb3 commit d3dd599
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Shoko.Server/AniDB_API/AniDBHTTPHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d3dd599

Please sign in to comment.