ankenyr / jellyfin-youtube-metadata-plugin

Youtube Metadata Plugin for Jellyfin
GNU Affero General Public License v3.0
481 stars 31 forks source link

New episodes are marked as "watched" #61

Closed wjbridge closed 1 year ago

wjbridge commented 2 years ago

Hello @ankenyr!

So I am noticing a bug where when a new episode downloads, and is marked with an index of #1 specifically episode when a sponsor pulls out of a video below. This episode was just downloaded today.

image

If I run the schedueld task for youtube-metadata-plugin manually, it marks this as episode #8 correctly and in order but it is already watched

image

Is the numbering of an episode supposed to happen when the filesystem detects a new episode or as a scheduled task only? I am seeing this behavior on a number of shows of mine. Since the episode was marked with an index of #1 which I have watched it is marking the new episode as watched. I am using Jellyfin 10.8.1.

I am assuming that the episode number is hard coded to 1 when metadata is requested because of these lines https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/blob/6d5a51e831fe6a354557285ad1b823b5e174e709/Jellyfin.Plugin.YoutubeMetadata/Utils.cs#L271

ankenyr commented 2 years ago

Numbering is indexed at one to start. There is a scheduled task that runs to re-index. Please check in your index. There is no easy way to know what the index number should be and I believe it is required to be set.

wjbridge commented 2 years ago

Yes, the index does get set properly when the scheduled task runs but the episode retains the "watched" status after this scheduled task completes since setting the episode as index 1. Maybe the index should be 999 instead of 1 until the scheduled task completes?

ankenyr commented 1 year ago

999 would also cause issues for some channels I imagine. I would experiment with setting it to -1 since no episode will ever legitimately be at that number. That could cause other unintended issues though. Also thanks for this bug, seems like it is affecting me. I have not had a chance to watch anything in a while. Guess this was something that happened with the latest versions in 1.8 since its alpha

wjbridge commented 1 year ago

Glad to help. What I have been doing to resolve this is I set the episode number to YYYYMMDD which will always be unique even after the scheduled task runs (custom build). I know this is not something you wanted to support in the naming part in past issues. This also solves my problem of deleting old episodes and maintaining the watched status correctly. Either way though, awesome work! If you find a way to resolve this, I would be happy to test it out.

ankenyr commented 1 year ago

YoutubeMetadata_1.0.3.6.zip I made a quick edit to change the Index number to -1 Would you mind testing this out? I tried it myself a bit and it seems to be OK but I also could not really replicate the bug from a fresh install. Here is what I tried 1) Delete all of the data/config directory and start fresh. 2) Setup library keeping all metadata configs off 3) Copy over my plugin and restart 4) Turn on the plugin in the library 5) turned off the episode indexer schedule 6) Scan library

Each of the episodes should not have an episode number when looking at their metadata. Setting one to "watched" I would have expected to change them all per this bug. I have seen it happen once in testing but I have not been able to get it to reproduce consistently.

ankenyr commented 1 year ago

I have not seen this issue in my library for a while now. Going to mark this as closed.