feat(metadata): surface explicit content flag with [E] badge

Port of the explicit-content indicator from SpotiFLAC-Web (issue #456):

- Go: add explicit to ExtTrackMetadata (parsed generically from any
  extension via explicit/is_explicit/isExplicit), TrackMetadata, and
  AlbumTrackMetadata; built-in Deezer maps explicit_lyrics and
  explicit_content_lyrics == 1
- Dart: add explicit to the Track model with a tolerant
  parseExplicitFlag helper wired into all backend track parsers
- UI: new ExplicitBadge rendered through buildQualityBadges on album,
  playlist, search, and home track rows
This commit is contained in:
zarzet
2026-07-09 18:49:05 +07:00
parent 8abb9d119b
commit 4c83aeafb5
14 changed files with 137 additions and 11 deletions
+14
View File
@@ -6,6 +6,20 @@ String? normalizeOptionalString(String? value) {
return trimmed;
}
/// Parses the parental-advisory flag from backend/extension payloads, which
/// may arrive as a bool, a 0/1 number, or a "true"/"1" string.
bool? parseExplicitFlag(dynamic value) {
if (value == null) return null;
if (value is bool) return value;
if (value is num) return value == 1;
if (value is String) {
final normalized = value.trim().toLowerCase();
if (normalized.isEmpty || normalized == 'null') return null;
return normalized == 'true' || normalized == '1';
}
return null;
}
final RegExp _windowsAbsolutePathPattern = RegExp(r'^[A-Za-z]:[\\/]');
bool _looksLikeLocalReference(String value) {