Now works on Linux (headless), detailed logging, season searching

This commit is contained in:
zone117x
2015-04-19 23:10:50 -06:00
parent ac003e7a78
commit dce596ed1a
6 changed files with 66 additions and 16 deletions

View File

@@ -131,13 +131,20 @@ namespace Jackett
break;
}
JToken jsonReply = await handlerTask(context);
ReplyWithJson(context, jsonReply);
await ReplyWithJson(context, jsonReply, method.ToString());
}
async void ReplyWithJson(HttpListenerContext context, JToken json)
async Task ReplyWithJson(HttpListenerContext context, JToken json, string apiCall)
{
byte[] jsonBytes = Encoding.UTF8.GetBytes(json.ToString());
await context.Response.OutputStream.WriteAsync(jsonBytes, 0, jsonBytes.Length);
try
{
byte[] jsonBytes = Encoding.UTF8.GetBytes(json.ToString());
await context.Response.OutputStream.WriteAsync(jsonBytes, 0, jsonBytes.Length);
}
catch (Exception ex)
{
Console.WriteLine("Error writing json to stream for API call " + apiCall + Environment.NewLine + ex.ToString());
}
}
async Task<JToken> HandleTestSonarr(HttpListenerContext context)