OPDS Flattening (#1904)

* Flattening OPDS Structure

# Changed
- Flattened OPDS structure to reduce user taps.

* Fixing format

* Fixing book series titles

* Optimized file size to use pre-calculated data to avoid an I/O touch.

* Fixes #1898 by aligning all content headers to the correct MIME types

* Remove dead code

* Fixed a bug with continue point where it fails on chapters or volumes tagged with a range

---------

Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
Joe Milazzo 2023-03-30 18:45:46 -05:00 committed by GitHub
parent 449827f285
commit a8f48a6e9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 122 additions and 80 deletions

View file

@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using API.Entities;
using Microsoft.AspNetCore.StaticFiles;
using MimeTypes;
namespace API.Services;
@ -47,7 +48,7 @@ public class DownloadService : IDownloadService
".zip" => "application/zip",
".tar.gz" => "application/gzip",
".pdf" => "application/pdf",
_ => contentType
_ => MimeTypeMap.GetMimeType(contentType)
};
}

View file

@ -495,7 +495,7 @@ public class ReaderService : IReaderService
// NOTE: If volume 1 has chapter 1 and volume 2 is just chapter 0 due to being a full volume file, then this fails
// If there are any volumes that have progress, return those. If not, move on.
var currentlyReadingChapter = volumeChapters
.OrderBy(c => double.Parse(c.Range), _chapterSortComparer)
.OrderBy(c => double.Parse(c.Number), _chapterSortComparer) // BUG: This is throwing an exception when Range is 1-11
.FirstOrDefault(chapter => chapter.PagesRead < chapter.Pages && chapter.PagesRead > 0);
if (currentlyReadingChapter != null) return currentlyReadingChapter;

View file

@ -466,10 +466,14 @@ public class SeriesService : ISeriesService
if (string.IsNullOrEmpty(title)) return;
volume.Name += $" - {title}";
}
else
else if (volume.Name != "0")
{
volume.Name += $" - {firstChapter.TitleName}";
}
else
{
volume.Name += $"";
}
return;
}