E3: seconda revisione di rimuxaggio, spazio, impostazioni e zip
Le quattro osservazioni confermate della seconda revisione, ognuna con la sua prova (ciascuna cade sul codice di prima): - Rimuxaggio con fotogrammi B: l'MP4 misura la fine della presentazione in tempo di composizione, non con la somma delle durate di decodifica. Prima nascondeva gli ultimi fotogrammi mostrati (2 in un iPhone) e durava altrettanto meno in elst, tkhd e mvhd. Per le tracce senza scarti di composizione i byte restano gli stessi. - Conversione della libreria: il lavoro ricorda il file che l'ha messo in pausa per spazio e quanto serve al suo convertito. Finché il disco non ha posto anche per quello, non rilegge l'originale a ogni risveglio (anche quando lo spazio libero sta appena sopra la soglia). - Impostazioni dell'esportazione: formati, chiavi «dal» e coda del formato sostituito si salvano in una transazione sola; «Anche i N» dopo il salvataggio non dipende più dalla richiesta. Il gancio della libreria legge formati e chiavi «dal» in una lettura. Una scheda chiusa o un arresto non lasciano più un formato senza la sua chiave né «Non riuscito» che «Riprova» non tocca. - Zip dei fotogrammi: i tempi del blocco passano da un TimeProvider della BCL, e la prova del lettore lento non dipende più dal carico della macchina. Decisioni in docs/decisioni.md (28/11). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
958cb71cd6
commit
2efb408957
13 files changed
+459
-49
No files matched your search
@@ -623,7 +623,8 @@ internal sealed class SettingsStore(FebeDatabase db) : ISettingsStore
|
||||
},
|
||||
ct);
|
||||
|
||||
private static void Set(WriteContext w, string key, string? value)
|
||||
/// <summary>Stores one value inside a write (null removes the key): also for stores that save settings with their rows.</summary>
|
||||
internal static void Set(WriteContext w, string key, string? value)
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
|
||||
@@ -188,12 +188,41 @@ internal sealed partial class MediaConversionStore
|
||||
}
|
||||
|
||||
public Task<int> DeleteQueueAsync(ExportFormat format, CancellationToken ct = default) =>
|
||||
db.WriteAsync(
|
||||
w => w.Command($"""
|
||||
DELETE FROM media_conversion
|
||||
WHERE format = @f AND (state = 'Pending' OR (state = 'Failed' AND (last_error IS NULL OR NOT ({AsIsCondition}))))
|
||||
""").With("@f", Sql.Enum(format)).ExecuteNonQuery(),
|
||||
db.WriteAsync(w => DeleteQueue(w, format), ct);
|
||||
|
||||
public Task<int> SaveSettingsAndDeleteQueuesAsync(IReadOnlyDictionary<string, string?> settings, IReadOnlyCollection<ExportFormat> formats, CancellationToken ct = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
ArgumentNullException.ThrowIfNull(formats);
|
||||
foreach (var key in settings.Keys)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(key);
|
||||
}
|
||||
|
||||
return db.WriteAsync(
|
||||
w =>
|
||||
{
|
||||
foreach (var (key, value) in settings)
|
||||
{
|
||||
SettingsStore.Set(w, key, value);
|
||||
}
|
||||
|
||||
var deleted = 0;
|
||||
foreach (var format in formats.Distinct())
|
||||
{
|
||||
deleted += DeleteQueue(w, format);
|
||||
}
|
||||
|
||||
return deleted;
|
||||
},
|
||||
ct);
|
||||
}
|
||||
|
||||
private static int DeleteQueue(WriteContext w, ExportFormat format) =>
|
||||
w.Command($"""
|
||||
DELETE FROM media_conversion
|
||||
WHERE format = @f AND (state = 'Pending' OR (state = 'Failed' AND (last_error IS NULL OR NOT ({AsIsCondition}))))
|
||||
""").With("@f", Sql.Enum(format)).ExecuteNonQuery();
|
||||
|
||||
public Task<bool> DeletePendingRowAsync(long id, CancellationToken ct = default) =>
|
||||
db.WriteAsync(
|
||||
|
||||
Reference in new issue
Block a user