Skip to content

Conversation

@itsbrex
Copy link

@itsbrex itsbrex commented May 28, 2025

Description

This PR adds several major enhancements to GoFi:

Automatic URL Detection

  • Added support for both Spotify and Deezer URLs
  • Automatically detects URL type and routes to appropriate handler
  • Deezer URLs now work directly without requiring Spotify authentication
  • Added automatic arl token acquisition by checking multiple browsers automatically for the cookie 🔥

Beautiful CLI Interface

  • Implemented clean progress bars with real-time speed and ETA
  • Added color-coded output for better readability
  • Created organized display sections with icons (✓, ✗, ℹ, ⚠)
  • Added comprehensive download summaries
  • Fixed progress bar display to update on single line per track

Improved User Experience

  • Smart file management that skips already downloaded files
  • Better error handling and user feedback
  • Consistent file naming: Artist - Title.ext

Changes Made

  • URL Parser (internal/utils/urlparser.go): Added Deezer URL regex patterns and parsing logic
  • Download Handlers (cmd/gofi/cmd/download_handler.go): Added direct Deezer download functions
  • UI System (internal/ui/): Created display manager and custom progress bars
  • Progress Display (internal/ui/simple_progress.go): Fixed multi-line progress issue with ANSI escape sequences
  • Documentation: Updated README.md and CLAUDE.md with new features

Testing

  • ✅ Tested Spotify URL downloads (tracks, albums, playlists)
  • ✅ Tested Deezer URL downloads (tracks, albums, playlists)
  • ✅ Verified file skip functionality for existing downloads
  • ✅ Confirmed progress bars update on single line without cluttering console
  • ✅ Verified clean terminal output with proper line clearing

Screenshots

cli_output_screenshot

Breaking Changes

None - all existing functionality remains intact.

Future Improvements

  • Add support for additional music services (Tidal, Apple Music, etc.)
  • Implement download queue management
  • Add configuration for custom naming patterns

itsbrex and others added 22 commits April 5, 2025 15:03
…- Add configuration file structure and loading capability" -m "- Implement track, album, and playlist download functionality" -m "- Add concurrent downloads for albums and playlists" -m "- Update README with configuration and usage documentation"
…onfiguration file without credentials" -m "- Update gitignore to exclude real config and binaries"
…ment search by name for tracks, albums and playlists" -m "- Add interactive selection when multiple results match" -m "- Update documentation with examples of name-based searching"
…Spotify integration, requiring SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET environment variables. Includes error handling and user verification after authentication.
…d to download music from Spotify URLs, including handling tracks, albums, and playlists. Introduce error handling for authentication and URL parsing, with placeholder logic for actual download functionality.
… SourceType, Image, Artist, Album, Track, and Playlist to structure music-related data, including fields for various attributes and relationships.
…r parsing music URLs, specifically for Spotify, to extract service type, content type, and unique identifiers. Includes regex patterns for Spotify URLs and URIs, with error handling for unsupported formats. Future enhancements planned for additional services like Deezer and Tidal.
…rvice for handling OAuth2 authentication with Spotify, including token management and callback server. Add SpotifyService for interacting with the Spotify API, featuring methods to fetch tracks, albums, and playlists. Implement model mappings for Spotify data structures to internal models, enhancing integration capabilities.
… including google/uuid, spf13/cobra, zmb3/spotify, and others for enhanced functionality and support. Update indirect dependencies to ensure compatibility and stability across the project.
… project description to detail GoFi as a Deezer music download tool, including features, installation instructions, usage guidelines, and configuration options. Enhance documentation with examples for searching and downloading music, and outline quality settings and troubleshooting tips.
…a new file to specify the Go version (1.23.1) used in the project, ensuring consistent development environments across team members.
…pport

- Add Spotify authentication with OAuth2
- Implement Spotify API client for fetching tracks, albums, and playlists
- Create URL parser for handling Spotify URLs
- Implement matching of Spotify content with Deezer for downloads
- Auto-load ARL token from environment variables
- Add basic CLI structure with cobra
- Add usage examples for Spotify features
- Document Spotify OAuth authentication flow
- Describe Spotify-to-Deezer matching process
- Add information about environment variables
- Document cover size settings for different quality levels
- Update .gitignore with additional patterns
- Add compiled gofi binary
- Update .DS_Store

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

Co-Authored-By: Claude <[email protected]>
- Update URL parser to recognize Deezer URLs (track, album, playlist)
- Add direct Deezer download handlers that don't require Spotify auth
- Maintain existing Spotify URL functionality unchanged
- Update download command to automatically route to appropriate handler
- Update README and CLAUDE.md documentation to reflect dual URL support
- Ensure minimal changes to existing codebase to avoid breaking functionality

The app now automatically detects whether a URL is from Spotify or Deezer
and handles it appropriately. Spotify URLs still require authentication
and match content on Deezer, while Deezer URLs download directly.

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

Co-Authored-By: Claude <[email protected]>
- Create UI package with display manager and custom progress bars
- Add colored output using fatih/color for better readability
- Implement clean progress bars that update in place
- Add status icons (✓, ✗, ℹ, ⚠) for visual feedback
- Create organized display for track/album/playlist information
- Add download summary with success/failure counts
- Update download handler to use the new UI system
- Remove dependency on external progressbar library for cleaner display
- Update documentation to reflect UI improvements

