Added work remaining url for remote extraction client

This commit is contained in:
2026-06-12 19:03:31 +02:00
parent 4c637de442
commit f1cffa7dfa
8 changed files with 220 additions and 4 deletions
@@ -35,4 +35,11 @@ public interface IManagedTruthStore
/// <param name="itemId">The Jellyfin library item id.</param>
/// <returns><c>true</c> if a file was deleted; <c>false</c> if none existed.</returns>
bool Delete(Guid itemId);
/// <summary>
/// Checks whether a managed truth file has been uploaded for the given item.
/// </summary>
/// <param name="itemId">The Jellyfin library item id.</param>
/// <returns><c>true</c> if a managed truth file exists.</returns>
bool Exists(Guid itemId);
}
@@ -24,4 +24,13 @@ public interface ITruthDataService
/// </summary>
/// <param name="itemId">The Jellyfin library item id.</param>
void Invalidate(Guid itemId);
/// <summary>
/// Cheaply checks whether truth data exists for an item (managed upload
/// or sidecar file), without loading or caching it.
/// </summary>
/// <param name="itemId">The Jellyfin library item id.</param>
/// <param name="itemPath">The item's media file path.</param>
/// <returns><c>true</c> if truth data exists for this item.</returns>
bool HasTruth(Guid itemId, string itemPath);
}
@@ -83,6 +83,12 @@ public sealed class ManagedTruthStore : IManagedTruthStore
return true;
}
/// <inheritdoc />
public bool Exists(Guid itemId)
{
return File.Exists(GetPath(itemId));
}
private string GetPath(Guid itemId)
{
return Path.Combine(_applicationPaths.PluginConfigurationsPath, "JRay", "truth", itemId.ToString("D") + ".json");
@@ -62,10 +62,7 @@ public sealed class TruthDataService : ITruthDataService
return null;
}
var suffix = Plugin.Instance?.Configuration.TruthFileSuffix ?? ".jray.json";
var truthPath = Path.Combine(
Path.GetDirectoryName(item.Path) ?? string.Empty,
Path.GetFileNameWithoutExtension(item.Path) + suffix);
var truthPath = GetSidecarPath(item.Path);
if (!File.Exists(truthPath))
{
@@ -95,5 +92,19 @@ public sealed class TruthDataService : ITruthDataService
_cache.TryRemove(itemId, out _);
}
/// <inheritdoc />
public bool HasTruth(Guid itemId, string itemPath)
{
return _managedTruthStore.Exists(itemId) || File.Exists(GetSidecarPath(itemPath));
}
private static string GetSidecarPath(string itemPath)
{
var suffix = Plugin.Instance?.Configuration.TruthFileSuffix ?? ".jray.json";
return Path.Combine(
Path.GetDirectoryName(itemPath) ?? string.Empty,
Path.GetFileNameWithoutExtension(itemPath) + suffix);
}
private sealed record CacheEntry(TruthFile? Truth, DateTime LoadedAt);
}