fix: refresh series name before notification

This commit is contained in:
2026-04-04 11:35:59 +02:00
parent b1444094ad
commit 0e10e3c089

View File

@@ -430,12 +430,19 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
var changed = false;
if (string.IsNullOrEmpty(notification.SeriesName) || notification.SeriesName == "Unknown Series")
// Always refresh SeriesName from the library — at queue time the name
// may have been the Sonarr folder name (before metadata refresh).
{
// episode.SeriesName is often null (especially with Shokofin VFS),
// but the Series navigation property usually has the correct name
notification.SeriesName = episode.SeriesName ?? episode.Series?.Name;
changed = true;
var freshSeriesName = episode.SeriesName ?? episode.Series?.Name;
if (!string.IsNullOrEmpty(freshSeriesName) && freshSeriesName != notification.SeriesName)
{
_logger.LogInformation(
"[DEBUG Refresh] SeriesName changed: '{Old}' -> '{New}'",
notification.SeriesName,
freshSeriesName);
notification.SeriesName = freshSeriesName;
changed = true;
}
}
if (string.IsNullOrEmpty(notification.SeriesId) || notification.SeriesId == Guid.Empty.ToString())
@@ -464,6 +471,17 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
changed = true;
}
// Always refresh the item name — it may have been a placeholder at queue time
if (!string.IsNullOrEmpty(episode.Name) && episode.Name != notification.Name)
{
_logger.LogInformation(
"[DEBUG Refresh] Name changed: '{Old}' -> '{New}'",
notification.Name,
episode.Name);
notification.Name = episode.Name;
changed = true;
}
// Refresh image if missing
if (string.IsNullOrEmpty(notification.ImagePath) && episode.SeriesId != Guid.Empty)
{