Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DirtyRacer1337 committed Jan 30, 2023
1 parent 3e9a581 commit aad3e8b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.Stash/Providers/Collections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(BoxSetInfo s

try
{
result = await StashAPI.StudiosSearch(searchInfo.Name, cancellationToken).ConfigureAwait(false);
result = await StashAPI.StudiosSearch(searchInfo, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.Stash/Providers/Peoples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(PersonLookup

try
{
result = await StashAPI.PerformersSearch(searchInfo.Name, cancellationToken).ConfigureAwait(false);
result = await StashAPI.PerformersSearch(searchInfo, cancellationToken).ConfigureAwait(false);
}
catch (Exception e)
{
Expand Down
22 changes: 11 additions & 11 deletions Jellyfin.Plugin.Stash/Providers/StashAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ public static async Task<List<RemoteSearchResult>> SceneSearch(ItemLookupInfo se
return result;
}

query = HttpUtility.JavaScriptStringEncode(query);
query = HttpUtility.JavaScriptStringEncode(query.Trim());

string searchData;
if (!string.IsNullOrEmpty(path))
{
searchData = string.Format("scene_filter: {{ path: {{ value: \"\\\"{0}\\\"\", modifier: INCLUDES }} }}", query);
searchData = string.Format("scene_filter:{{path:{{value:\"\\\"{0}\\\"\",modifier:INCLUDES}}}}", query);
}
else
{
searchData = string.Format("filter: {{ q: \"\\\"{0}\\\"\" }}", query);
searchData = string.Format("filter:{{q:\"{0}\"}}", query);
}

var data = string.Format(Consts.SceneSearchQuery, searchData);
Expand Down Expand Up @@ -209,16 +209,16 @@ public static async Task<IEnumerable<RemoteImageInfo>> SceneImages(string sceneI
return result;
}

public static async Task<List<RemoteSearchResult>> PerformersSearch(string actorName, CancellationToken cancellationToken)
public static async Task<List<RemoteSearchResult>> PerformersSearch(ItemLookupInfo searchInfo, CancellationToken cancellationToken)
{
var result = new List<RemoteSearchResult>();
if (string.IsNullOrEmpty(actorName))
if (string.IsNullOrEmpty(searchInfo.Name))
{
return result;
}

var query = HttpUtility.JavaScriptStringEncode(actorName);
string searchData = string.Format("filter: {{ q: \"\\\"{0}\\\"\" }}", query);
var query = HttpUtility.JavaScriptStringEncode(searchInfo.Name.Trim());
string searchData = string.Format("filter:{{q:\"{0}\"}}", query);

var data = string.Format(Consts.PerformerSearchQuery, searchData);
var http = await GetDataFromAPI(data, cancellationToken).ConfigureAwait(false);
Expand Down Expand Up @@ -302,16 +302,16 @@ public static async Task<IEnumerable<RemoteImageInfo>> PerformerImages(string sc
return result;
}

public static async Task<List<RemoteSearchResult>> StudiosSearch(string actorName, CancellationToken cancellationToken)
public static async Task<List<RemoteSearchResult>> StudiosSearch(ItemLookupInfo searchInfo, CancellationToken cancellationToken)
{
var result = new List<RemoteSearchResult>();
if (string.IsNullOrEmpty(actorName))
if (string.IsNullOrEmpty(searchInfo.Name))
{
return result;
}

var query = HttpUtility.JavaScriptStringEncode(actorName);
string searchData = string.Format("filter: {{ q: \"\\\"{0}\\\"\" }}", query);
var query = HttpUtility.JavaScriptStringEncode(searchInfo.Name.Trim());
string searchData = string.Format("filter:{{q:\"{0}\"}}", query);

var data = string.Format(Consts.StudiosSearchQuery, searchData);
var http = await GetDataFromAPI(data, cancellationToken).ConfigureAwait(false);
Expand Down

0 comments on commit aad3e8b

Please sign in to comment.