diff --git a/android/app/src/main/kotlin/com/zarz/spotiflac/DownloadService.kt b/android/app/src/main/kotlin/com/zarz/spotiflac/DownloadService.kt index c3fd7b46..fe9b8e07 100644 --- a/android/app/src/main/kotlin/com/zarz/spotiflac/DownloadService.kt +++ b/android/app/src/main/kotlin/com/zarz/spotiflac/DownloadService.kt @@ -115,10 +115,8 @@ class DownloadService : Service() { * We must call stopSelf() within a few seconds to avoid a crash. */ override fun onTimeout(startId: Int, fgsType: Int) { - // Log the timeout for debugging android.util.Log.w("DownloadService", "Foreground service timeout reached (6 hours limit). Stopping service.") - // Gracefully stop the service stopForegroundService() } diff --git a/go_backend/cue_parser.go b/go_backend/cue_parser.go index 914d3f4d..8cbf1f61 100644 --- a/go_backend/cue_parser.go +++ b/go_backend/cue_parser.go @@ -114,7 +114,6 @@ func ParseCueFile(cuePath string) (*CueSheet, error) { continue } - // PERFORMER if strings.HasPrefix(upper, "PERFORMER ") { value := unquoteCue(line[len("PERFORMER "):]) if currentTrack != nil { @@ -125,7 +124,6 @@ func ParseCueFile(cuePath string) (*CueSheet, error) { continue } - // TITLE if strings.HasPrefix(upper, "TITLE ") { value := unquoteCue(line[len("TITLE "):]) if currentTrack != nil { @@ -136,7 +134,6 @@ func ParseCueFile(cuePath string) (*CueSheet, error) { continue } - // FILE if strings.HasPrefix(upper, "FILE ") { rest := line[len("FILE "):] // Extract filename and type @@ -148,7 +145,6 @@ func ParseCueFile(cuePath string) (*CueSheet, error) { continue } - // TRACK if strings.HasPrefix(upper, "TRACK ") { // Save previous track if currentTrack != nil { @@ -168,7 +164,6 @@ func ParseCueFile(cuePath string) (*CueSheet, error) { continue } - // INDEX if strings.HasPrefix(upper, "INDEX ") && currentTrack != nil { parts := strings.Fields(line) if len(parts) >= 3 { @@ -184,7 +179,6 @@ func ParseCueFile(cuePath string) (*CueSheet, error) { continue } - // ISRC if strings.HasPrefix(upper, "ISRC ") && currentTrack != nil { currentTrack.ISRC = strings.TrimSpace(line[len("ISRC "):]) continue @@ -560,7 +554,6 @@ func scanCueSheetForLibrary(cuePath string, sheet *CueSheet, audioPath, virtualP duration = int(totalDurationSec - track.StartTime) } - // Use a unique ID based on pathBase + track number id := generateLibraryID(fmt.Sprintf("%s#track%d", pathBase, track.Number)) // Use a virtual file path that includes the track number to ensure diff --git a/go_backend/duplicate.go b/go_backend/duplicate.go index cd922285..30b68551 100644 --- a/go_backend/duplicate.go +++ b/go_backend/duplicate.go @@ -34,7 +34,6 @@ func GetISRCIndex(outputDir string) *ISRCIndex { return idx } - // Slow path: need to build index // Use per-directory mutex to prevent multiple goroutines from building simultaneously buildLock, _ := isrcBuildingMu.LoadOrStore(outputDir, &sync.Mutex{}) mu := buildLock.(*sync.Mutex) diff --git a/go_backend/extension_manager.go b/go_backend/extension_manager.go index 5c73e251..d2a1f8d3 100644 --- a/go_backend/extension_manager.go +++ b/go_backend/extension_manager.go @@ -151,7 +151,6 @@ func (m *ExtensionManager) LoadExtensionFromFile(filePath string) (*LoadedExtens if exists { versionCompare := compareVersions(manifest.Version, existingVersion) if versionCompare > 0 { - // This is an upgrade - call UpgradeExtension return m.UpgradeExtension(filePath) } else if versionCompare == 0 { return nil, fmt.Errorf("Extension '%s' v%s is already installed", existingDisplayName, existingVersion) @@ -429,7 +428,6 @@ func (m *ExtensionManager) loadExtensionFromDirectory(dirPath string) (*LoadedEx SourceDir: dirPath, } - // Restore enabled state from settings store store := GetExtensionSettingsStore() if enabledVal, err := store.Get(manifest.Name, "_enabled"); err == nil { if enabled, ok := enabledVal.(bool); ok { diff --git a/go_backend/extension_store.go b/go_backend/extension_store.go index 90dbf61a..22ac2d0a 100644 --- a/go_backend/extension_store.go +++ b/go_backend/extension_store.go @@ -484,12 +484,10 @@ func (s *ExtensionStore) SearchExtensions(query string, category string) ([]Stor queryLower := toLower(query) for _, ext := range extensions { - // Filter by category if category != "" && ext.Category != category { continue } - // Filter by query if query != "" { if !containsIgnoreCase(ext.Name, queryLower) && !containsIgnoreCase(ext.DisplayName, queryLower) && diff --git a/go_backend/httputil.go b/go_backend/httputil.go index 08fac2a8..36433d1e 100644 --- a/go_backend/httputil.go +++ b/go_backend/httputil.go @@ -350,7 +350,7 @@ func calculateNextDelay(currentDelay time.Duration, config RetryConfig) time.Dur func getRetryAfterDuration(resp *http.Response) time.Duration { retryAfter := resp.Header.Get("Retry-After") if retryAfter == "" { - return 60 * time.Second // Default wait time + return 60 * time.Second } if seconds, err := strconv.Atoi(retryAfter); err == nil { @@ -364,7 +364,7 @@ func getRetryAfterDuration(resp *http.Response) time.Duration { } } - return 60 * time.Second // Default + return 60 * time.Second } func ReadResponseBody(resp *http.Response) ([]byte, error) { diff --git a/go_backend/youtube.go b/go_backend/youtube.go index b8038032..58e5d751 100644 --- a/go_backend/youtube.go +++ b/go_backend/youtube.go @@ -510,12 +510,10 @@ func ExtractYouTubeVideoID(urlStr string) (string, error) { return "", fmt.Errorf("invalid URL: %w", err) } - // /watch?v= if v := parsed.Query().Get("v"); v != "" { return v, nil } - // /embed/ if strings.Contains(parsed.Path, "/embed/") { parts := strings.Split(parsed.Path, "/embed/") if len(parts) >= 2 { @@ -523,7 +521,6 @@ func ExtractYouTubeVideoID(urlStr string) (string, error) { } } - // /v/ if strings.Contains(parsed.Path, "/v/") { parts := strings.Split(parsed.Path, "/v/") if len(parts) >= 2 { diff --git a/lib/providers/local_library_provider.dart b/lib/providers/local_library_provider.dart index 8c36a4f6..33f1ae6a 100644 --- a/lib/providers/local_library_provider.dart +++ b/lib/providers/local_library_provider.dart @@ -315,7 +315,6 @@ class LocalLibraryNotifier extends Notifier { int skippedDownloads = 0; for (final json in results) { final filePath = json['filePath'] as String?; - // Skip files that are already in download history if (_isDownloadedPath(filePath, downloadedPathKeys)) { skippedDownloads++; continue; @@ -464,7 +463,6 @@ class LocalLibraryNotifier extends Notifier { } } - // Delete removed items if (deletedPaths.isNotEmpty) { final deleteCount = await _db.deleteByPaths(deletedPaths); for (final path in deletedPaths) { diff --git a/lib/providers/recent_access_provider.dart b/lib/providers/recent_access_provider.dart index 8a2ba671..7b9cc15a 100644 --- a/lib/providers/recent_access_provider.dart +++ b/lib/providers/recent_access_provider.dart @@ -70,7 +70,7 @@ class RecentAccessItem { /// State for recent access history class RecentAccessState { final List items; - final Set hiddenDownloadIds; // IDs of downloads hidden from recents + final Set hiddenDownloadIds; final bool isLoaded; const RecentAccessState({ diff --git a/lib/screens/downloaded_album_screen.dart b/lib/screens/downloaded_album_screen.dart index 04e5dcc0..55b1b71c 100644 --- a/lib/screens/downloaded_album_screen.dart +++ b/lib/screens/downloaded_album_screen.dart @@ -125,7 +125,6 @@ class _DownloadedAlbumScreenState extends ConsumerState { (item.albumArtist != null && item.albumArtist!.isNotEmpty) ? item.albumArtist! : item.artistName; - // Use lowercase for case-insensitive matching final itemKey = '${item.albumName.toLowerCase()}|${itemArtist.toLowerCase()}'; return itemKey == _albumLookupKey; diff --git a/lib/screens/queue_tab.dart b/lib/screens/queue_tab.dart index e05429c9..8645950d 100644 --- a/lib/screens/queue_tab.dart +++ b/lib/screens/queue_tab.dart @@ -105,7 +105,7 @@ class UnifiedLibraryItem { artistName: item.artistName, albumName: item.albumName, coverUrl: null, // Local library doesn't have cover URLs - localCoverPath: item.coverPath, // Use extracted cover path + localCoverPath: item.coverPath, filePath: item.filePath, quality: quality, addedAt: item.fileModTime != null @@ -2067,7 +2067,6 @@ class _QueueTabState extends ConsumerState { final albumCounts = {}; final albumMap = >{}; for (final item in items) { - // Use lowercase key for case-insensitive grouping final key = '${item.albumName.toLowerCase()}|${(item.albumArtist ?? item.artistName).toLowerCase()}'; albumCounts[key] = (albumCounts[key] ?? 0) + 1; diff --git a/lib/screens/store_tab.dart b/lib/screens/store_tab.dart index 54af17db..72c91444 100644 --- a/lib/screens/store_tab.dart +++ b/lib/screens/store_tab.dart @@ -121,7 +121,6 @@ class _StoreTabState extends ConsumerState { ), ), - // Show setup screen if no registry URL is configured if (!hasRegistryUrl) SliverFillRemaining( child: _buildSetupRepoState(colorScheme, error), diff --git a/lib/screens/track_metadata_screen.dart b/lib/screens/track_metadata_screen.dart index 68ecb60b..d23d41e1 100644 --- a/lib/screens/track_metadata_screen.dart +++ b/lib/screens/track_metadata_screen.dart @@ -64,9 +64,9 @@ class _TrackMetadataScreenState extends ConsumerState { String? _lyricsError; String? _lyricsSource; bool _showTitleInAppBar = false; - bool _lyricsEmbedded = false; // Track if lyrics are embedded in file + bool _lyricsEmbedded = false; bool _isEmbedding = false; // Track embed operation in progress - bool _isInstrumental = false; // Track if detected as instrumental + bool _isInstrumental = false; bool _isConverting = false; // Track convert operation in progress bool _hasMetadataChanges = false; bool _hasLoadedResolvedAudioMetadata = false; diff --git a/lib/services/ffmpeg_service.dart b/lib/services/ffmpeg_service.dart index 8154f03c..b9aa6603 100644 --- a/lib/services/ffmpeg_service.dart +++ b/lib/services/ffmpeg_service.dart @@ -1385,7 +1385,6 @@ class FFmpegService { final track = tracks[i]; onProgress?.call(i + 1, tracks.length); - // Sanitize filename final sanitizedTitle = track.title .replaceAll(RegExp(r'[<>:"/\\|?*]'), '_') .replaceAll(RegExp(r'\s+'), ' ') @@ -1394,11 +1393,9 @@ class FFmpegService { final outputFileName = '$trackNumStr - $sanitizedTitle.$outputExt'; final outputPath = '$outputDir${Platform.pathSeparator}$outputFileName'; - // Build FFmpeg command for this track final StringBuffer cmdBuffer = StringBuffer(); cmdBuffer.write('-i "$audioPath" '); - // Time range final startTime = _formatSecondsForFFmpeg(track.startSec); cmdBuffer.write('-ss $startTime '); @@ -1413,7 +1410,6 @@ class FFmpegService { cmdBuffer.write('-c:a copy '); } - // Metadata final artist = track.artist.isNotEmpty ? track.artist : (albumMetadata['artist'] ?? ''); final album = albumMetadata['album'] ?? ''; final genre = albumMetadata['genre'] ?? ''; diff --git a/lib/services/library_database.dart b/lib/services/library_database.dart index 703dfe6d..cf37c308 100644 --- a/lib/services/library_database.dart +++ b/lib/services/library_database.dart @@ -176,7 +176,6 @@ class LibraryDatabase { _log.i('Upgrading library database from v$oldVersion to v$newVersion'); if (oldVersion < 2) { - // Add cover_path column await db.execute('ALTER TABLE library ADD COLUMN cover_path TEXT'); _log.i('Added cover_path column'); }