Commit graph

4 commits

Author SHA1 Message Date
9f2854bfdc fix: replace any types in music integration utilities (19 errors)
Phase 1 Batch 5: Music Integration type safety improvements

Fixed 19 any-type errors across 6 music integration files:

1. src/lib/utils/albumEnricher.ts (4 errors)
   - Created RecentTracksData interface
   - Fixed getAppleMusicDataForNowPlaying: return Album['appleMusicData'] | null
   - Fixed cacheRecentTracks: parameter RecentTracksData
   - Fixed getCachedRecentTracks: return RecentTracksData | null
   - Fixed getCachedRecentTracks: data typing

2. src/lib/utils/lastfmStreamManager.ts (4 errors)
   - Created RecentTracksResponse interface
   - Fixed fetchFreshRecentTracks: return RecentTracksResponse
   - Fixed getRecentAlbums: parameter RecentTracksResponse
   - Fixed updateNowPlayingStatus: parameter RecentTracksResponse
   - Fixed getNowPlayingUpdatesForNonRecentAlbums: parameter RecentTracksResponse

3. src/lib/utils/lastfmTransformers.ts (2 errors)
   - Created LastfmTrack interface
   - Fixed trackToAlbum: parameter LastfmTrack
   - Fixed mergeAppleMusicData: parameter Album['appleMusicData']

4. src/lib/utils/nowPlayingDetector.ts (4 errors)
   - Created LastfmRecentTrack and RecentTracksResponse interfaces
   - Fixed processNowPlayingTracks: parameters with proper types
   - Fixed detectNowPlayingAlbums: parameters with proper types
   - Updated appleMusicDataLookup callback: return Album['appleMusicData'] | null

5. src/lib/utils/simpleNowPlayingDetector.ts (3 errors)
   - Created LastfmTrack interface
   - Fixed processAlbums: recentTracks parameter to LastfmTrack[]
   - Fixed appleMusicDataLookup callback: return Album['appleMusicData'] | null
   - Fixed mostRecentTrack variable type and date handling
   - Fixed trackData type in tracks.find()

6. src/lib/utils/simpleLastfmStreamManager.ts (2 errors)
   - Created RecentTracksResponse interface
   - Fixed getRecentAlbums: parameter RecentTracksResponse

Progress: 32 any-type errors remaining (down from 51)
2025-11-24 02:25:23 -08:00
103c69664b fix: improve now playing detection reliability
- Always fetch fresh data from Last.fm for now playing detection
- Add confidence-based detection with progress tracking
- Implement dynamic polling intervals (10s when playing, 30s idle)
- Add marquee animation for now playing text in header
- Fix release date formatting to show only year
- Add gradient fade effects to marquee edges
- Enhanced logging for debugging detection issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 01:25:31 -07:00
adf01059c2 refactor: improve utility functions and API error handling
- Enhance albumEnricher with better error handling and type safety
- Refactor lastfmStreamManager for cleaner event management
- Update lastfmTransformers with improved data validation
- Add better type guards in mediaHelpers
- Improve nowPlayingDetector logic and state management
- Enhance SSE error handling in Last.fm stream endpoint

Key improvements:
- Better error boundaries and fallback values
- More robust type checking and validation
- Cleaner async/await patterns
- Improved logging for debugging
- Consistent error response formats

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 23:21:48 -07:00
a8feb173cb refactor: extract LastFM stream logic into separate utilities
- Create lastfmTransformers.ts for data transformations
- Create nowPlayingDetector.ts for cleaner detection algorithms
- Create albumEnricher.ts for album data enrichment
- Create lastfmStreamManager.ts to orchestrate streaming logic

This separates concerns and makes the code more testable and maintainable.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-26 13:47:31 -04:00