mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-08-30 23:00:06 -04:00
Bugfixes/misc (#196)
* Removed an error log statment which wasn't valid. Was showing error when a comicinfo.xml was not found in a directory. * Fixed #191. Don't overwrite summary information if we already have something set from UI. * Fixes #192 * Fixed #194 by moving the Take to after the query runs, so we take only distinct series. * Added another case for Regex parsing for VanDread-v01-c01.zip
This commit is contained in:
parent
e2e755145c
commit
9c43833989
@ -135,6 +135,7 @@ namespace API.Tests.Parser
|
|||||||
[InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "Amaenaideyo MS")]
|
[InlineData("[Hidoi]_Amaenaideyo_MS_vol01_chp02.rar", "Amaenaideyo MS")]
|
||||||
[InlineData("NEEDLESS_Vol.4_-_Simeon_6_v2_[SugoiSugoi].rar", "NEEDLESS")]
|
[InlineData("NEEDLESS_Vol.4_-_Simeon_6_v2_[SugoiSugoi].rar", "NEEDLESS")]
|
||||||
[InlineData("Okusama wa Shougakusei c003 (v01) [bokuwaNEET]", "Okusama wa Shougakusei")]
|
[InlineData("Okusama wa Shougakusei c003 (v01) [bokuwaNEET]", "Okusama wa Shougakusei")]
|
||||||
|
[InlineData("VanDread-v01-c001[MD].zip", "VanDread")]
|
||||||
public void ParseSeriesTest(string filename, string expected)
|
public void ParseSeriesTest(string filename, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename));
|
Assert.Equal(expected, API.Parser.Parser.ParseSeries(filename));
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{
|
{
|
||||||
public static class PolicyConstants
|
public static class PolicyConstants
|
||||||
{
|
{
|
||||||
public static readonly string AdminRole = "Admin";
|
public const string AdminRole = "Admin";
|
||||||
public static readonly string PlebRole = "Pleb";
|
public const string PlebRole = "Pleb";
|
||||||
}
|
}
|
||||||
}
|
}
|
0
API/DTOs/SeriesFilterDto.cs
Normal file
0
API/DTOs/SeriesFilterDto.cs
Normal file
@ -350,27 +350,24 @@ namespace API.Data
|
|||||||
.ToList();
|
.ToList();
|
||||||
series = series.Where(s => s.AppUserId == userId
|
series = series.Where(s => s.AppUserId == userId
|
||||||
&& s.PagesRead > 0
|
&& s.PagesRead > 0
|
||||||
&& s.PagesRead <
|
&& s.PagesRead < s.Series.Pages - 1 // - 1 because when reading, we start at 0 then go to pages - 1. But when summing, pages assumes starting at 1
|
||||||
s.Series.Pages -
|
|
||||||
1 // - 1 because when reading, we start at 0 then go to pages - 1. But when summing, pages assumes starting at 1
|
|
||||||
&& userLibraries.Contains(s.Series.LibraryId));
|
&& userLibraries.Contains(s.Series.LibraryId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
series = series.Where(s => s.AppUserId == userId
|
series = series.Where(s => s.AppUserId == userId
|
||||||
&& s.PagesRead > 0
|
&& s.PagesRead > 0
|
||||||
&& s.PagesRead <
|
&& s.PagesRead < s.Series.Pages - 1 // - 1 because when reading, we start at 0 then go to pages - 1. But when summing, pages assumes starting at 1
|
||||||
(s.Series.Pages - 1) // - 1 because when reading, we start at 0 then go to pages - 1. But when summing, pages assumes starting at 1
|
&& s.Series.LibraryId == libraryId);
|
||||||
&& (s.Series.LibraryId == libraryId));
|
|
||||||
}
|
}
|
||||||
var retSeries = await series.Take(limit)
|
var retSeries = await series
|
||||||
.OrderByDescending(s => s.LastModified)
|
.OrderByDescending(s => s.LastModified)
|
||||||
.Select(s => s.Series)
|
.Select(s => s.Series)
|
||||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return retSeries.DistinctBy(s => s.Name);
|
return retSeries.DistinctBy(s => s.Name).Take(limit); // SeriesDTO might need date information
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -65,9 +65,9 @@ namespace API.Parser
|
|||||||
new Regex(
|
new Regex(
|
||||||
@"^(?<Series>.*)( |_)Vol\.?\d+",
|
@"^(?<Series>.*)( |_)Vol\.?\d+",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
// Ichiban_Ushiro_no_Daimaou_v04_ch34_[VISCANS].zip
|
// Ichiban_Ushiro_no_Daimaou_v04_ch34_[VISCANS].zip, VanDread-v01-c01.zip
|
||||||
new Regex(
|
new Regex(
|
||||||
@"(?<Series>.*)(\b|_)v(?<Volume>\d+-?\d*)( |_)",
|
@"(?<Series>.*)(\b|_)v(?<Volume>\d+-?\d*)( |_|-)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
// Gokukoku no Brynhildr - c001-008 (v01) [TrinityBAKumA], Black Bullet - v4 c17 [batoto]
|
// Gokukoku no Brynhildr - c001-008 (v01) [TrinityBAKumA], Black Bullet - v4 c17 [batoto]
|
||||||
new Regex(
|
new Regex(
|
||||||
|
@ -313,10 +313,10 @@ namespace API.Services
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ArchiveLibrary.NotSupported:
|
case ArchiveLibrary.NotSupported:
|
||||||
_logger.LogError("[GetSummaryInfo] This archive cannot be read: {ArchivePath}. Defaulting to 0 pages", archivePath);
|
_logger.LogError("[GetSummaryInfo] This archive cannot be read: {ArchivePath}", archivePath);
|
||||||
return summary;
|
return summary;
|
||||||
default:
|
default:
|
||||||
_logger.LogError("[GetSummaryInfo] There was an exception when reading archive stream: {ArchivePath}. Defaulting to 0 pages", archivePath);
|
_logger.LogError("[GetSummaryInfo] There was an exception when reading archive stream: {ArchivePath}", archivePath);
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,8 +324,6 @@ namespace API.Services
|
|||||||
{
|
{
|
||||||
return info.Summary;
|
return info.Summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogError("[GetSummaryInfo] Could not parse archive file: {Filepath}", archivePath);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,11 @@ namespace API.Services
|
|||||||
if (firstFile != null &&
|
if (firstFile != null &&
|
||||||
(forceUpdate || firstFile.HasFileBeenModified())) // !new FileInfo(firstFile.FilePath).IsLastWriteLessThan(firstFile.LastModified)
|
(forceUpdate || firstFile.HasFileBeenModified())) // !new FileInfo(firstFile.FilePath).IsLastWriteLessThan(firstFile.LastModified)
|
||||||
{
|
{
|
||||||
series.Summary = isBook ? _bookService.GetSummaryInfo(firstFile.FilePath) : _archiveService.GetSummaryInfo(firstFile.FilePath);
|
var summary = isBook ? _bookService.GetSummaryInfo(firstFile.FilePath) : _archiveService.GetSummaryInfo(firstFile.FilePath);
|
||||||
|
if (string.IsNullOrEmpty(series.Summary))
|
||||||
|
{
|
||||||
|
series.Summary = summary;
|
||||||
|
}
|
||||||
|
|
||||||
firstFile.LastModified = DateTime.Now;
|
firstFile.LastModified = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user