A boatload of Bugs (#3704)
Co-authored-by: Amelia <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
parent
ea9b7ad0d1
commit
37734554ba
102 changed files with 2051 additions and 1115 deletions
|
@ -437,16 +437,24 @@ public class ExternalMetadataService : IExternalMetadataService
|
|||
// Trim quotes if the response is a JSON string
|
||||
errorMessage = errorMessage.Trim('"');
|
||||
|
||||
if (ex.StatusCode == 400 && errorMessage.Contains("Too many Requests"))
|
||||
if (ex.StatusCode == 400)
|
||||
{
|
||||
_logger.LogInformation("Hit rate limit, will retry in 3 seconds");
|
||||
await Task.Delay(3000);
|
||||
if (errorMessage.Contains("Too many Requests"))
|
||||
{
|
||||
_logger.LogInformation("Hit rate limit, will retry in 3 seconds");
|
||||
await Task.Delay(3000);
|
||||
|
||||
result = await (Configuration.KavitaPlusApiUrl + "/api/metadata/v2/series-detail")
|
||||
.WithKavitaPlusHeaders(license, token)
|
||||
.PostJsonAsync(data)
|
||||
.ReceiveJson<
|
||||
SeriesDetailPlusApiDto>();
|
||||
result = await (Configuration.KavitaPlusApiUrl + "/api/metadata/v2/series-detail")
|
||||
.WithKavitaPlusHeaders(license, token)
|
||||
.PostJsonAsync(data)
|
||||
.ReceiveJson<
|
||||
SeriesDetailPlusApiDto>();
|
||||
}
|
||||
else if (errorMessage.Contains("Unknown Series"))
|
||||
{
|
||||
series.IsBlacklisted = true;
|
||||
await _unitOfWork.CommitAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -956,6 +956,7 @@ public class ScrobblingService : IScrobblingService
|
|||
// Recalculate the highest volume/chapter
|
||||
foreach (var readEvt in readEvents)
|
||||
{
|
||||
// Note: this causes skewing in the scrobble history because it makes it look like there are duplicate events
|
||||
readEvt.VolumeNumber =
|
||||
(int) await _unitOfWork.AppUserProgressRepository.GetHighestFullyReadVolumeForSeries(readEvt.SeriesId,
|
||||
readEvt.AppUser.Id);
|
||||
|
@ -1027,7 +1028,7 @@ public class ScrobblingService : IScrobblingService
|
|||
_unitOfWork.ScrobbleRepository.Attach(new ScrobbleError()
|
||||
{
|
||||
Comment = "AniList token has expired and needs rotating. Scrobbling wont work until then",
|
||||
Details = $"User: {evt.AppUser.UserName}",
|
||||
Details = $"User: {evt.AppUser.UserName}, Expired: {TokenService.GetTokenExpiry(evt.AppUser.AniListAccessToken)}",
|
||||
LibraryId = evt.LibraryId,
|
||||
SeriesId = evt.SeriesId
|
||||
});
|
||||
|
@ -1124,33 +1125,22 @@ public class ScrobblingService : IScrobblingService
|
|||
private static bool CanProcessScrobbleEvent(ScrobbleEvent readEvent)
|
||||
{
|
||||
var userProviders = GetUserProviders(readEvent.AppUser);
|
||||
if (readEvent.Series.Library.Type == LibraryType.Manga && MangaProviders.Intersect(userProviders).Any())
|
||||
switch (readEvent.Series.Library.Type)
|
||||
{
|
||||
return true;
|
||||
case LibraryType.Manga when MangaProviders.Intersect(userProviders).Any():
|
||||
case LibraryType.Comic when
|
||||
ComicProviders.Intersect(userProviders).Any():
|
||||
case LibraryType.Book when
|
||||
BookProviders.Intersect(userProviders).Any():
|
||||
case LibraryType.LightNovel when
|
||||
LightNovelProviders.Intersect(userProviders).Any():
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (readEvent.Series.Library.Type == LibraryType.Comic &&
|
||||
ComicProviders.Intersect(userProviders).Any())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (readEvent.Series.Library.Type == LibraryType.Book &&
|
||||
BookProviders.Intersect(userProviders).Any())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (readEvent.Series.Library.Type == LibraryType.LightNovel &&
|
||||
LightNovelProviders.Intersect(userProviders).Any())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static IList<ScrobbleProvider> GetUserProviders(AppUser appUser)
|
||||
private static List<ScrobbleProvider> GetUserProviders(AppUser appUser)
|
||||
{
|
||||
var providers = new List<ScrobbleProvider>();
|
||||
if (!string.IsNullOrEmpty(appUser.AniListAccessToken)) providers.Add(ScrobbleProvider.AniList);
|
||||
|
@ -1227,8 +1217,7 @@ public class ScrobblingService : IScrobblingService
|
|||
|
||||
public static string CreateUrl(string url, long? id)
|
||||
{
|
||||
if (id is null or 0) return string.Empty;
|
||||
return $"{url}{id}/";
|
||||
return id is null or 0 ? string.Empty : $"{url}{id}/";
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue