Skip to content

Commit

Permalink
Fix series search.. maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmohan committed Mar 17, 2021
1 parent 99d3a90 commit e52956a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Shokofin/API/ShokoAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,11 @@ public static async Task<IEnumerable<SeriesSearchResult>> SeriesSearch(string qu
var responseStream = await CallApi($"/api/v3/Series/Search/{Uri.EscapeDataString(query)}");
return responseStream != null ? await JsonSerializer.DeserializeAsync<IEnumerable<SeriesSearchResult>>(responseStream) : null;
}

public static async Task<IEnumerable<SeriesSearchResult>> SeriesStartsWith(string query)
{
var responseStream = await CallApi($"/api/v3/Series/StartsWith/{Uri.EscapeDataString(query)}");
return responseStream != null ? await JsonSerializer.DeserializeAsync<IEnumerable<SeriesSearchResult>>(responseStream) : null;
}
}
}
3 changes: 3 additions & 0 deletions Shokofin/Providers/BoxSetProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(BoxSetInfo s
{
_logger.LogInformation($"Shoko Scanner... Searching BoxSet ({searchInfo.Name})");
var searchResults = await ShokoAPI.SeriesSearch(searchInfo.Name);

if (searchResults.Count() == 0) searchResults = await ShokoAPI.SeriesStartsWith(searchInfo.Name);

var results = new List<RemoteSearchResult>();

foreach (var series in searchResults)
Expand Down
3 changes: 3 additions & 0 deletions Shokofin/Providers/SeriesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo s
{
_logger.LogInformation($"Shoko Scanner... Searching Series ({searchInfo.Name})");
var searchResults = await ShokoAPI.SeriesSearch(searchInfo.Name);

if (searchResults.Count() == 0) searchResults = await ShokoAPI.SeriesStartsWith(searchInfo.Name);

var results = new List<RemoteSearchResult>();

foreach (var series in searchResults)
Expand Down

0 comments on commit e52956a

Please sign in to comment.