diff --git a/i18n/en/Errors.resx b/i18n/en/Errors.resx index 7391b68d..77cce968 100644 --- a/i18n/en/Errors.resx +++ b/i18n/en/Errors.resx @@ -18,11 +18,15 @@ The sequence to render is no longer in the archive. Enter a server address such as nas.local:8443 or https://titano.example.com. This file does not contain Titano settings. - The archive disk needs {0} GB more for these originals.{0} gigabytes missing + This PC or the server changed the sequence again; compare and choose again. + The disk needs {0} GB more for this download.{0} gigabytes missing + {0} render is no longer on this PC; the others were sent.{0} count + {0} renders are no longer on this PC; the others were sent.{0} count {0} did not arrive intact; download it again.{0} file name The sequence is no longer in this PC's archive index. Open or create an archive on this PC to receive the originals. Not connected to this server; connect and retry the job. + This sequence is not on the server yet; upload it first. No original reached the server: they are missing here or already in another server sequence. {0} original is missing or changed since it was archived; verify the archive.{0} count {0} originals are missing or changed since they were archived; verify the archive.{0} count diff --git a/i18n/en/Library.resx b/i18n/en/Library.resx index b4bac4f4..cc92b057 100644 --- a/i18n/en/Library.resx +++ b/i18n/en/Library.resx @@ -62,10 +62,8 @@ Analysed Analysing Conflict - Newer here Proxies Remote - Newer on server Synced View Grid diff --git a/i18n/en/Server.resx b/i18n/en/Server.resx index 9e2ada8b..3d9acadf 100644 --- a/i18n/en/Server.resx +++ b/i18n/en/Server.resx @@ -13,9 +13,13 @@ Server certificate TLS {0} trusted {1} Cancel - {0}: {1} here, {2} on the serverlong; {0} setting path, {1} value on this PC, {2} value on the server + {0} differs{0} setting name + {0} {1} here, {2} on the serverlong; {0} setting name, {1} value on this PC, {2} value on the server The server copy of {0} will be replaced by this PC's settings.long; {0} sequence title Keep this PC's settings? + {0} · +{1}invariant; {0} first difference, {1} count of the others + This PC takes the server's version of {0} and keeps its own settings as a dated copy next to the project.long; {0} sequence title + Save both versions? This PC's settings of {0} will be replaced by the server copy.long; {0} sequence title Take the server's settings? Connect @@ -88,6 +92,7 @@ Sign in Sign in User + Pause metered uploads {0} of {1} {0} used Offer this PC as render node @@ -96,23 +101,64 @@ Uploader Viewer Titano time-lapse archive, uploads, jobs and rendering server.long + Aspect + auto + Batch list + Camera offset + Crop + Deflicker + Deflicker strength + Deflicker window + Excluded frames + Export folder + Export preset + Export values + Exposure offset + Fit to duration + Flow quality + Frame rate + Hero frame + Highlight knee + Holy grail + Camera keyframes + manual + Motion blur + Notes + off + on + Other setting + Output name + Rating + Regions + Shutter angle + Stabilisation + Stabilisation smoothing + Stacking + Tags + Time remap + Timing mode + Title + Trail length + Transitions + WB smoothing Sign out Connected Connecting… Disconnected Not connected Download originals + Get exports Keep mine Open with proxies Pause Resume Save both + Send exports Sync settings Take server Upload Server archive {1} · {0} sequencelong; {0} sequence count, {1} archive size Server archive {1} · {0} sequenceslong; {0} sequence count, {1} archive size - The server copy changed again; compare and choose again.long This PC Sequence Server @@ -134,9 +180,12 @@ {0} uploads queued{0} count {0} received{0} percent Not compared · retrying + This PC's settings savedlong Search + Show file settings differ downloading + not compared in sync newer here local only diff --git a/i18n/en/Tooltips.resx b/i18n/en/Tooltips.resx index 8995adcf..8158a6d1 100644 --- a/i18n/en/Tooltips.resx +++ b/i18n/en/Tooltips.resx @@ -111,11 +111,12 @@ SHA-256 fingerprint of the server certificate Forget this certificate; the next connection asks again Servers found on this network and used before - Keep JPEG proxies of every server sequence on this PC to edit without the originals; uses space in the cache folder + Keep the proxies of the server sequences you opened with proxies up to date on this PC, to edit without the originals; uses space in the cache folderlong Keep trusting this certificate Close without signing in · Esc Sent only to this server; Titano keeps a session token, never the password Your user name on the server + Pause uploads while Windows reports this connection as metered; they resume by themselves when it is notlong Space you use on the server out of your quota Let the server send render jobs to this PC when it is idle; uses your GPU encoders Admins manage users, the archive and the server @@ -131,6 +132,8 @@ Settings differ between this PC and the server Only on this PC Only on the server + Copy the server's render to this PC ({1}){0} count, {1} size + Copy the {0} server renders to this PC ({1}){0} count, {1} size Overwrite the server copy with this PC's settings When this PC last compared every sequence with the server, and how long it took Open the web admin in your browser (admins only) @@ -140,8 +143,12 @@ The last comparison failed: {0}. It is retried automatically.{0} reason Take the server copy and keep this PC's settings as a dated copy of the project Filter the table by sequence title + Send this PC's render to the server, verified by hash ({1}){0} count, {1} size + Send this PC's {0} renders to the server, verified by hash ({1}){0} count, {1} size + Show the saved copy of this PC's settings in File Explorer Settings changed both here and on the server; choose which to keep Originals or proxies are arriving from the server + This sequence could not be compared: {0}. It is compared again automatically.long; {0} reason Same originals and settings on this PC and on the server This PC has originals or settings the server does not have yet Only on this PC; upload it to keep it on the server too @@ -155,6 +162,9 @@ Replace this PC's settings with the server copy Copy originals and settings to the server ({0}){0} size Send every local-only sequence to the server ({0} sequences, {1}){0} count, {1} size + Your account cannot upload to this server + Connect to a server to upload + No sequence is only on this PC Trust this certificate for this server and continue to sign in Use this address Graphics adapter and Media Foundation encoders found diff --git a/i18n/it/Errors.it.resx b/i18n/it/Errors.it.resx index 7bc74c12..be3d5591 100644 --- a/i18n/it/Errors.it.resx +++ b/i18n/it/Errors.it.resx @@ -18,11 +18,15 @@ La sequenza da renderizzare non è più nell'archivio. Inserisci l'indirizzo di un server, ad esempio nas.local:8443 o https://titano.example.com. Questo file non contiene impostazioni di Titano. - Al disco dell'archivio servono altri {0} GB per questi originali. + La sequenza è cambiata di nuovo su questo PC o sul server; confronta e scegli di nuovo. + Al disco servono altri {0} GB per questo scaricamento. + {0} render non è più su questo PC; gli altri sono stati inviati. + {0} render non sono più su questo PC; gli altri sono stati inviati. {0} non è arrivato integro; scaricalo di nuovo. La sequenza non è più nell'indice dell'archivio di questo PC. Apri o crea un archivio su questo PC per ricevere gli originali. Non connesso a questo server; collegati e riprova l'attività. + Questa sequenza non è ancora sul server; caricala prima. Nessun originale è arrivato al server: mancano qui o sono già in un'altra sequenza del server. {0} originale manca o è cambiato dopo l'archiviazione; verifica l'archivio. {0} originali mancano o sono cambiati dopo l'archiviazione; verifica l'archivio. diff --git a/i18n/it/Library.it.resx b/i18n/it/Library.it.resx index 29240386..5d75b9af 100644 --- a/i18n/it/Library.it.resx +++ b/i18n/it/Library.it.resx @@ -62,10 +62,8 @@ Analizzata In analisi Conflitto - Più recente qui Proxy Remota - Più recente sul server Sincronizzata Vista Griglia diff --git a/i18n/it/Server.it.resx b/i18n/it/Server.it.resx index b5bd92ab..ab68efee 100644 --- a/i18n/it/Server.it.resx +++ b/i18n/it/Server.it.resx @@ -4,7 +4,7 @@ 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Sincronia automatica progetti + Sincronizza progetti automaticamente Certificato Dimentica Mantieni @@ -12,9 +12,12 @@ Certificato del server TLS {0} attendibile dal {1} Annulla - {0}: {1} qui, {2} sul server + {0}: valori diversi + {0} {1} qui, {2} sul server La copia sul server di {0} sarà sostituita dalle impostazioni di questo PC. Tenere le impostazioni di questo PC? + Questo PC prende la versione del server di {0} e conserva le proprie impostazioni come copia datata accanto al progetto. + Salvare entrambe le versioni? Le impostazioni di {0} su questo PC saranno sostituite dalla copia del server. Usare le impostazioni del server? Connetti @@ -87,6 +90,7 @@ Accedi Accedi Utente + Pausa su reti a consumo {0} di {1} {0} usati Offri questo PC per il rendering @@ -95,23 +99,64 @@ Caricatore Visualizzatore Server Titano per archivio time-lapse, caricamenti, job e rendering. + Proporzioni + auto + Elenco batch + Spostamento camera + Ritaglio + Deflicker + Intensità deflicker + Finestra deflicker + Fotogrammi esclusi + Cartella di esportazione + Preset di esportazione + Valori di esportazione + Correzione esposizione + Adatta alla durata + Qualità del flusso + Frequenza fotogrammi + Fotogramma copertina + Compressione alte luci + Holy grail + Keyframe camera + manuale + Sfocatura di movimento + Note + disattivo + attivo + Altra impostazione + Nome del file + Valutazione + Regioni + Angolo otturatore + Stabilizzazione + Morbidezza stabilizzazione + Stacking + Tag + Rimappatura del tempo + Modalità dei tempi + Titolo + Lunghezza scie + Transizioni + Livellamento WB Esci Connesso Connessione… Disconnesso Non connesso Scarica originali + Ricevi esportazioni Tieni le mie Apri con i proxy Pausa Riprendi Salva entrambe + Invia esportazioni Sincronizza Usa il server Carica Archivio del server {1} · {0} sequenza Archivio del server {1} · {0} sequenze - La copia sul server è cambiata di nuovo; confronta e scegli di nuovo. Questo PC Sequenza Server @@ -123,7 +168,7 @@ Conflitti · {0} Solo locali · {0} Sul server · {0} - Ultima sincronia {0} · confronto {1} s + Ultima sincronizzazione {0} · confronto {1} s Nessuna sequenza corrisponde Apri pannello admin originali @@ -131,21 +176,24 @@ {0} caricamento in coda {0} caricamenti in coda {0} ricevuto - Confronto non riuscito · riprovo + Confronto fallito · riprovo + Impostazioni di questo PC salvate Cerca + Mostra file impostazioni diverse in scaricamento + non confrontata sincronizzata più recente qui solo locale in pausa solo proxy sul server - più recente sul server + server più recente in caricamento in attesa Sequenze - Carica tutte le locali + Carica le locali Considera attendibile Annulla {0} usa un certificato che Titano non conosce ancora. Confronta l'impronta con quella del pannello di amministrazione del server prima di considerarlo attendibile. diff --git a/i18n/it/Tooltips.it.resx b/i18n/it/Tooltips.it.resx index cd171b20..8b59f72e 100644 --- a/i18n/it/Tooltips.it.resx +++ b/i18n/it/Tooltips.it.resx @@ -111,11 +111,12 @@ Impronta SHA-256 del certificato del server Dimentica questo certificato; alla prossima connessione verrà chiesto di nuovo Server trovati in questa rete e usati in precedenza - Tieni su questo PC i proxy JPEG di ogni sequenza del server per lavorare senza gli originali; usa spazio nella cartella cache + Mantieni aggiornati su questo PC i proxy delle sequenze del server aperte con i proxy, per lavorare senza gli originali; usa spazio nella cartella cache Continua a considerare attendibile questo certificato Chiude senza accedere · Esc Inviata solo a questo server; Titano conserva un token di sessione, mai la password Il tuo nome utente sul server + Mette in pausa i caricamenti mentre Windows segnala questa connessione come a consumo; riprendono da soli quando non lo è Spazio che usi sul server rispetto alla tua quota Permette al server di inviare rendering a questo PC quando è inattivo; usa gli encoder della tua GPU Gli amministratori gestiscono utenti, archivio e server @@ -131,6 +132,8 @@ Le impostazioni differiscono tra questo PC e il server Solo su questo PC Solo sul server + Copia su questo PC il render del server ({1}) + Copia su questo PC i {0} render del server ({1}) Sovrascrivi la copia del server con le impostazioni di questo PC Quando questo PC ha confrontato per l'ultima volta tutte le sequenze con il server, e quanto ha impiegato Apri l'amministrazione web nel browser (solo amministratori) @@ -140,8 +143,12 @@ L'ultimo confronto non è riuscito: {0}. Viene ripetuto automaticamente. Usa la copia del server e conserva le impostazioni di questo PC come copia datata del progetto Filtra la tabella per titolo della sequenza + Invia al server il render di questo PC, verificato con l'hash ({1}) + Invia al server i {0} render di questo PC, verificati con l'hash ({1}) + Mostra in Esplora file la copia salvata delle impostazioni di questo PC Le impostazioni sono cambiate sia qui sia sul server; scegli quali tenere Originali o proxy in arrivo dal server + Questa sequenza non è stata confrontata: {0}. Il confronto viene ripetuto automaticamente. Stessi originali e impostazioni su questo PC e sul server Questo PC ha originali o impostazioni che il server non ha ancora Solo su questo PC; caricala per averla anche sul server @@ -155,6 +162,9 @@ Sostituisci le impostazioni di questo PC con la copia del server Copia originali e impostazioni sul server ({0}) Invia al server ogni sequenza solo locale ({0} sequenze, {1}) + Il tuo account non può caricare su questo server + Collegati a un server per caricare + Nessuna sequenza è solo su questo PC Considera attendibile questo certificato per questo server e prosegui con l'accesso Usa questo indirizzo Scheda grafica ed encoder Media Foundation trovati diff --git a/src/Titano.App/DesignTime/SampleData.cs b/src/Titano.App/DesignTime/SampleData.cs index 5bcf98c6..348785f7 100644 --- a/src/Titano.App/DesignTime/SampleData.cs +++ b/src/Titano.App/DesignTime/SampleData.cs @@ -9,6 +9,7 @@ using Titano.Core.Imaging; using Titano.Core.Model; using Titano.Core.Video; using Titano.Data; +using Titano.Data.Jobs; using Titano.Data.Sync; using Titano.Protocol; using Titano.Protocol.Client; @@ -31,6 +32,8 @@ public sealed class SampleData private readonly AppServices _services; private readonly SampleSyncRemote _remote = new(); private TitanoDatabase? _db; + private Guid _sunrise; + private Guid _lakeComo; private SampleData(AppServices services) => _services = services; @@ -87,55 +90,84 @@ public sealed class SampleData settings.FirstRunCompleted = true; } - /// An upload in progress for the sync table (Comet over the ridge, 46 %). + /// + /// Transfers for the sync table: an upload at 46 % (Comet over the ridge), an upload waiting (Fog lifting, Asti), a + /// download of originals running (Sunrise over Superga) and one paused (Lake Como storm). + /// public async Task FillSyncAsync() { var db = _db ?? throw new InvalidOperationException("FillAsync first."); - var comet = (await db.Sequences.ListAsync(new Data.Repositories.SequenceQuery { Text = "Comet", Limit = 1 })).Items[0]; + async Task LocalAsync(string text) => (await db.Sequences.ListAsync(new Data.Repositories.SequenceQuery { Text = text, Limit = 1 })).Items[0]; var now = DateTimeOffset.UtcNow; - await db.Jobs.EnqueueAsync(new Job + Job Transfer(JobKind kind, Guid target, string label, string parameters, JobState state, long done, long total) => new() { Id = Guid.CreateVersion7(), - Kind = JobKind.UploadCommit, - TargetIds = [comet.Id], - TargetLabel = comet.DisplayTitle, - ParametersJson = $$"""{"server":"{{ServerAddress}}"}""", - State = JobState.Running, + Kind = kind, + TargetIds = [target], + TargetLabel = label, + ParametersJson = parameters, + State = state, Priority = JobPriority.User, - ProgressDone = 462, - ProgressTotal = 1_005, - ItemsPerSecond = 1.6, - Eta = TimeSpan.FromMinutes(4), - NodeId = _services.WorkerId, - Attempts = 1, + ProgressDone = done, + ProgressTotal = total, + ItemsPerSecond = state == JobState.Running ? 1.6 : null, + Eta = state == JobState.Running ? TimeSpan.FromMinutes(4) : null, + NodeId = state == JobState.Queued ? null : _services.WorkerId, + Attempts = state == JobState.Queued ? 0 : 1, Created = now.AddMinutes(-5), - Started = now.AddMinutes(-5), - }); + Started = state == JobState.Queued ? null : now.AddMinutes(-5), + }; + var upload = $$"""{"server":"{{ServerAddress}}"}"""; + var originals = $$"""{"server":"{{ServerAddress}}","mode":"Originals"}"""; + var comet = await LocalAsync("Comet"); + var fog = await LocalAsync("Fog lifting"); + await db.Jobs.EnqueueAsync(Transfer(JobKind.UploadCommit, comet.Id, comet.DisplayTitle, upload, JobState.Running, 462, 1_005)); + await db.Jobs.EnqueueAsync(Transfer(JobKind.UploadCommit, fog.Id, fog.DisplayTitle, upload, JobState.Queued, 0, 0)); + await db.Jobs.EnqueueAsync(Transfer(JobKind.Download, _sunrise, "Sunrise over Superga", originals, JobState.Running, 1_210, 2_880)); + await db.Jobs.EnqueueAsync(Transfer(JobKind.Download, _lakeComo, "Lake Como storm", originals, JobState.Paused, 300, 1_450)); } /// - /// The server's side: four sequences this PC also holds (two the same, one with settings changed on both sides, one - /// with more originals on the server) and two only on the server; the others are only here. + /// Fetches the proxies of Sunrise over Superga into the proxy cache through a download job on a one-off engine (the + /// capture's engine does not run jobs), so the sync table shows a sequence kept with proxies only. + /// + public async Task CacheProxiesAsync() + { + var db = _db ?? throw new InvalidOperationException("FillAsync first."); + var service = _services.Sync.Service ?? throw new InvalidOperationException("The index is not open."); + await using var engine = new JobEngine(db, service.CreateJobHandlers(_services.Sync), + new JobEngineOptions { Workers = 1, WorkerId = "sample-proxies", Kinds = [JobKind.Download], PollInterval = TimeSpan.FromMilliseconds(50) }); + await engine.StartAsync(); + var job = await service.EnqueueDownloadAsync(engine, ServerAddress, _sunrise, "Sunrise over Superga", SyncDownloadMode.Proxies, null); + for (var i = 0; i < 200 && await db.Jobs.GetAsync(job.Id) is { State: JobState.Queued or JobState.Running }; i++) await Task.Delay(50); + } + + /// + /// The server's side: six sequences this PC also holds (two the same, one with settings changed on both sides, one + /// with more originals on the server, one with more here, one with renders this PC lacks) and two only on the server; + /// the others are only here. /// private async Task FillServerAsync(TitanoDatabase db, IReadOnlyList local) { Guid Id(string title) => local.First(s => s.Title == title).Id; await db.Sequences.EditAsync(Id("Holy grail · Monviso"), new Data.Repositories.SequenceEdit { SettingsJson = DeflickerWindow(41) }, null); - var linked = new (string Title, int Frames, string? Settings)[] + var linked = new (string Title, int Frames, string? Settings, int Renders)[] { - ("Harbour sunset", 3, null), - ("Aurora, Tromsø", 3, null), - ("Holy grail · Monviso", 3, DeflickerWindow(33)), - ("Construction cam · week 38", 8, null), + ("Harbour sunset", 3, null, 0), + ("Aurora, Tromsø", 3, null, 0), + ("Holy grail · Monviso", 3, DeflickerWindow(33), 0), + ("Construction cam · week 38", 8, null, 0), + ("Milan skyline dusk", 1, null, 0), + ("Star trails, Colle del Nivolet", 3, null, 3), }; - foreach (var (title, frames, settings) in linked) + foreach (var (title, frames, settings, renders) in linked) { // The server's copy carries the same title, tags and rating as this PC's. var sequence = (await db.Sequences.GetAsync(Id(title)))!; - var remote = _remote.Add(SampleSyncRemote.Dto(sequence), settings, frames); + var remote = _remote.Add(SampleSyncRemote.Dto(sequence) with { RenderedCount = renders }, settings, frames); await _services.Sync.Service!.LinkAsync(ServerAddress, remote, sequence.Id); } - _remote.Add(SampleSyncRemote.Dto(new Sequence + _sunrise = _remote.Add(SampleSyncRemote.Dto(new Sequence { Id = Guid.CreateVersion7(), ArchiveId = Guid.Empty, @@ -147,7 +179,7 @@ public sealed class SampleData RenderedCount = 1, UpdatedAt = DateTimeOffset.UtcNow, }), null, 3); - _remote.Add(SampleSyncRemote.Dto(new Sequence + _lakeComo = _remote.Add(SampleSyncRemote.Dto(new Sequence { Id = Guid.CreateVersion7(), ArchiveId = Guid.Empty, @@ -395,11 +427,12 @@ public sealed class SampleData /// /// The sample server's sequences for the sync table: listings, manifests (frames hashed from their index, so - /// unhashed sample frames match them by count) and settings edits; transfers are not part of the screenshots. + /// unhashed sample frames match them by count; renders as many as the listing says), settings edits and proxies + /// (generated JPEGs); uploads and originals are not part of the screenshots. /// private sealed class SampleSyncRemote : ISyncRemote { - private readonly Dictionary _sequences = []; + private readonly Dictionary _sequences = []; public string Server => ServerAddress; @@ -409,39 +442,73 @@ public sealed class SampleData public Guid Add(SequenceDto dto, string? settings, int frames) { - _sequences[dto.Id] = (dto, settings, frames); + lock (_sequences) _sequences[dto.Id] = (dto, settings, [.. Enumerable.Range(0, frames).Select(_ => Guid.CreateVersion7())]); return dto.Id; } - public Task> ListSequencesAsync(CancellationToken cancellationToken) => - Task.FromResult>([.. _sequences.Values.Select(s => s.Dto)]); + public Task> ListSequencesAsync(CancellationToken cancellationToken) + { + lock (_sequences) return Task.FromResult>([.. _sequences.Values.Select(s => s.Dto)]); + } - public Task GetSequenceAsync(Guid id, CancellationToken cancellationToken) => Task.FromResult(_sequences[id].Dto); + public Task GetSequenceAsync(Guid id, CancellationToken cancellationToken) + { + lock (_sequences) return Task.FromResult(_sequences[id].Dto); + } public Task GetManifestAsync(Guid id, CancellationToken cancellationToken) { - var (dto, settings, frames) = _sequences[id]; - var hasProxy = (dto.Status & (long)SequenceStatus.ProxiesBuilt) != 0; - return Task.FromResult(new SequenceManifest(id, dto.FramesVersion, dto.SettingsVersion, settings, dto.Tags, - [.. Enumerable.Range(0, frames).Select(i => new ManifestFrame(Guid.CreateVersion7(), i, $"IMG_{i + 1:0000}.JPG", 24_000_000, - Convert.ToHexStringLower(System.Security.Cryptography.SHA256.HashData(BitConverter.GetBytes(i))), hasProxy, true))], [])); + lock (_sequences) + { + var (dto, settings, frames) = _sequences[id]; + var hasProxy = (dto.Status & (long)SequenceStatus.ProxiesBuilt) != 0; + var created = new DateTimeOffset(2026, 9, 20, 21, 0, 0, TimeSpan.Zero); + return Task.FromResult(new SequenceManifest(id, dto.FramesVersion, dto.SettingsVersion, settings, dto.Tags, + [.. frames.Select((frame, i) => new ManifestFrame(frame, i, $"IMG_{i + 1:0000}.JPG", 24_000_000, + Convert.ToHexStringLower(System.Security.Cryptography.SHA256.HashData(BitConverter.GetBytes(i))), hasProxy, true))], + [.. Enumerable.Range(0, dto.RenderedCount).Select(i => new RenderDto(Guid.CreateVersion7(), i == 0 ? "4K HEVC" : "1080p H.264", "hevc", + 3840, 2160, 30, 21.3, 640_000_000, created.AddHours(i), "Studio NAS"))])); + } } - public Task> ListFramesAsync(Guid sequenceId, CancellationToken cancellationToken) => Task.FromResult>([]); + public Task> ListFramesAsync(Guid sequenceId, CancellationToken cancellationToken) + { + lock (_sequences) + { + return Task.FromResult>([.. _sequences[sequenceId].Frames.Select((frame, i) => new FrameDto(frame, sequenceId, i, + $"IMG_{i + 1:0000}.JPG", 24_000_000, null, new DateTime(2026, 7, 2, 5, 40, 0).AddSeconds(30 * i), null, 1.0 / 250, 8, 100, 24, 1, 320, 180, + "jpeg", 0))]); + } + } public Task UpdateSequenceAsync(Guid id, UpdateSequenceRequest request, CancellationToken cancellationToken) { - var (dto, _, frames) = _sequences[id]; - var updated = dto with { SettingsVersion = dto.SettingsVersion + 1, UpdatedAt = DateTimeOffset.UtcNow }; - _sequences[id] = (updated, request.SettingsJson, frames); - return Task.FromResult(updated); + lock (_sequences) + { + var (dto, _, frames) = _sequences[id]; + var updated = dto with { SettingsVersion = dto.SettingsVersion + 1, UpdatedAt = DateTimeOffset.UtcNow }; + _sequences[id] = (updated, request.SettingsJson, frames); + return Task.FromResult(updated); + } } public Task UploadFileAsync(string path, Guid? sequenceId, string? sessionKey, string sha256, DateTime? capturedAt, CancellationToken cancellationToken) => throw new NotSupportedException("The sample server takes no uploads."); - public Task DownloadFrameAsync(Guid frameId, string kind, Stream destination, CancellationToken cancellationToken) => - throw new NotSupportedException("The sample server serves no files."); + /// Proxies and thumbnails: a dawn gradient whose sun rises with the frame. + public async Task DownloadFrameAsync(Guid frameId, string kind, Stream destination, CancellationToken cancellationToken) + { + if (kind == "original") throw new NotSupportedException("The sample server serves no originals."); + int index; + lock (_sequences) index = _sequences.Values.Select(s => Array.IndexOf(s.Frames, frameId)).Max(); + await destination.WriteAsync(Gradient(["#1B2A4A", "#E8925A", "#F6D28B"], 320, 180, index / 3.0), cancellationToken); + } + + public Task DownloadRenderAsync(Guid renderId, Stream destination, CancellationToken cancellationToken) => + throw new NotSupportedException("The sample server serves no renders."); + + public Task UploadRenderAsync(Guid sequenceId, string path, RenderUploadRequest request, CancellationToken cancellationToken) => + throw new NotSupportedException("The sample server takes no renders."); public async IAsyncEnumerable EventsAsync([System.Runtime.CompilerServices.EnumeratorCancellation] CancellationToken cancellationToken) { diff --git a/src/Titano.App/Infrastructure/AppSettings.cs b/src/Titano.App/Infrastructure/AppSettings.cs index dcf5bb47..31514da3 100644 --- a/src/Titano.App/Infrastructure/AppSettings.cs +++ b/src/Titano.App/Infrastructure/AppSettings.cs @@ -111,12 +111,15 @@ public sealed class AppSettings /// Let the server send render jobs to this PC (BRIEF §14.7). public bool RenderNodeOptIn { get; set; } - /// Keep the proxies of every server sequence without local originals in the cache (BRIEF §12.7). + /// Keep the proxy caches of the server sequences this PC opened with proxies up to date (BRIEF §12.7). public bool KeepProxiesOffline { get; set; } /// Send and take project settings changed on one side without asking (Server.html). public bool SyncSettingsAutomatically { get; set; } = true; + /// Pause upload jobs while Windows reports the connection as metered (Server.html). + public bool PauseUploadsOnMetered { get; set; } + // ---- Jobs ---- /// "Clear done": finished jobs older than this are hidden from the Jobs list (they stay in the history). public DateTimeOffset? JobsClearedAt { get; set; } diff --git a/src/Titano.App/Library/SequenceItem.cs b/src/Titano.App/Library/SequenceItem.cs index ef467181..28771425 100644 --- a/src/Titano.App/Library/SequenceItem.cs +++ b/src/Titano.App/Library/SequenceItem.cs @@ -147,17 +147,20 @@ public sealed class SequenceItem : ObservableObject OnPropertyChanged(nameof(PrimaryStatus)); } - /// Where a local copy stands against the server (the sync engine writes the state); null while it is only here. + /// + /// Where a local copy stands against the server (the sync engine writes the state), in one word as DESIGN §4 draws + /// it ("● Synced", "● Remote", "▲ Conflict") with the detail in the tooltip; null while it is only here. + /// public static CardStatus? SyncStatus(SyncState state) => state switch { SyncState.InSync => new CardStatus(StatusKind.Synced, Loc.L("Library.Status.Synced"), Loc.L("Tooltips.Library.Status.Synced")), - SyncState.LocalAhead => new CardStatus(StatusKind.Synced, Loc.L("Library.Status.LocalAhead"), Loc.L("Tooltips.Library.Status.LocalAhead")), - SyncState.ServerAhead => new CardStatus(StatusKind.Remote, Loc.L("Library.Status.ServerAhead"), Loc.L("Tooltips.Library.Status.ServerAhead")), + SyncState.LocalAhead => new CardStatus(StatusKind.Synced, Loc.L("Library.Status.Synced"), Loc.L("Tooltips.Library.Status.LocalAhead")), + SyncState.ServerAhead => new CardStatus(StatusKind.Remote, Loc.L("Library.Status.Remote"), Loc.L("Tooltips.Library.Status.ServerAhead")), SyncState.Conflict => new CardStatus(StatusKind.Warning, Loc.L("Library.Status.Conflict"), Loc.L("Tooltips.Library.Status.Conflict")), _ => null, }; - /// Card status row: analysed, proxies, renders, sync, warnings (Main.html). + /// Card status row: analysed, proxies, renders, errors or warnings, sync (Main.html); the sync glyph is last so a narrow card cuts it first. public static IReadOnlyList BuildStatuses(Sequence s, bool analysing) { var list = new List(5); @@ -178,11 +181,11 @@ public sealed class SequenceItem : ObservableObject if (s.RenderedCount > 0) list.Add(new CardStatus(StatusKind.Rendered, Formatting.Count(s.RenderedCount), Loc.Plural("Tooltips.Library.Status.Rendered", s.RenderedCount))); - if (SyncStatus(s.SyncState) is { } sync) list.Add(sync); if ((s.Status & SequenceStatus.HasErrors) != 0) list.Add(new CardStatus(StatusKind.Error, Formatting.Count(Math.Max(1, s.WarningCount)), Loc.L("Tooltips.Library.Status.Errors"))); else if (s.WarningCount > 0 || (s.Status & SequenceStatus.HasWarnings) != 0) list.Add(new CardStatus(StatusKind.Warning, Formatting.Count(Math.Max(1, s.WarningCount)), Loc.Plural("Tooltips.Library.Status.Warnings", Math.Max(1, s.WarningCount)))); + if (SyncStatus(s.SyncState) is { } sync) list.Add(sync); return list; } } diff --git a/src/Titano.App/Sections/LibraryViewModel.cs b/src/Titano.App/Sections/LibraryViewModel.cs index a70ed8d7..b4a185a1 100644 --- a/src/Titano.App/Sections/LibraryViewModel.cs +++ b/src/Titano.App/Sections/LibraryViewModel.cs @@ -497,7 +497,10 @@ public sealed class LibraryViewModel : SectionViewModel { if (await _db.Sequences.GetAsync(item.Id) is { } fresh) item.Update(fresh); } - if (job.Kind is JobKind.Scan or JobKind.Rebuild or JobKind.Import or JobKind.Adopt or JobKind.Move or JobKind.UploadCommit or JobKind.Download) await RefreshAsync(); + // Downloads of proxies only fill the proxy cache, so the Library is read again for originals and exports only. + if (job.Kind is JobKind.Scan or JobKind.Rebuild or JobKind.Import or JobKind.Adopt or JobKind.Move or JobKind.UploadCommit + || Data.Sync.SyncService.TransferKind(job) is Data.Sync.SyncTransferKind.DownloadOriginals or Data.Sync.SyncTransferKind.GetExports) + await RefreshAsync(); } catch (DatabaseException ex) { diff --git a/src/Titano.App/Sections/ServerView.xaml b/src/Titano.App/Sections/ServerView.xaml index c4d1d067..a6bdfcd5 100644 --- a/src/Titano.App/Sections/ServerView.xaml +++ b/src/Titano.App/Sections/ServerView.xaml @@ -117,6 +117,7 @@ + @@ -132,37 +133,51 @@ - + + + + + + + + + -