mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-13 00:23:59 -07:00
Fixed: Refactored the Indexer architecture to support non-rss indexers.
This commit is contained in:
parent
22c9bc402f
commit
5e62c2335f
57 changed files with 2196 additions and 1470 deletions
|
@ -21,7 +21,7 @@ namespace NzbDrone.Common.Http
|
|||
{
|
||||
Request = request;
|
||||
Headers = headers;
|
||||
ResponseData = Encoding.UTF8.GetBytes(content);
|
||||
ResponseData = Headers.GetEncodingFromContentType().GetBytes(content);
|
||||
_content = content;
|
||||
StatusCode = statusCode;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace NzbDrone.Common.Http
|
|||
{
|
||||
if (_content == null)
|
||||
{
|
||||
_content = GetStringFromResponseData();
|
||||
_content = Headers.GetEncodingFromContentType().GetString(ResponseData);
|
||||
}
|
||||
|
||||
return _content;
|
||||
|
@ -66,36 +66,6 @@ namespace NzbDrone.Common.Http
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected virtual String GetStringFromResponseData()
|
||||
{
|
||||
Encoding encoding = null;
|
||||
|
||||
if (Headers.ContentType.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var charset = Headers.ContentType.ToLowerInvariant()
|
||||
.Split(';', '=', ' ')
|
||||
.SkipWhile(v => v != "charset")
|
||||
.Skip(1).FirstOrDefault();
|
||||
|
||||
if (charset.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
encoding = Encoding.GetEncoding(charset);
|
||||
}
|
||||
}
|
||||
|
||||
if (encoding == null)
|
||||
{
|
||||
// TODO: Find encoding by Byte order mask.
|
||||
}
|
||||
|
||||
if (encoding == null)
|
||||
{
|
||||
encoding = Encoding.UTF8;
|
||||
}
|
||||
|
||||
return encoding.GetString(ResponseData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue