Tachiyomi Enhancements (#845)
* Added a new endpoint to get all Series with Progress info. * Fixed up some potential NPEs during scan * Commented out filter code, not ready for it. * Fixed up a parsing case for european comics * Refactored FilterDto to allow for specifying multiple formats to return. * Refactored FilterDto to allow for specifying multiple formats to return. * Refactored the UI to show OPDS as 3rd Party Clients since Tachiyomi now uses OPDS url scheme for authentication.
This commit is contained in:
parent
658ca290e1
commit
384ebcef5c
20 changed files with 120 additions and 99 deletions
|
|
@ -178,8 +178,11 @@ public class SeriesRepository : ISeriesRepository
|
|||
public async Task<PagedList<SeriesDto>> GetSeriesDtoForLibraryIdAsync(int libraryId, int userId, UserParams userParams, FilterDto filter)
|
||||
{
|
||||
var formats = filter.GetSqlFilter();
|
||||
|
||||
var userLibraries = await GetUserLibraries(libraryId, userId);
|
||||
|
||||
var query = _context.Series
|
||||
.Where(s => s.LibraryId == libraryId && formats.Contains(s.Format))
|
||||
.Where(s => userLibraries.Contains(s.LibraryId) && formats.Contains(s.Format))
|
||||
.OrderBy(s => s.SortName)
|
||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||
.AsNoTracking();
|
||||
|
|
@ -187,6 +190,24 @@ public class SeriesRepository : ISeriesRepository
|
|||
return await PagedList<SeriesDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);
|
||||
}
|
||||
|
||||
private async Task<List<int>> GetUserLibraries(int libraryId, int userId)
|
||||
{
|
||||
if (libraryId == 0)
|
||||
{
|
||||
return await _context.Library
|
||||
.Include(l => l.AppUsers)
|
||||
.Where(library => library.AppUsers.Any(user => user.Id == userId))
|
||||
.AsNoTracking()
|
||||
.Select(library => library.Id)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
return new List<int>()
|
||||
{
|
||||
libraryId
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<SearchResultDto>> SearchSeries(int[] libraryIds, string searchQuery)
|
||||
{
|
||||
return await _context.Series
|
||||
|
|
@ -357,26 +378,10 @@ public class SeriesRepository : ISeriesRepository
|
|||
{
|
||||
var formats = filter.GetSqlFilter();
|
||||
|
||||
if (libraryId == 0)
|
||||
{
|
||||
var userLibraries = _context.Library
|
||||
.Include(l => l.AppUsers)
|
||||
.Where(library => library.AppUsers.Any(user => user.Id == userId))
|
||||
.AsNoTracking()
|
||||
.Select(library => library.Id)
|
||||
.ToList();
|
||||
|
||||
var allQuery = _context.Series
|
||||
.Where(s => userLibraries.Contains(s.LibraryId) && formats.Contains(s.Format))
|
||||
.OrderByDescending(s => s.Created)
|
||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||
.AsNoTracking();
|
||||
|
||||
return await PagedList<SeriesDto>.CreateAsync(allQuery, userParams.PageNumber, userParams.PageSize);
|
||||
}
|
||||
var userLibraries = await GetUserLibraries(libraryId, userId);
|
||||
|
||||
var query = _context.Series
|
||||
.Where(s => s.LibraryId == libraryId && formats.Contains(s.Format))
|
||||
.Where(s => userLibraries.Contains(s.LibraryId) && formats.Contains(s.Format))
|
||||
.OrderByDescending(s => s.Created)
|
||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||
.AsSplitQuery()
|
||||
|
|
@ -397,20 +402,8 @@ public class SeriesRepository : ISeriesRepository
|
|||
public async Task<IEnumerable<SeriesDto>> GetOnDeck(int userId, int libraryId, UserParams userParams, FilterDto filter)
|
||||
{
|
||||
var formats = filter.GetSqlFilter();
|
||||
IList<int> userLibraries;
|
||||
if (libraryId == 0)
|
||||
{
|
||||
userLibraries = _context.Library
|
||||
.Include(l => l.AppUsers)
|
||||
.Where(library => library.AppUsers.Any(user => user.Id == userId))
|
||||
.AsNoTracking()
|
||||
.Select(library => library.Id)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
userLibraries = new List<int>() {libraryId};
|
||||
}
|
||||
|
||||
var userLibraries = await GetUserLibraries(libraryId, userId);
|
||||
|
||||
var series = _context.Series
|
||||
.Where(s => formats.Contains(s.Format) && userLibraries.Contains(s.LibraryId))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue