check TA video status before syncing to TA
This commit is contained in:
@@ -177,11 +177,23 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks
|
|||||||
if (!isChannelWatched)
|
if (!isChannelWatched)
|
||||||
{
|
{
|
||||||
var isVideoPlayed = video.IsPlayed(user, videoItemData);
|
var isVideoPlayed = video.IsPlayed(user, videoItemData);
|
||||||
|
var taVideo = await taApi.GetVideo(videoYTId).ConfigureAwait(true);
|
||||||
|
if (taVideo != null)
|
||||||
|
{
|
||||||
|
var isTAVideoPlayed = taVideo?.Player.IsWatched ?? false;
|
||||||
|
if (isTAVideoPlayed != isVideoPlayed)
|
||||||
|
{
|
||||||
statusCode = await taApi.SetWatchedStatus(videoYTId, isVideoPlayed).ConfigureAwait(true);
|
statusCode = await taApi.SetWatchedStatus(videoYTId, isVideoPlayed).ConfigureAwait(true);
|
||||||
if (statusCode != System.Net.HttpStatusCode.OK)
|
if (statusCode != System.Net.HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
_logger.LogCritical("{Message}", $"POST /watched returned {statusCode} for video {video.Name} ({videoYTId}) with wacthed status {isVideoPlayed}");
|
_logger.LogCritical("{Message}", $"POST /watched returned {statusCode} for video {video.Name} ({videoYTId}) with wacthed status {isVideoPlayed}");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Video {VideoId} watch status marked as {Status} in TubeArchivist", videoYTId, isVideoPlayed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_logger.LogDebug("{Message}", isVideoPlayed);
|
_logger.LogDebug("{Message}", isVideoPlayed);
|
||||||
if (!isVideoPlayed)
|
if (!isVideoPlayed)
|
||||||
|
|||||||
Reference in New Issue
Block a user