jellyfin-plugin-webhooks icon indicating copy to clipboard operation
jellyfin-plugin-webhooks copied to clipboard

Possibility to delay ItemAdded event untill metadata is updated

Open zeroquinc opened this issue 1 year ago • 2 comments

Would it be possible to have some kind of way to only fire up ItemAdded when the metadata is fully updated? I use .nfo files so most of the time this is within 2 seconds of it being added, but it always misses it.

The official Jellyfin webhook plugin does it something like this (from their code)

// Metadata not refreshed yet and under retry limit.
                    if (item.ProviderIds.Keys.Count == 0 && container.RetryCount < MaxRetries)
                    {
                        _logger.LogDebug("Requeue {ItemName}, no provider ids", item.Name);
                        container.RetryCount++;
                        _itemProcessQueue.AddOrUpdate(key, container, (_, _) => container);
                        continue;
                    }

                    _logger.LogDebug("Notifying for {ItemName}", item.Name);

I know I could also watch for ItemUpdated and work with something of a cache myself, but I feel like I unnecessary spam my webhook receiver with ItemUpdated events.

Thank you!

zeroquinc avatar Feb 27 '25 00:02 zeroquinc

Sorry I don't have time to test these scenarios for now, but gladly accept a PR if any.

shemanaev avatar Mar 15 '25 18:03 shemanaev

I don't have a lot of C knowledge but I will try

zeroquinc avatar Mar 22 '25 10:03 zeroquinc