Add CouchPotato interface

This commit is contained in:
KZ
2015-08-02 18:39:32 +01:00
parent 478c41fed6
commit d4b61fe3a9
18 changed files with 328 additions and 32 deletions

View File

@@ -22,7 +22,25 @@ namespace Jackett.Models
public int Season { get; set; }
public string Episode { get; set; }
public string SearchTerm { get; set; }
public string SanitizedSearchTerm { get; set; }
public string SanitizedSearchTerm
{
get
{
if (SearchTerm == null)
return string.Empty;
char[] arr = SearchTerm.ToCharArray();
arr = Array.FindAll<char>(arr, c => (char.IsLetterOrDigit(c)
|| char.IsWhiteSpace(c)
|| c == '-'
|| c == '.'
));
var safetitle = new string(arr);
return safetitle;
}
}
public TorznabQuery()
{
@@ -46,19 +64,6 @@ namespace Jackett.Models
return episodeString;
}
static string SanitizeSearchTerm(string title)
{
char[] arr = title.ToCharArray();
arr = Array.FindAll<char>(arr, c => (char.IsLetterOrDigit(c)
|| char.IsWhiteSpace(c)
|| c == '-'
|| c == '.'
));
title = new string(arr);
return title;
}
public static TorznabQuery FromHttpQuery(NameValueCollection query)
{
@@ -69,12 +74,10 @@ namespace Jackett.Models
if (query["q"] == null)
{
q.SearchTerm = string.Empty;
q.SanitizedSearchTerm = string.Empty;
}
else
{
q.SearchTerm = query["q"];
q.SanitizedSearchTerm = SanitizeSearchTerm(q.SearchTerm);
}
if (query["cat"] != null)