Fixed: Refactored the Indexer architecture to support non-rss indexers.

This commit is contained in:
Taloth Saldono
2014-09-07 13:44:24 +02:00
parent 22c9bc402f
commit 5e62c2335f
57 changed files with 2196 additions and 1470 deletions

View File

@@ -1,6 +1,8 @@
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
namespace NzbDrone.Common.Http
{
@@ -66,5 +68,35 @@ namespace NzbDrone.Common.Http
this["Accept"] = value;
}
}
public Encoding GetEncodingFromContentType()
{
Encoding encoding = null;
if (ContentType.IsNotNullOrWhiteSpace())
{
var charset = 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;
}
}
}