mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-21 03:21:01 +02:00
chore: remove redundant comments and update donor list
This commit is contained in:
@@ -2473,7 +2473,6 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
_locallyCancelledItemIds.remove(id);
|
||||
}
|
||||
|
||||
// Clean accumulator entry for non-completed items.
|
||||
if (item.status != DownloadStatus.completed) {
|
||||
final key = _albumRgKey(item.track);
|
||||
final accumulator = _albumRgData[key];
|
||||
@@ -2499,7 +2498,6 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
}
|
||||
|
||||
void clearCompleted() {
|
||||
// Purge accumulator entries for failed/skipped items being removed.
|
||||
final removedItems = state.items.where(
|
||||
(item) =>
|
||||
item.status == DownloadStatus.completed ||
|
||||
@@ -2760,7 +2758,6 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
}
|
||||
|
||||
void clearFailedDownloads() {
|
||||
// Purge accumulator entries for failed items before removing them.
|
||||
final failedItems = state.items
|
||||
.where((item) => item.status == DownloadStatus.failed)
|
||||
.toList();
|
||||
@@ -2883,7 +2880,6 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
final key = _albumRgKey(track);
|
||||
final accumulator = _albumRgData[key];
|
||||
if (accumulator == null) return;
|
||||
// Find the entry for this track and update its file path in-place.
|
||||
for (final entry in accumulator.entries) {
|
||||
if (entry.trackId == track.id) {
|
||||
entry.filePath = finalPath;
|
||||
@@ -2969,7 +2965,6 @@ class DownloadQueueNotifier extends Notifier<DownloadQueueState> {
|
||||
'Album ReplayGain for "$key": gain=$albumGain, peak=$albumPeak (${validEntries.length} tracks, album LUFS=${albumLufs.toStringAsFixed(1)})',
|
||||
);
|
||||
|
||||
// Write album gain to every completed track file.
|
||||
for (final entry in validEntries) {
|
||||
try {
|
||||
await _writeAlbumReplayGain(entry.filePath, albumGain, albumPeak);
|
||||
|
||||
@@ -496,7 +496,6 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if live search is available (extension is set as search provider)
|
||||
bool _isLiveSearchEnabled() {
|
||||
final settings = ref.read(settingsProvider);
|
||||
final extState = ref.read(extensionProvider);
|
||||
@@ -564,7 +563,6 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
}
|
||||
}
|
||||
|
||||
/// Built-in search providers that are not extensions
|
||||
static const _builtInSearchProviders = {'tidal', 'qobuz'};
|
||||
|
||||
Future<void> _performSearch(String query, {String? filterOverride}) async {
|
||||
@@ -599,7 +597,6 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
.read(trackProvider.notifier)
|
||||
.customSearch(searchProvider, query, options: options);
|
||||
} else if (isBuiltInProvider) {
|
||||
// Use built-in Tidal or Qobuz search
|
||||
await ref
|
||||
.read(trackProvider.notifier)
|
||||
.search(
|
||||
@@ -1122,7 +1119,7 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
title: Text(
|
||||
context.l10n.homeTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 20 + (14 * expandRatio), // 20 -> 34
|
||||
fontSize: 20 + (14 * expandRatio),
|
||||
fontWeight: FontWeight.bold,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
@@ -1496,7 +1493,7 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
) {
|
||||
final hasGreeting = greeting != null && greeting.isNotEmpty;
|
||||
final sectionOffset = hasGreeting ? 1 : 0;
|
||||
final totalCount = sections.length + sectionOffset + 1; // + bottom padding
|
||||
final totalCount = sections.length + sectionOffset + 1;
|
||||
|
||||
return [
|
||||
SliverList(
|
||||
@@ -2939,7 +2936,7 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
albumId: album.id,
|
||||
albumName: album.name,
|
||||
coverUrl: album.imageUrl,
|
||||
tracks: const [], // Will be fetched by AlbumScreen
|
||||
tracks: const [],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -2965,7 +2962,7 @@ class _HomeTabState extends ConsumerState<HomeTab>
|
||||
builder: (context) => PlaylistScreen(
|
||||
playlistName: playlist.name,
|
||||
coverUrl: playlist.imageUrl,
|
||||
tracks: const [], // Will be fetched
|
||||
tracks: const [],
|
||||
playlistId: playlist.id,
|
||||
),
|
||||
),
|
||||
@@ -3694,7 +3691,7 @@ class _TrackItemWithStatus extends ConsumerWidget {
|
||||
thickness: 1,
|
||||
indent:
|
||||
thumbWidth +
|
||||
24, // Adjust divider indent based on thumbnail width
|
||||
24,
|
||||
endIndent: 12,
|
||||
color: colorScheme.outlineVariant.withValues(alpha: 0.3),
|
||||
),
|
||||
|
||||
@@ -1132,11 +1132,11 @@ class _QueueTabState extends ConsumerState<QueueTab> {
|
||||
String? _filterCacheFormat;
|
||||
String? _filterCacheMetadata;
|
||||
String _filterCacheSortMode = 'latest';
|
||||
String? _filterSource; // null = all, 'downloaded', 'local'
|
||||
String? _filterQuality; // null = all, 'hires', 'cd', 'lossy'
|
||||
String? _filterFormat; // null = all, 'flac', 'mp3', 'm4a', 'opus', 'ogg'
|
||||
String? _filterMetadata; // null = all, 'complete', 'missing-*'
|
||||
String _sortMode = 'latest'; // 'latest', 'oldest', 'a-z', 'z-a'
|
||||
String? _filterSource;
|
||||
String? _filterQuality;
|
||||
String? _filterFormat;
|
||||
String? _filterMetadata;
|
||||
String _sortMode = 'latest';
|
||||
|
||||
double _effectiveTextScale() {
|
||||
final textScale = MediaQuery.textScalerOf(context).scale(1.0);
|
||||
@@ -2036,7 +2036,6 @@ class _QueueTabState extends ConsumerState<QueueTab> {
|
||||
return quality.split('/').first;
|
||||
}
|
||||
|
||||
// Supports "MP3 320k", "Opus 256kbps", etc.
|
||||
final bitrateTextMatch = RegExp(
|
||||
r'(\d+)\s*k(?:bps)?',
|
||||
caseSensitive: false,
|
||||
@@ -2045,7 +2044,6 @@ class _QueueTabState extends ConsumerState<QueueTab> {
|
||||
return '${bitrateTextMatch.group(1)}k';
|
||||
}
|
||||
|
||||
// Supports legacy quality IDs like "opus_256" / "mp3_320".
|
||||
final bitrateIdMatch = RegExp(r'_(\d+)$').firstMatch(q);
|
||||
if (bitrateIdMatch != null) {
|
||||
return '${bitrateIdMatch.group(1)}k';
|
||||
@@ -2301,7 +2299,7 @@ class _QueueTabState extends ConsumerState<QueueTab> {
|
||||
|
||||
List<UnifiedLibraryItem> _applySorting(List<UnifiedLibraryItem> items) {
|
||||
if (_sortMode == 'latest') {
|
||||
return items; // Already sorted newest first from _getUnifiedItems
|
||||
return items;
|
||||
}
|
||||
final sorted = List<UnifiedLibraryItem>.of(items);
|
||||
switch (_sortMode) {
|
||||
@@ -3364,7 +3362,6 @@ class _QueueTabState extends ConsumerState<QueueTab> {
|
||||
final selectionItems = getFilterData(
|
||||
historyFilterMode,
|
||||
).filteredUnifiedItems;
|
||||
// Only sync overlays when selection mode is active
|
||||
if (_isSelectionMode || _isPlaylistSelectionMode) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (_isSelectionMode) {
|
||||
|
||||
@@ -164,13 +164,7 @@ class _RecentDonorsCard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
const donorNames = <String>[
|
||||
'McNuggets Jimmy',
|
||||
'zcc09',
|
||||
'micahRichie',
|
||||
'a fan',
|
||||
'CJBGR',
|
||||
];
|
||||
const donorNames = <String>['R4ND0MIZ3D', 'Isra', 'bigJr48'];
|
||||
|
||||
// Match SettingsGroup color logic
|
||||
final cardColor = isDark
|
||||
|
||||
@@ -2210,7 +2210,6 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
final baseName = _buildSaveBaseName();
|
||||
|
||||
if (_isSafFile) {
|
||||
// SAF file: save to temp, then copy to SAF tree
|
||||
final tempDir = await Directory.systemTemp.createTemp('cover_');
|
||||
final tempOutput =
|
||||
'${tempDir.path}${Platform.pathSeparator}$baseName.jpg';
|
||||
@@ -2293,7 +2292,6 @@ class _TrackMetadataScreenState extends ConsumerState<TrackMetadataScreen> {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// No SAF tree info, keep in temp
|
||||
try {
|
||||
await Directory(tempDir.path).delete(recursive: true);
|
||||
} catch (_) {}
|
||||
@@ -5192,7 +5190,6 @@ class _EditMetadataSheetState extends State<_EditMetadataSheet> {
|
||||
final method = result['method'] as String?;
|
||||
|
||||
if (method == 'ffmpeg') {
|
||||
// MP3/Opus: use FFmpeg to write metadata
|
||||
// For SAF files, Kotlin returns temp_path + saf_uri
|
||||
final tempPath = result['temp_path'] as String?;
|
||||
final safUri = result['saf_uri'] as String?;
|
||||
@@ -5280,7 +5277,6 @@ class _EditMetadataSheetState extends State<_EditMetadataSheet> {
|
||||
} catch (_) {}
|
||||
}
|
||||
} catch (_) {
|
||||
// No cover to preserve, continue without
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -892,7 +892,6 @@ class FFmpegService {
|
||||
///
|
||||
/// Returns a [ReplayGainResult] on success, or null if the scan fails.
|
||||
static Future<ReplayGainResult?> scanReplayGain(String filePath) async {
|
||||
// Run FFmpeg with ebur128 filter + astats for true peak.
|
||||
// -nostats suppresses the interactive progress line.
|
||||
// ebur128=peak=true prints integrated loudness + true peak.
|
||||
// framelog=quiet suppresses per-frame measurements (very verbose),
|
||||
@@ -941,7 +940,6 @@ class FFmpegService {
|
||||
}
|
||||
}
|
||||
|
||||
// ReplayGain reference level: -18 LUFS
|
||||
const replayGainReferenceLufs = -18.0;
|
||||
final gainDb = replayGainReferenceLufs - integratedLufs;
|
||||
|
||||
@@ -949,13 +947,11 @@ class FFmpegService {
|
||||
// If no true peak was found, fall back to 1.0 (0 dBFS).
|
||||
double peakLinear;
|
||||
if (truePeakDbfs != null) {
|
||||
// 10^(dBFS/20) converts dBFS to linear amplitude
|
||||
peakLinear = math.pow(10, truePeakDbfs / 20.0).toDouble();
|
||||
} else {
|
||||
peakLinear = 1.0;
|
||||
}
|
||||
|
||||
// Format to standard ReplayGain precision
|
||||
final trackGain =
|
||||
'${gainDb >= 0 ? "+" : ""}${gainDb.toStringAsFixed(2)} dB';
|
||||
final trackPeak = peakLinear.toStringAsFixed(6);
|
||||
@@ -1791,7 +1787,6 @@ class FFmpegService {
|
||||
vorbis['LYRICS'] = value;
|
||||
vorbis['UNSYNCEDLYRICS'] = value;
|
||||
break;
|
||||
// ReplayGain fields
|
||||
case 'REPLAYGAINTRACKGAIN':
|
||||
vorbis['REPLAYGAIN_TRACK_GAIN'] = value;
|
||||
break;
|
||||
|
||||
@@ -354,7 +354,7 @@ class PlatformBridge {
|
||||
return jsonDecode(result as String) as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
/// Sets the lyrics provider order. Providers not in the list are disabled.
|
||||
/// Providers not in the list are disabled.
|
||||
static Future<void> setLyricsProviders(List<String> providers) async {
|
||||
final providersJSON = jsonEncode(providers);
|
||||
await _channel.invokeMethod('setLyricsProviders', {
|
||||
@@ -362,14 +362,12 @@ class PlatformBridge {
|
||||
});
|
||||
}
|
||||
|
||||
/// Returns the current lyrics provider order.
|
||||
static Future<List<String>> getLyricsProviders() async {
|
||||
final result = await _channel.invokeMethod('getLyricsProviders');
|
||||
final List<dynamic> decoded = jsonDecode(result as String) as List<dynamic>;
|
||||
return decoded.cast<String>();
|
||||
}
|
||||
|
||||
/// Returns metadata about all available lyrics providers.
|
||||
static Future<List<Map<String, dynamic>>>
|
||||
getAvailableLyricsProviders() async {
|
||||
final result = await _channel.invokeMethod('getAvailableLyricsProviders');
|
||||
@@ -387,7 +385,6 @@ class PlatformBridge {
|
||||
});
|
||||
}
|
||||
|
||||
/// Returns current advanced lyrics fetch options.
|
||||
static Future<Map<String, dynamic>> getLyricsFetchOptions() async {
|
||||
final result = await _channel.invokeMethod('getLyricsFetchOptions');
|
||||
return jsonDecode(result as String) as Map<String, dynamic>;
|
||||
|
||||
Reference in New Issue
Block a user