Hide bogus duration badges on Album stills
The Album showed durations like -36:35, -136:23 and 545:26 on a Mavic Pro's photos. MediaItem.durationLabel only checked for null, but the SDK fills durationInSeconds for every file, so stills carry junk that was formatted straight into a badge. Require isVideo and a positive duration. Stills now get no badge and nonsense values are rejected; real clips are unaffected. Display-only — durationLabel renders in one place and nothing else reads it. Pre-existing, unrelated to the identity work; spotted while testing the Album against a real aircraft. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
002e484d80
commit
3e066c0a99
@@ -36,9 +36,13 @@ class MediaItem {
|
||||
/// On-disk path of the fully downloaded original, once available.
|
||||
String? localPath;
|
||||
|
||||
/// `null` for anything that shouldn't carry a duration. The SDK reports
|
||||
/// `durationInSeconds` for *every* file, so stills come back with junk —
|
||||
/// a Mavic Pro's photos yielded -36:35, -136:23 and 545:26 on the SD card.
|
||||
String? get durationLabel {
|
||||
if (durationSeconds == null) return null;
|
||||
final int s = durationSeconds!;
|
||||
if (!isVideo) return null;
|
||||
final int? s = durationSeconds;
|
||||
if (s == null || s <= 0) return null;
|
||||
final String mm = (s ~/ 60).toString();
|
||||
final String ss = (s % 60).toString().padLeft(2, '0');
|
||||
return '$mm:$ss';
|
||||
|
||||
Reference in New Issue
Block a user