Fixed issue where chapter based volumes wouldn't properly handle chapter divide when reading a manga.
This commit is contained in:
parent
731e3a9c5e
commit
c2b41b774a
4 changed files with 24 additions and 28 deletions
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using API.Comparators;
|
||||
|
|
@ -13,17 +11,13 @@ namespace API.Controllers
|
|||
{
|
||||
public class ReaderController : BaseApiController
|
||||
{
|
||||
private readonly ISeriesRepository _seriesRepository;
|
||||
private readonly IDirectoryService _directoryService;
|
||||
private readonly ICacheService _cacheService;
|
||||
private readonly NumericComparer _numericComparer;
|
||||
|
||||
public ReaderController(ISeriesRepository seriesRepository, IDirectoryService directoryService, ICacheService cacheService)
|
||||
public ReaderController(IDirectoryService directoryService, ICacheService cacheService)
|
||||
{
|
||||
_seriesRepository = seriesRepository;
|
||||
_directoryService = directoryService;
|
||||
_cacheService = cacheService;
|
||||
_numericComparer = new NumericComparer();
|
||||
}
|
||||
|
||||
[HttpGet("info")]
|
||||
|
|
@ -46,11 +40,7 @@ namespace API.Controllers
|
|||
// Temp let's iterate the directory each call to get next image
|
||||
var volume = await _cacheService.Ensure(volumeId);
|
||||
|
||||
var files = _directoryService.ListFiles(_cacheService.GetCachedPagePath(volume, page));
|
||||
//files.OrderBy(t => t, _numericComparer);
|
||||
var array = files.ToArray();
|
||||
Array.Sort(array, _numericComparer); // TODO: Find a way to apply numericComparer to IList.
|
||||
var path = array.ElementAt(page);
|
||||
var path = _cacheService.GetCachedPagePath(volume, page);
|
||||
var file = await _directoryService.ReadImageAsync(path);
|
||||
file.Page = page;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue