feat(data): filter sequences by renders and sync state; read a remote sequence's first frame alone
SequenceQuery.Rendered and SyncStates back the Library's Rendered, Not rendered and Synced status choices. ISyncRemote.FirstFrameAsync reads one row of the frames page (default: the whole list), so a remote card without a hero frame no longer downloads the server's manifest for its thumbnail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
4 files changed
+31
-2
No files matched your search
@@ -35,6 +35,12 @@ public sealed record SequenceQuery
|
||||
|
||||
public string? Tag { get; init; }
|
||||
|
||||
/// <summary>True: with at least one render; false: without any; null: either.</summary>
|
||||
public bool? Rendered { get; init; }
|
||||
|
||||
/// <summary>Sync states of which the sequence must be in one; null or empty: any.</summary>
|
||||
public IReadOnlyCollection<SyncState>? SyncStates { get; init; }
|
||||
|
||||
/// <summary>Case-insensitive substring of the title, camera make/model or a tag.</summary>
|
||||
public string? Text { get; init; }
|
||||
|
||||
@@ -385,6 +391,8 @@ public sealed class SequenceRepository
|
||||
where.Add($"(s.status & {mask}) = {mask}");
|
||||
}
|
||||
if (query.WithoutStatus != SequenceStatus.None) where.Add($"(s.status & {p.Add((int)query.WithoutStatus)}) = 0");
|
||||
if (query.Rendered is { } rendered) where.Add(rendered ? "s.rendered_count > 0" : "s.rendered_count = 0");
|
||||
if (query.SyncStates is { Count: > 0 } states) where.Add($"s.sync_state IN ({string.Join(", ", states.Select(state => p.Add((int)state)))})");
|
||||
if (query.Tag is { } tag)
|
||||
where.Add("EXISTS (SELECT 1 FROM sequence_tags st JOIN tags t ON t.id = st.tag_id " +
|
||||
$"WHERE st.sequence_id = s.id AND t.name_key = {p.Add(TagRepository.Key(tag))})");
|
||||
|
||||
Reference in new issue
Block a user