Movie folder view, sort and search works
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -12,7 +12,7 @@ public class Metadata
|
||||
{
|
||||
private const string UserAgent = "User-Agent: XBMC/19 (Linux 6.1; http://www.xbmc.org)";
|
||||
private const string AccessToken = "9ajdu4xyn1ig8nxsodr3";
|
||||
private const int MaxPageLimit = 1000;
|
||||
private const int MaxPageLimit = 100; // thousand is too much for some search types
|
||||
|
||||
private static readonly Uri ApiRoot = new Uri("https://plugin.sc2.zone/api/");
|
||||
private static readonly Uri ApiFilter = new Uri(ApiRoot, "media/filter/v2/");
|
||||
@@ -20,7 +20,7 @@ public class Metadata
|
||||
/// <summary>
|
||||
/// Searches for media using an expression.
|
||||
/// </summary>
|
||||
/// <param name="expression">Expression like part of title.</param>
|
||||
/// <param name="expression">Expression like part of title. Can be empty string to list all media.</param>
|
||||
/// <param name="order">Result ordering direction.</param>
|
||||
/// <param name="sort">Result ordering column.</param>
|
||||
/// <param name="type">Allowed result type.</param>
|
||||
@@ -37,8 +37,28 @@ public class Metadata
|
||||
if (limit == 0 || limit > MaxPageLimit)
|
||||
limit = MaxPageLimit;
|
||||
|
||||
UriBuilder uri = new UriBuilder(new Uri(ApiFilter, "search"));
|
||||
/*
|
||||
bool noSearchTerms = expression.Trim().Length == 0;
|
||||
UriBuilder uri = new UriBuilder(new Uri(ApiFilter, noSearchTerms ? "all" : "search"));
|
||||
uri.Query = $"?access_token={AccessToken}&value={Uri.EscapeDataString(expression)}&order={ToString(order)}&sort={ToString(sort)}&type={ToString(type)}&from={offset.ToString()}&size={limit.ToString()}";
|
||||
*/
|
||||
|
||||
bool noSearchTerms = expression.Trim().Length == 0;
|
||||
string filterName;
|
||||
string sortS = ToString(sort);
|
||||
if (sort == FilterSortBy.Title) {
|
||||
filterName = "startsWithSimple";
|
||||
sortS = "";
|
||||
} else if (noSearchTerms) {
|
||||
filterName = "all";
|
||||
} else {
|
||||
filterName = "search";
|
||||
}
|
||||
|
||||
UriBuilder uri = new UriBuilder(new Uri(ApiFilter, filterName));
|
||||
string orderS = order == ItemOrder.Ascending ? "asc" : "desc";
|
||||
uri.Query = $"?access_token={AccessToken}&value={Uri.EscapeDataString(expression)}&type={ToString(type)}&from={offset.ToString()}&size={limit.ToString()}"
|
||||
+ (sortS.Length != 0 ? $"&order={ToString(order)}&sort={sortS}" : "");
|
||||
|
||||
FilterResponse? result = await Program._http.GetFromJsonAsync<FilterResponse>(uri.Uri, CreateFilterJsonOptions(), cancel);
|
||||
if (result != null)
|
||||
|
||||
Reference in New Issue
Block a user