The CLI now provides a polished, professional experience with:
- Real-time progress updates with speed and ETA
- Color-coded messages for different status types
- Clean section headers and organized information display
- Smart terminal output that doesn't create multiple lines
- Clear visual hierarchy and consistent iconography

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

Co-Authored-By: Claude <[email protected]>
- Add ANSI escape sequences to clear terminal lines properly
- Prevent multiple progress lines from cluttering the console
- Each track now updates its progress on a single line from 0-100%
@itsbrex itsbrex marked this pull request as ready for review May 28, 2025 23:33
@sayem314 sayem314 self-requested a review May 29, 2025 09:03
itsbrex and others added 6 commits May 30, 2025 23:53
- Modified api/api_test.go to skip tests when ARL token is missing
- Modified download/url_test.go to skip tests when ARL token is missing
- Modified request/client_test.go to skip test when ARL token is missing
- This prevents CI/CD failures while maintaining test functionality locally

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

Co-Authored-By: Claude <[email protected]>
- Created detailed PRD covering project overview and core features
- Included technical architecture and system components
- Defined development roadmap from MVP to advanced features
- Added risk analysis and mitigation strategies
- Based on template from scripts/example_prd.txt

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

Co-Authored-By: Claude <[email protected]>
- Added browser cookie reader supporting Chrome, Firefox, Edge, and Safari
- Created 'gofi auth deezer' command for automatic ARL extraction
- Implemented cookie decryption for Chrome on macOS/Linux
- Added ARL validation and .env file saving functionality
- Updated documentation with new authentication method

This makes Deezer authentication much easier - users no longer need to
manually copy cookies from DevTools. Just run 'gofi auth deezer' and
the tool will find and save the ARL token automatically.

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

Co-Authored-By: Claude <[email protected]>
- Added Arc browser as a supported browser type (Chromium-based)
- Updated cookie paths for Arc on macOS, Linux, and Windows
- Arc uses same cookie decryption method as Chrome/Edge
- Updated documentation to mention Arc browser support

Arc browser users can now use 'gofi auth deezer' to automatically
extract their ARL token just like with other supported browsers.

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

Co-Authored-By: Claude <[email protected]>
- Fixed Arc browser keychain password retrieval for proper decryption
- Added support for plain text cookie values in Chrome/Arc databases
- Improved cookie decryption with proper cleanup of non-printable chars
- Made ARL token validation more lenient (90% valid chars threshold)
- Clean ARL tokens before saving to .env to prevent HTTP header errors
- Try multiple domain variations when searching for cookies

This fixes issues where the extracted ARL token contained control
characters that made it invalid for HTTP headers, causing download
failures.

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

Co-Authored-By: Claude <[email protected]>
- Added .cursor/ directory (Cursor editor files)
- Added .taskmasterconfig (Task management config)
- Added .roo/, .roomodes, .windsurfrules (Roo editor files)
- Added scripts/example_prd.txt (example template file)

These files are editor/IDE specific and should not be tracked in the repository.

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

Co-Authored-By: Claude <[email protected]>
itsbrex and others added 5 commits May 31, 2025 15:37
- Add release.yml workflow to build binaries for multiple platforms
- Update README with pre-built binary installation instructions
- Add gofi binary to .gitignore to exclude from version control

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

Co-Authored-By: Claude <[email protected]>
- Update test files to use GetARLToken() helper that checks multiple sources
- Remove DEEZER_ARL from GitHub Actions workflow
- Add proper error handling and validation in DzAuthenticate
- Clean ARL tokens to remove control characters
- Tests now skip gracefully when no valid ARL is available from any source

This change reflects the new automatic ARL detection feature that can
extract tokens from browser cookies, making manual environment variable
configuration unnecessary.

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

Co-Authored-By: Claude <[email protected]>
- Add install.sh script for macOS/Linux with automatic platform detection
- Add install.ps1 script for Windows with PowerShell
- Update Makefile with install, install-dev, and uninstall targets
- Add version flag to CLI with automatic version injection during build
- Update GitHub Actions to inject version from git tags
- Add one-liner installation commands to README
- Support custom installation directories for both scripts and make

The install scripts automatically:
- Detect the user's platform and architecture
- Download the appropriate pre-built binary from GitHub releases
- Install to /usr/local/bin (or custom directory)
- Handle permissions with sudo when needed
- Add to PATH on Windows

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

Co-Authored-By: Claude <[email protected]>
- Add new build and installation commands
- Document automatic ARL detection from browser cookies
- Update testing information (no DEEZER_ARL env required)
- Add CI/CD workflow documentation
- Include recent improvements and development tips
- Update authentication flow documentation
- Add version injection details
- Document installation scripts and methods

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

Co-Authored-By: Claude <[email protected]>
- Add support for GOFI_OUTPUT_DIR to set default download directory
- Add support for GOFI_QUALITY to set default audio quality (validates 1, 3, or 9)
- Add support for GOFI_LOG_LEVEL to set default logging verbosity
- Command-line flags always override environment variables
- Add comprehensive tests for environment variable functionality
- Update help text to show environment variable names
- Update README and CLAUDE.md with environment variable documentation

This allows users to set their preferred defaults without repeatedly
using command-line flags, improving the user experience for power users.

Task: #1 - Implement Environment Variable Support

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

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant