Added setting to choose whether to scrobble or not on rewatches

This commit is contained in:
Alexander Rufenach
2021-06-03 05:49:53 -04:00
parent 138a1bda95
commit cc6b16e8cb
4 changed files with 23 additions and 5 deletions
@@ -14,7 +14,8 @@ namespace Jellyfin.Plugin.AnilistSync.Configuration
{ {
ScrobbleMovies = true; ScrobbleMovies = true;
ScrobbleShows = true; ScrobbleShows = true;
ScrobblePercentage = 70; ScrobbleRewatches = true;
ScrobblePercentage = 80;
ScrobbleNowWatchingPercentage = 5; ScrobbleNowWatchingPercentage = 5;
MinLength = 5; MinLength = 5;
UserToken = string.Empty; // Todo: check if token is still valid UserToken = string.Empty; // Todo: check if token is still valid
@@ -31,6 +32,8 @@ namespace Jellyfin.Plugin.AnilistSync.Configuration
/// </summary> /// </summary>
public bool ScrobbleShows { get; set; } public bool ScrobbleShows { get; set; }
public bool ScrobbleRewatches { get; set; }
/// <summary> /// <summary>
/// Gets or sets scrobble percentage. /// Gets or sets scrobble percentage.
/// </summary> /// </summary>
@@ -78,6 +78,13 @@
Percentage watched needed to scrobble Percentage watched needed to scrobble
</div> </div>
</div> </div>
<div class="checkboxcontainer">
<label>
<input is="emby-checkbox" type="checkbox" id="ScrobbleRewatches"/>
<span>Autoscrobbling Rewatches</span>
</label>
</div>
<br>
<button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span> <button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span>
</button> </button>
<button is="emby-button" type="button" class="raised block" onclick="history.back();"><span>${Cancel}</span> <button is="emby-button" type="button" class="raised block" onclick="history.back();"><span>${Cancel}</span>
+1 -1
View File
@@ -16,7 +16,7 @@ namespace Jellyfin.Plugin.AnilistSync
{ {
public override string Name => "AnilistSync"; public override string Name => "AnilistSync";
public override Guid Id => Guid.Parse("18c2a8ea-afa0-4a0b-aa94-072b492ab80b"); public override Guid Id => Guid.Parse("18c2a8ea-afa0-4a0b-aa94-072b492ab80b");
public override string Description => "Description"; public override string Description => "Jellyfin plugin to scrobble to Anilist";
IHttpClientFactory _httpClientFactory; IHttpClientFactory _httpClientFactory;
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, IHttpClientFactory htppClientFactory) public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, IHttpClientFactory htppClientFactory)
@@ -180,13 +180,21 @@ namespace Jellyfin.Plugin.AnilistSync.Services
// Check if STARTING a rewatch // Check if STARTING a rewatch
if (status == MediaListStatus.COMPLETED) if (status == MediaListStatus.COMPLETED)
{ {
if (currentIndex == 1) // Check rewatching first episode if (userConfig.ScrobbleRewatches)
{ {
status = MediaListStatus.REPEATING; if (currentIndex == 1) // Check rewatching first episode
{
status = MediaListStatus.REPEATING;
}
else
{
_logger.LogDebug("Attempting to start rewatch from middle episode, discarding scrobble");
return;
}
} }
else else
{ {
_logger.LogDebug("Attempting to start rewatch from middle episode, discarding scrobble"); _logger.LogDebug("User has chosen not to scrobble rewatches");
return; return;
} }
} }