Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aadb40c82 | ||
|
|
48e347f5c7 | ||
| 76161230e1 | |||
|
|
205cbd91af | ||
| a71ced086a | |||
| 85fd002f4e | |||
|
|
f9aacf2436 | ||
|
|
caee267f8b | ||
| 5a60a6f5b4 | |||
|
|
133c00fab0 | ||
| 0bafe691a0 | |||
| 82b34e288c | |||
|
|
8c77f82d2c |
@@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "0.1.2"
|
||||
".": "0.1.4"
|
||||
}
|
||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,5 +1,21 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.4 (2026-04-07)
|
||||
|
||||
## 0.1.4 (2026-04-07)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
Langsamer Start von Jellyfin wegen Überprüfung bestehender Einträge.
|
||||
Läuft nun asynchron.
|
||||
## 0.1.3 (2026-04-05)
|
||||
|
||||
## 0.1.3 (2026-04-05)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
Gebe keine Notification wenn der Name der Serie tmdbid oder ähnliches enthält.
|
||||
Dies verhindert das die Notification kommt wenn noch nicht die Metadaten gezogen wurden.
|
||||
## 0.1.2 (2026-04-04)
|
||||
|
||||
## 0.1.2 (2026-04-04)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>Jellyfin.Plugin.SmartNotify</RootNamespace>
|
||||
<AssemblyVersion>0.1.2.0</AssemblyVersion>
|
||||
<FileVersion>0.1.2.0</FileVersion>
|
||||
<AssemblyVersion>0.1.4.0</AssemblyVersion>
|
||||
<FileVersion>0.1.4.0</FileVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
@@ -49,11 +50,7 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
{
|
||||
_logger.LogInformation("SmartNotify background service starting");
|
||||
|
||||
// Pre-populate DB with all existing library items so they're recognized as "known".
|
||||
// This prevents mass notifications on first run or after DB reset.
|
||||
SeedExistingLibraryItems();
|
||||
|
||||
// Subscribe to library events
|
||||
// Subscribe to library events (before seeding so we don't miss items added during seed).
|
||||
_libraryManager.ItemAdded += OnItemAdded;
|
||||
_libraryManager.ItemRemoved += OnItemRemoved;
|
||||
|
||||
@@ -63,6 +60,10 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
_processTimer.AutoReset = true;
|
||||
_processTimer.Start();
|
||||
|
||||
// Pre-populate DB with existing library items in the background
|
||||
// so we don't block Jellyfin startup.
|
||||
_ = Task.Run(() => SeedExistingLibraryItems(), cancellationToken);
|
||||
|
||||
_logger.LogInformation("SmartNotify is now monitoring library changes");
|
||||
|
||||
return Task.CompletedTask;
|
||||
@@ -318,10 +319,11 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
|
||||
if (item is Episode episode)
|
||||
{
|
||||
// episode.SeriesName / SeriesId are often null with Shokofin VFS,
|
||||
// but the Series navigation property usually works
|
||||
var seriesObj = episode.Series;
|
||||
notification.SeriesName = episode.SeriesName ?? seriesObj?.Name;
|
||||
var rawSeriesName = episode.SeriesName ?? seriesObj?.Name;
|
||||
// If the name still looks like a Sonarr folder name, leave it null
|
||||
// so the incomplete-episode logic defers until metadata scrape is done.
|
||||
notification.SeriesName = LooksLikeFolderName(rawSeriesName) ? null : rawSeriesName;
|
||||
notification.SeriesId = (episode.SeriesId != Guid.Empty
|
||||
? episode.SeriesId
|
||||
: seriesObj?.Id ?? Guid.Empty).ToString();
|
||||
@@ -430,18 +432,38 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
|
||||
var changed = false;
|
||||
|
||||
// Always refresh SeriesName from the library — at queue time the name
|
||||
// may have been the Sonarr folder name (before metadata refresh).
|
||||
// Refresh SeriesName from the library. At queue time the name is often
|
||||
// the Sonarr folder name (e.g. "Chained Soldier (2024) [tmdbid-139060]").
|
||||
// After Jellyfin's metadata scrape completes, the name changes to the
|
||||
// correct provider name (e.g. "Demon Slave - The Chained Soldier").
|
||||
// We detect the unscraped folder name by checking for bracket patterns
|
||||
// like [tmdbid-...] or (2024) and clear the SeriesName so the
|
||||
// incomplete-episode logic defers sending until the scrape is done.
|
||||
{
|
||||
var freshSeriesName = episode.SeriesName ?? episode.Series?.Name;
|
||||
if (!string.IsNullOrEmpty(freshSeriesName) && freshSeriesName != notification.SeriesName)
|
||||
if (!string.IsNullOrEmpty(freshSeriesName))
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"[DEBUG Refresh] SeriesName changed: '{Old}' -> '{New}'",
|
||||
notification.SeriesName,
|
||||
freshSeriesName);
|
||||
notification.SeriesName = freshSeriesName;
|
||||
changed = true;
|
||||
if (LooksLikeFolderName(freshSeriesName))
|
||||
{
|
||||
// Still the Sonarr folder name — clear so we keep waiting
|
||||
if (!string.IsNullOrEmpty(notification.SeriesName))
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"[DEBUG Refresh] SeriesName '{Name}' looks like a folder name, clearing to defer",
|
||||
freshSeriesName);
|
||||
notification.SeriesName = null;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if (freshSeriesName != notification.SeriesName)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"[DEBUG Refresh] SeriesName changed: '{Old}' -> '{New}'",
|
||||
notification.SeriesName,
|
||||
freshSeriesName);
|
||||
notification.SeriesName = freshSeriesName;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,6 +727,19 @@ public class SmartNotifyBackgroundService : IHostedService, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detects Sonarr-style folder names that haven't been replaced by a metadata scrape yet.
|
||||
/// Matches patterns like "[tmdbid-139060]", "[tvdbid-412656]", "[imdbid-tt1234]".
|
||||
/// </summary>
|
||||
private static readonly Regex FolderNamePattern = new(
|
||||
@"\[(tmdbid|tvdbid|imdbid)-[^\]]+\]",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
private static bool LooksLikeFolderName(string? name)
|
||||
{
|
||||
return !string.IsNullOrEmpty(name) && FolderNamePattern.IsMatch(name);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,30 @@
|
||||
"category": "Notifications",
|
||||
"imageUrl": "",
|
||||
"versions": [
|
||||
{
|
||||
"version": "0.1.4.0",
|
||||
"changelog": "## 0.1.4 (2026-04-07)\n\n### Bug Fixes\n\nLangsamer Start von Jellyfin wegen Überprüfung bestehender Einträge.\nLäuft nun asynchron.",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://git.tdpi.dev/TDPI/jellyfin-plugin-smartnotify/releases/download/v0.1.4/smartnotify_0.1.4.zip",
|
||||
"checksum": "6241bdf445f91732a917a8e56c956226",
|
||||
"timestamp": "2026-04-07T06:40:42Z"
|
||||
},
|
||||
{
|
||||
"version": "0.1.3.0",
|
||||
"changelog": "## 0.1.3 (2026-04-05)\n\n### Bug Fixes\n\nGebe keine Notification wenn der Name der Serie tmdbid oder ähnliches enthält.\nDies verhindert das die Notification kommt wenn noch nicht die Metadaten gezogen wurden.",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://git.tdpi.dev/TDPI/jellyfin-plugin-smartnotify/releases/download/v0.1.3/smartnotify_0.1.3.zip",
|
||||
"checksum": "0c8a24dcfed8884f768e5b2aad5f251c",
|
||||
"timestamp": "2026-04-05T16:13:21Z"
|
||||
},
|
||||
{
|
||||
"version": "0.1.2.0",
|
||||
"changelog": "## 0.1.2 (2026-04-04)\n\n### Bug Fixes\n\n* Problem behoben das der Serienname vor der Benachrichtigung nicht aktualisiert wurde.",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://git.tdpi.dev/TDPI/jellyfin-plugin-smartnotify/releases/download/v0.1.2/smartnotify_0.1.2.zip",
|
||||
"checksum": "56e2b0005f5bc3368c9a7f53b2f806a0",
|
||||
"timestamp": "2026-04-04T09:39:49Z"
|
||||
},
|
||||
{
|
||||
"version": "0.1.1.0",
|
||||
"changelog": "## 0.1.1 (2026-04-03)\n\n### Bug Fixes\n\n* fix: unknown series\n\n### Chores\n\n* chore: workflow fix\n* chore: removed old versions\n* chore: update manifest for v0.1.0",
|
||||
|
||||
Reference in New Issue
Block a user