-
Notifications
You must be signed in to change notification settings - Fork 0
Rename package to scrobbledb and modernize project configuration #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Renamed lastfm_to_sqlite directory to scrobbledb - Updated pyproject.toml to use modern setuptools backend instead of poetry - Updated package name to "scrobbledb" and script entry point - Updated all test imports to use scrobbledb module - Fixed test timestamp expectation to match actual UTC time - Updated pytest.ini to remove coverage config - Added Python-specific patterns to .gitignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added Brian M. Dennis as a project author in pyproject.toml - Added comprehensive docstring to the plays command explaining its functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changed project license from wtfpl to Apache-2.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added testpaths = tests to pytest.ini so pytest automatically discovers and runs all tests in the tests directory without requiring explicit paths. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added platformdirs as a dependency - Configured app name as dev.pirateninja.scrobbledb - Updated auth command to default to XDG data directory for auth.json - Updated plays command to make database argument optional with default in XDG data directory - Both auth and database files now use OS-specific standard user data directories - Updated help text to reflect new default behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
XDG Compliant Directory SupportThis commit adds support for OS-specific standard user data directories using platformdirs. Changes Made:
Default File Locations by Platform:
Files stored:
Benefits:
All tests pass successfully. Implementation assisted by Claude Code |
- Added rich package as a dependency for enhanced console output - Updated all console interactions to use rich (Console, Prompt, Progress, Panel, Table) - Replaced click.echo with rich console.print throughout - Replaced click.prompt with rich Prompt for user input - Replaced click.progressbar with rich Progress for better visual feedback - Implemented new 'scrobbledb init' command that: - Checks for and creates XDG compliant data directory - Initializes default SQLite database (scrobbledb.db) - Shows existing database info with table statistics - Displays formatted summary with next steps - Auth command now displays credentials in a styled panel with clickable links - Plays command uses rich progress spinner for import feedback - All commands provide visual feedback with colors and formatting All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Rich Console UI and Init CommandThis commit adds the Changes Made:1. Added Rich Package Dependency
2. Enhanced Console Interactions
3. New
|
- Added --dry-run flag to 'scrobbledb init' command - Dry-run mode checks initialization state without making any changes - Reports what exists (data directory, database, auth file) - Shows database table statistics if database exists - Lists actions needed to complete initialization - Fixed side effect where dry-run was creating directories - Provides clear visual feedback with checkmarks (✓) for existing items and circles (○) for missing items When nothing needs initialization: - Shows green success panel indicating everything is ready - Suggests next steps (auth, plays commands) When initialization is needed: - Shows yellow warning panel with list of required actions - Prompts user to run 'scrobbledb init' without --dry-run All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Dry-Run Option for Init CommandThis commit adds a Changes Made:Added
|
- Added --limit option to 'scrobbledb plays' command to cap number of tracks imported - Updated lastfm.recent_tracks() function to accept optional limit parameter - Generator now stops yielding tracks once limit is reached - Progress bar total adjusted to show expected count based on limit - Console output shows "up to N plays" when limit is specified - Helps users test imports or retrieve recent history without downloading entire playback history Usage example: scrobbledb plays --limit 100 # Import only the 100 most recent tracks All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add Limit Option to Plays CommandThis commit adds a Changes Made:Added
|
- Updated auth command to prompt for password and obtain session key - Session key is now stored in auth.json for authenticated API access - Modified get_network() to accept optional session_key parameter - Plays command now passes session key to authenticate API requests - Added validation to check for session key before making API calls - Improved error messages when session key is missing - Prevents "User required to be logged in" errors from last.fm API The auth flow now: 1. Prompts for username, API key, shared secret, and password 2. Authenticates with last.fm to obtain session key 3. Stores session key securely in auth file 4. Uses session key for all subsequent API requests Users with existing auth files need to run 'scrobbledb auth' again to obtain a session key. All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Use pylast.SessionKeyGenerator instead of non-existent get_session_key method - Hash password using pylast.md5() before passing to get_session_key - Follows pylast documentation for username/password authentication flow This fixes the AttributeError: 'LastFMNetwork' object has no attribute 'get_session_key' Authentication flow: 1. Create network with API key and secret 2. Hash user password with pylast.md5() 3. Create SessionKeyGenerator with network 4. Call sg.get_session_key(username, password_hash) 5. Store returned session key All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Renamed plays() function to ingest() for better semantic clarity - Updated command docstring to use "Ingest play history" terminology - Updated all console output messages: - "Importing plays" → "Ingesting tracks" - "Successfully imported plays" → "Successfully ingested tracks" - Updated help text references in init command: - "scrobbledb plays" → "scrobbledb ingest" - Database table name remains "plays" for data compatibility - SQL queries still reference "plays" table The command is now invoked as: scrobbledb ingest [OPTIONS] [DATABASE] All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Changed hardcoded timestamp expectation to use dt.datetime.fromtimestamp() - Test now calculates expected timestamp from Unix timestamp (1213031819) - Matches the implementation's behavior which uses fromtimestamp() - Makes test work correctly across different timezones - Previously failed on systems in EDT/other non-UTC timezones The test previously expected a hardcoded UTC time (17:16:59) but the implementation uses fromtimestamp() which converts to local time. Now the test calculates the expected value the same way the code does. All tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added test coverage for all database save operations: - test_save_artist: Verifies artist insertion and table structure - test_save_artist_upsert: Tests upsert behavior (no duplicates) - test_save_album: Tests album insertion with foreign key to artist - test_save_track: Tests track insertion with foreign key to album - test_save_play: Tests play insertion with composite primary key - test_save_complete_scrobble: Tests full scrobble workflow with all tables - test_save_multiple_plays_same_track: Tests multiple plays of same track Test features: - Uses temporary database fixture for isolation - Verifies primary keys and foreign keys are set correctly - Tests data integrity through SQL joins - Validates upsert behavior prevents duplicates - Confirms composite primary keys work properly - Tests multiple plays can be saved for the same track All 8 tests pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Created src/scrobbledb/__main__.py module entry point - Allows running scrobbledb as a module: python -m scrobbledb - Imports and invokes the CLI from cli.py - Provides alternative invocation method alongside scrobbledb command Usage: python -m scrobbledb --help python -m scrobbledb init python -m scrobbledb auth python -m scrobbledb ingest 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Recent Changes: Authentication, Command Rename, and Testing ImprovementsThis set of commits adds authentication support, renames the main command, and significantly expands test coverage. Session Key AuthenticationFixed Last.fm API Authentication
Note: Users with existing auth files need to run Command Rename: plays → ingestRenamed Command for Better Semantics
Testing ImprovementsFixed Timezone-Independent Test
Added Comprehensive Database Insertion Tests
Test features:
Test Results: All 8 tests pass successfully Module Entry PointAdded
Usage: python -m scrobbledb --help
python -m scrobbledb init
python -m scrobbledb auth
python -m scrobbledb ingest |
|
LGTM. Great progress. |
Summary
This PR renames the package from
lastfm-to-sqlitetoscrobbledband modernizes the project configuration.Changes
lastfm_to_sqlitemodule toscrobbledbthroughout the codebaselastfm-to-sqlitetoscrobbledbuvfor dependency managementplayscommand explaining its functionalityscrobbledbmoduletestpaths = teststo automatically discover and run all tests.gitignorewith Python-specific patterns (__pycache__/,.venv/,uv.lock)All tests pass successfully.
🤖 Generated with Claude Code