fix: claude ist dumm
This commit is contained in:
@@ -89,7 +89,7 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
|
||||
foreach (var item in existingItems)
|
||||
{
|
||||
if (!_historyService.IsKnownItem(item.Id))
|
||||
if (!_historyService.IsKnownItem(item.Id, item))
|
||||
{
|
||||
_historyService.RecordItem(item);
|
||||
seeded++;
|
||||
@@ -240,8 +240,8 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
// Check 0: Is this exact item (same Jellyfin ID) already known in our DB?
|
||||
if (_historyService.IsKnownItem(item.Id))
|
||||
// Check 0: Is this item already known in our DB? (by Jellyfin ID or content key)
|
||||
if (_historyService.IsKnownItem(item.Id, item))
|
||||
{
|
||||
_logger.LogDebug(
|
||||
"Item {Name} (ID: {Id}) is already known in DB, skipping notification",
|
||||
|
||||
@@ -215,14 +215,37 @@ public class ItemHistoryService : IDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if an item with the given Jellyfin ID is already tracked in the database.
|
||||
/// Checks if an item is already tracked in the database.
|
||||
/// Checks both by Jellyfin ID and by content key (provider IDs),
|
||||
/// so moved/rescanned files with new Jellyfin IDs are still recognized.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The Jellyfin item ID.</param>
|
||||
/// <param name="item">The item to check (used for content key lookup).</param>
|
||||
/// <returns>True if the item is already known.</returns>
|
||||
public bool IsKnownItem(Guid itemId)
|
||||
public bool IsKnownItem(Guid itemId, BaseItem? item = null)
|
||||
{
|
||||
var jellyfinId = itemId.ToString();
|
||||
return _knownItems.Exists(x => x.JellyfinItemId == jellyfinId);
|
||||
if (_knownItems.Exists(x => x.JellyfinItemId == jellyfinId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Fallback: check by content key (provider IDs) so moved files are still recognized
|
||||
if (item != null)
|
||||
{
|
||||
var contentKey = GenerateContentKey(item);
|
||||
if (contentKey != null && _knownItems.Exists(x => x.ContentKey == contentKey))
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Item {Name} recognized as known by content key {Key} (new Jellyfin ID: {Id})",
|
||||
item.Name,
|
||||
contentKey,
|
||||
jellyfinId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user