Misc bunch of changes (#2815)

This commit is contained in:
Joe Milazzo 2024-03-23 16:20:16 -05:00 committed by GitHub
parent 18792b7b56
commit 63c9bff32e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
81 changed files with 4567 additions and 339 deletions

View file

@ -94,6 +94,7 @@ public class ScrobblingService : IScrobblingService
ScrobbleProvider.AniList
};
private const string UnknownSeriesErrorMessage = "Series cannot be matched for Scrobbling";
private const string AccessTokenErrorMessage = "Access Token needs to be rotated to continue scrobbling";
@ -332,15 +333,7 @@ public class ScrobblingService : IScrobblingService
await _unitOfWork.AppUserProgressRepository.GetHighestFullyReadChapterForSeries(seriesId, userId),
Format = LibraryTypeHelper.GetFormat(series.Library.Type),
};
// NOTE: Not sure how to handle scrobbling specials or handling sending loose leaf volumes
if (evt.VolumeNumber is Parser.SpecialVolumeNumber)
{
evt.VolumeNumber = 0;
}
if (evt.VolumeNumber is Parser.DefaultChapterNumber)
{
evt.VolumeNumber = 0;
}
_unitOfWork.ScrobbleRepository.Attach(evt);
await _unitOfWork.CommitAsync();
_logger.LogDebug("Added Scrobbling Read update on {SeriesName} with Userid {UserId} ", series.Name, userId);
@ -826,6 +819,20 @@ public class ScrobblingService : IScrobblingService
try
{
var data = await createEvent(evt);
// We need to handle the encoding and changing it to the old one until we can update the API layer to handle these
// which could happen in v0.8.3
if (data.VolumeNumber is Parser.SpecialVolumeNumber)
{
data.VolumeNumber = 0;
}
if (data.VolumeNumber is Parser.DefaultChapterNumber)
{
data.VolumeNumber = 0;
}
if (data.ChapterNumber is Parser.DefaultChapterNumber)
{
data.ChapterNumber = 0;
}
userRateLimits[evt.AppUserId] = await PostScrobbleUpdate(data, license.Value, evt);
evt.IsProcessed = true;
evt.ProcessDateUtc = DateTime.UtcNow;
@ -870,6 +877,7 @@ public class ScrobblingService : IScrobblingService
}
}
private static bool DoesUserHaveProviderAndValid(ScrobbleEvent readEvent)
{
var userProviders = GetUserProviders(readEvent.AppUser);