mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Add CouchPotato interface
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user