Commit Graph

38 Commits

Author SHA1 Message Date
Glenn Thompson 4be3b83da1 Add listener statistics feature
- Add database schema for listener snapshots, sessions, and aggregates
- Implement background polling of Icecast admin XML stats
- Add API endpoints for current, daily, and geo stats
- Add listener stats section to admin dashboard with auto-refresh
- GDPR compliant: IP hashing, data retention cleanup
2025-12-10 11:11:32 -05:00
Brian O'Reilly 8fd0b06b69 dump users in db to csv, and restore them from same
this is (hopefully) a write once run once utility, but we're moving
from sqlite to postgres, and I don't want to lose the users that have
already signed up for the site.
2025-12-07 19:44:04 -05:00
Brian O'Reilly 6c6732d1e0 as far as I'm concerned, this is version 1.
Bump the major version number in the asdf system definition file, for
great ceremony.
2025-12-07 19:44:04 -05:00
Brian O'Reilly 6c2ed75b15 include i-postgmodern interface for postgres.
Conflicts:
	asteroid.asd
2025-12-07 19:44:04 -05:00
Glenn Thompson b6be0ebab1 feat: Convert JavaScript to Parenscript with stream fixes and UX improvements
Major Changes:
- Convert all JavaScript files to Parenscript for better maintainability
- Move spectrum-analyzer to parenscript/ directory structure
- Add parenscript-utils.lisp for shared utilities
- Convert admin.js, player.js, front-page.js, auth-ui.js to Parenscript
- Convert profile.js, users.js, recently-played.js to Parenscript

Stream Reconnect Fixes (from merged PR):
- Add reset-spectrum-analyzer function to properly clean up Web Audio API
- Implement reconnect logic for pauses longer than 10 seconds
- Detect stale audio in 'playing' event and force stream reconnection
- Prevent 'Now Playing' updates while stream is paused
- Reduce reconnect delay to 200ms for faster response
- Add proper spectrum analyzer reset/reinit during reconnection

UX Improvements:
- Change live indicator from blink to smooth pulse (2s ease-in-out)
- Pulse animation like old PowerBook/MacBook sleep indicator
- Add MUTED indicator to spectrum analyzer when audio is muted
- Spectrum continues to flow even when muted (data still streaming)
- Red 'MUTED' text displayed in top-right corner of canvas

Technical Details:
- Parenscript files generate JavaScript via API endpoints
- All player modes updated: main player, front page, popout, frame player
- Improved audio context handling to only create once per element
- Added comprehensive error handling and logging
- Updated asteroid.asd to include parenscript module structure

Documentation:
- Updated all documentation dates to 2025-12-06
- Added PARENSCRIPT-EXPERIMENT.org documenting the conversion
- Updated PROJECT-HISTORY.org with Phase 9 (Visual Audio Features)
- Added comprehensive project statistics (408 commits, 9,300 LOC)

This conversion improves code maintainability by using Lisp throughout
the stack and makes it easier to share code between frontend and backend.
2025-12-06 11:55:24 -05:00
Glenn Thompson 7c7b2c921e fix: Prevent stale audio playback after long pause and reorganize spectrum analyzer
- Detect pauses longer than 10 seconds across all player modes
- Intercept 'playing' event to stop stale buffered audio
- Force stream reconnect to get live audio after long pause
- Reset and reinitialize spectrum analyzer during reconnect
- Prevent 'Now Playing' updates while stream is paused
- Move spectrum-analyzer.lisp to parenscript/ directory
- Update all documentation dates to 2025-12-06
- Add comprehensive project statistics (408 commits, 9,300 LOC)
- Add Phase 9 (Visual Audio Features) to project history

Fixes issue where resuming playback after a long pause would play
old buffered audio instead of the current live stream. The fix uses
the 'playing' event to detect when stale audio starts and immediately
stops it, then reconnects to get fresh stream data.

All player modes updated: main player, front page, popout, and frame player.
2025-12-06 08:36:30 -05:00
Glenn Thompson a1257af16f feat: Add spectrum analyzer using Parenscript
Implements real-time audio visualization for the main page:
- Added Parenscript dependency to asteroid.asd
- Created spectrum-analyzer.lisp with Parenscript code
- Added canvas element to front-page.ctml above nav buttons
- Auto-generates JavaScript at compile time
- Green gradient bars matching Asteroid aesthetic
- Uses Web Audio API for FFT analysis

This is the first Parenscript component in Asteroid Radio,
demonstrating the approach for future JavaScript conversions.
2025-12-03 19:00:13 -05:00
Brian O'Reilly f0b03255b8 but not postgres yet. 2025-11-11 11:26:05 -05:00
Brian O'Reilly 5f91a81545 move main closer to my config branch in preperation for moving in totality. 2025-11-11 11:16:32 -05:00
Brian O'Reilly 1665efe1e1 refactor: Implement Lispy improvements - templates, strings, and error handling
This commit implements three major refactorings to make the codebase more
idiomatic and maintainable:

1. Template Path Centralization
   - Add *template-directory* parameter and helper functions
   - Replace 11+ instances of repetitive template loading boilerplate
   - New functions: template-path, load-template in template-utils.lisp

2. String Construction with FORMAT
   - Replace concatenate with format for external URLs (Icecast, static files)
   - Maintain Radiance URI handling for internal routes
   - Applied to stream URLs, status endpoints, and API responses

3. Error Handling with Custom Conditions
   - NEW FILE: conditions.lisp with comprehensive error hierarchy
   - Custom conditions: not-found-error, authentication-error,
     authorization-error, validation-error, database-error, asteroid-stream-error
   - Helper macros: with-error-handling, with-db-error-handling
   - Helper functions: signal-not-found, signal-validation-error, etc.
   - Refactored 19 API endpoints and page routes
   - Proper HTTP status codes: 404, 401, 403, 400, 500

Changes:
- conditions.lisp: NEW (180+ lines of error handling infrastructure)
- asteroid.asd: Add conditions.lisp to system components
- asteroid.lisp: Refactor 30+ endpoints, eliminate 200+ lines of boilerplate
- template-utils.lisp: Add centralized template loading helpers
- frontend-partials.lisp: Update template loading and string construction

Net result: -97 lines of code, significantly improved error handling,
more maintainable and idiomatic Common Lisp.

All changes tested and verified:
- Clean build
- All endpoints functional
- Error handling returns proper HTTP codes
- No regressions
2025-11-04 17:42:41 -05:00
Brian O'Reilly 40a49c1c25 many little changes all in a line.
my feature branch touches too many things. fix merge conflicts in
rebase to main.
2025-11-04 17:42:41 -05:00
Brian O'Reilly b9b3feda6b refactor: Implement Lispy improvements - templates, strings, and error handling
This commit implements three major refactorings to make the codebase more
idiomatic and maintainable:

1. Template Path Centralization
   - Add *template-directory* parameter and helper functions
   - Replace 11+ instances of repetitive template loading boilerplate
   - New functions: template-path, load-template in template-utils.lisp

2. String Construction with FORMAT
   - Replace concatenate with format for external URLs (Icecast, static files)
   - Maintain Radiance URI handling for internal routes
   - Applied to stream URLs, status endpoints, and API responses

3. Error Handling with Custom Conditions
   - NEW FILE: conditions.lisp with comprehensive error hierarchy
   - Custom conditions: not-found-error, authentication-error,
     authorization-error, validation-error, database-error, asteroid-stream-error
   - Helper macros: with-error-handling, with-db-error-handling
   - Helper functions: signal-not-found, signal-validation-error, etc.
   - Refactored 19 API endpoints and page routes
   - Proper HTTP status codes: 404, 401, 403, 400, 500

Changes:
- conditions.lisp: NEW (180+ lines of error handling infrastructure)
- asteroid.asd: Add conditions.lisp to system components
- asteroid.lisp: Refactor 30+ endpoints, eliminate 200+ lines of boilerplate
- template-utils.lisp: Add centralized template loading helpers
- frontend-partials.lisp: Update template loading and string construction

Net result: -97 lines of code, significantly improved error handling,
more maintainable and idiomatic Common Lisp.

All changes tested and verified:
- Clean build
- All endpoints functional
- Error handling returns proper HTTP codes
- No regressions
2025-11-04 17:42:41 -05:00
Brian O'Reilly b80dea5a08 many little changes all in a line.
my feature branch touches too many things. fix merge conflicts in
rebase to main.
2025-11-04 17:42:41 -05:00
Brian O'Reilly 5882141cfa refactor: Implement Lispy improvements - templates, strings, and error handling
This commit implements three major refactorings to make the codebase more
idiomatic and maintainable:

1. Template Path Centralization
   - Add *template-directory* parameter and helper functions
   - Replace 11+ instances of repetitive template loading boilerplate
   - New functions: template-path, load-template in template-utils.lisp

2. String Construction with FORMAT
   - Replace concatenate with format for external URLs (Icecast, static files)
   - Maintain Radiance URI handling for internal routes
   - Applied to stream URLs, status endpoints, and API responses

3. Error Handling with Custom Conditions
   - NEW FILE: conditions.lisp with comprehensive error hierarchy
   - Custom conditions: not-found-error, authentication-error,
     authorization-error, validation-error, database-error, asteroid-stream-error
   - Helper macros: with-error-handling, with-db-error-handling
   - Helper functions: signal-not-found, signal-validation-error, etc.
   - Refactored 19 API endpoints and page routes
   - Proper HTTP status codes: 404, 401, 403, 400, 500

Changes:
- conditions.lisp: NEW (180+ lines of error handling infrastructure)
- asteroid.asd: Add conditions.lisp to system components
- asteroid.lisp: Refactor 30+ endpoints, eliminate 200+ lines of boilerplate
- template-utils.lisp: Add centralized template loading helpers
- frontend-partials.lisp: Update template loading and string construction

Net result: -97 lines of code, significantly improved error handling,
more maintainable and idiomatic Common Lisp.

All changes tested and verified:
- Clean build
- All endpoints functional
- Error handling returns proper HTTP codes
- No regressions
2025-11-04 17:42:06 -05:00
glenneth 90bb9a1650 refactor: Implement Lispy improvements - templates, strings, and error handling
This commit implements three major refactorings to make the codebase more
idiomatic and maintainable:

1. Template Path Centralization
   - Add *template-directory* parameter and helper functions
   - Replace 11+ instances of repetitive template loading boilerplate
   - New functions: template-path, load-template in template-utils.lisp

2. String Construction with FORMAT
   - Replace concatenate with format for external URLs (Icecast, static files)
   - Maintain Radiance URI handling for internal routes
   - Applied to stream URLs, status endpoints, and API responses

3. Error Handling with Custom Conditions
   - NEW FILE: conditions.lisp with comprehensive error hierarchy
   - Custom conditions: not-found-error, authentication-error,
     authorization-error, validation-error, database-error, asteroid-stream-error
   - Helper macros: with-error-handling, with-db-error-handling
   - Helper functions: signal-not-found, signal-validation-error, etc.
   - Refactored 19 API endpoints and page routes
   - Proper HTTP status codes: 404, 401, 403, 400, 500

Changes:
- conditions.lisp: NEW (180+ lines of error handling infrastructure)
- asteroid.asd: Add conditions.lisp to system components
- asteroid.lisp: Refactor 30+ endpoints, eliminate 200+ lines of boilerplate
- template-utils.lisp: Add centralized template loading helpers
- frontend-partials.lisp: Update template loading and string construction

Net result: -97 lines of code, significantly improved error handling,
more maintainable and idiomatic Common Lisp.

All changes tested and verified:
- Clean build
- All endpoints functional
- Error handling returns proper HTTP codes
- No regressions
2025-11-02 12:05:23 -05:00
Luis Pereira d0efc89e33 feat: add HTML partial hidration for now-playing 2025-10-16 19:02:00 -04:00
glenneth b64d101f8a Add stream queue control system
- New stream-control.lisp for queue management backend
- M3U playlist generation with Docker path mapping
- API endpoints for add/remove/clear/reorder queue
- Fix library scan deduplication
- Add stream control documentation
2025-10-15 06:38:53 -04:00
Brian O'Reilly b61e9c891a dep to run music scan in parallel. 2025-10-11 13:20:42 -04:00
Glenn Thompson 803555b8b1 Complete Templates section: CLIP refactoring, user management, pagination, playlists, UI fixes, PostgreSQL setup
 CLIP Template Refactoring:
- Centralized template rendering in template-utils.lisp
- Template caching for performance
- Eliminated code duplication

 User Management:
- Dedicated /admin/users page
- User creation, roles, activation
- Comprehensive API endpoints
- Full test suite

 Track Pagination:
- Admin dashboard: 10/20/50/100 per page
- Web player: 10/20/50 per page
- Smart navigation controls

⚠️ Playlist System (PARTIAL):
- Create empty playlists 
- View playlists 
- Save/load playlists  (database UPDATE fails)
- Audio playback fixed 
- Database limitations documented

 PostgreSQL Setup:
- Docker container configuration
- Complete database schema
- Persistent storage
- Radiance configuration
- Ready for Fade to integrate

 Streaming Infrastructure:
- All 3 streams working (MP3 128k, AAC 96k, MP3 64k)
- Fixed AAC stream (Docker caching issue)
- NAS music mount configured

 UI Fixes:
- Green live stream indicators
- Correct stream quality display
- Now Playing verified working
- Missing API endpoints added

📚 Documentation:
- 6 comprehensive org files
- Complete technical documentation
- Known issues documented

Note: Playlist editing requires PostgreSQL migration (Fade's task)
2025-10-04 09:54:04 -04:00
Glenn Thompson ab7a7c47b5 Complete CLIP template refactoring and all template features
 CLIP Template System:
- Created template-utils.lisp with centralized rendering
- Template caching for performance
- render-template-with-plist for consistent API
- Proper CLIP attribute processors (data-text)
- Documentation in docs/CLIP-REFACTORING.org

 Admin Dashboard Complete:
- System Status: All 4 indicators working (Server, DB, Liquidsoap, Icecast)
- Music Library: Scan, upload, duplicate detection working
- Track Management: Pagination (20/page, configurable 10/20/50/100)
- Player Control: HTML5 audio player with play/pause/stop
- User Management: Moved to separate /admin/users page

 User Management:
- New /admin/users route with dedicated page
- Inline user creation form
- User stats dashboard
- Role management (listener/DJ/admin)
- Activate/deactivate users
- API endpoint /api/users/create
- Tested with curl - all working

 Live Stream & Now Playing:
- Fixed: Green 🟢 LIVE STREAM indicator (was red)
- Fixed: Stream quality display matches selected stream (AAC/MP3)
- Now Playing updates every 10s from Icecast
- No HTML rendering bugs - working correctly

 Track Library:
- Fixed recursive directory scanning bug
- 64 tracks scanned and in database
- Pagination working perfectly

 Front Page & Web Player:
- Station Status shows correct stream quality
- Quality selector updates all displays
- Live stream indicators green
- Now Playing working on all pages

All Templates section items complete [4/4] 
2025-10-04 09:54:04 -04:00
Brian O'Reilly a9de5f09f1 match dependencies to interface expectations. 2025-10-02 22:43:15 -04:00
Glenn Thompson d8306f0585 feat: Complete Docker streaming integration with web interface
- Add live stream integration to both front page and player page
- Add /api/icecast-status endpoint to fetch real-time stream data
- Add drakma dependency for HTTP requests to Icecast
- Fix JavaScript errors on player page with proper error handling
- Add auto-updating 'Now Playing' info every 10 seconds
- Update .gitignore to preserve docker/music/ directory structure
- Add .gitkeep to maintain docker/music/ folder in repository
- Improve user experience with separate public/registered user flows

Integration now complete:
- Front page: Public live stream access
- Player page: Live stream + playlist management for registered users
- Real-time metadata from Icecast JSON API
- Graceful error handling for missing stream backend
2025-10-02 16:51:03 +03:00
Brian O'Reilly eeeccc7df5 include an interface for authorization. 2025-10-01 12:16:17 -04:00
Glenn Thompson d6aee7ba01 Add bordeaux-threads dependency to asteroid.asd
- Required for threading functionality in the authentication system
2025-09-30 14:11:46 -04:00
Glenn Thompson 84d0bc4ce4 Fix Asteroid Radio authentication system
- Fix database query syntax for RADIANCE hash table returns
- Handle RADIANCE field storage format (lists instead of strings)
- Configure r-simple-sessions module for session management
- Update login page styling to match main site theme
- Implement working authentication with admin/asteroid123
- Add proper error handling and debug logging
- Ensure session persistence and redirects work correctly
2025-09-30 14:11:46 -04:00
Brian O'Reilly 71a55ee143 user profiles file. 2025-09-30 14:11:46 -04:00
Brian O'Reilly 7ce119cabd Some new dependencies
start up a slynk server in the binary entry point so we can attach Sly
to it and work live without pfaffing about in the threading library,
hiding radiance from Sly/Slynk running inside emacs.
2025-09-30 14:11:46 -04:00
Brian O'Reilly 873b2903cc refactor glenn's database feature into discrete files. 2025-09-11 10:33:26 -04:00
Glenn Thompson cb1d6e5596 Implement complete internet radio streaming system
- Add live streaming with Icecast2 and Liquidsoap integration
- Fix track streaming endpoints with proper RADIANCE database queries
- Implement music library management with metadata extraction
- Add web player interface with HTML5 audio controls
- Fix admin panel functionality for file management
- Create playlist system for continuous radio broadcasting
- Add live stream URL to web interface
- Support MP3 streaming at 128kbps with proper audio processing
- Enable network access for internal radio broadcasting
- Add comprehensive README.org documentation
- Create start/stop scripts for service management
- Use secure random password for streaming authentication
2025-09-11 15:30:01 +03:00
Glenn Thompson 9f1524da02 Implement complete metadata extraction and database integration
- Add taglib dependency for ID3/audio metadata extraction
- Implement extract-metadata-with-taglib function with fallback to basic metadata
- Fix database field access using gethash for RADIANCE hash table records
- Add /admin/scan-library API endpoint for triggering music library scans
- Add /admin/tracks API endpoint for retrieving stored track metadata
- Support MP3, FLAC, OGG, and WAV audio formats
- Implement recursive directory scanning with cl-fad
- Add comprehensive error handling and progress reporting
- Create music directory structure (library/, incoming/, temp/)
- Test metadata extraction workflow with sample files

All core metadata extraction and database functionality now working.
2025-09-11 10:47:57 +03:00
Glenn Thompson 1076582fb4 Implement RADIANCE database integration
- Add database collections for tracks and playlists
- Configure proper RADIANCE field types (:text, :integer)
- Add r-data-model dependency for database backend
- Fix build-executable.lisp RADIANCE environment handling
- Update admin dashboard to show real database connection status
- Database now initializes successfully on server startup
2025-09-11 08:54:12 +03:00
Brian O'Reilly b14a4d5680 tiny cleanup. 2025-09-08 11:07:02 -04:00
Glenn Thompson 77a23248f5 Fix LASS implementation: Enable dynamic CSS generation
- Fixed compile-styles function to properly use lass:compile-and-write
- LASS now generates CSS dynamically on server startup
- Removed dependency on static CSS files
- Added LASS-IMPLEMENTATION-NOTES.org documenting the fix
- Server now compiles LASS to CSS automatically on startup
- All styling preserved with proper LASS integration
2025-09-04 10:22:39 -04:00
Brian O'Reilly c0acff7d08 system building shenanigans, round one. 2025-09-01 12:46:11 -04:00
Brian O'Reilly c6ebce4fdd reorganize the system around radiance specific build conventions. 2025-08-30 10:04:11 -04:00
Glenn Thompson 8298dfed4c Migrate from Hunchentoot to RADIANCE framework
Major Changes:
- Replace Hunchentoot with RADIANCE web framework
- Add Shirakumo distribution for RADIANCE access
- Implement proper RADIANCE module with define-module declaration
- Convert all route handlers to use define-page syntax
- Update route paths for subdomain routing (asteroid.localhost:8080)
- Fix API endpoint to use define-page instead of define-api
- Update server management to use radiance:startup/shutdown

Technical Improvements:
- Modular architecture with subdomain routing
- Proper RADIANCE module integration
- Updated documentation with migration details
- Fixed route syntax and parentheses issues
- Added comprehensive server startup commands

Routes now accessible at:
- Main: http://asteroid.localhost:8080/
- Admin: http://asteroid.localhost:8080/admin
- Player: http://asteroid.localhost:8080/player
- API: http://asteroid.localhost:8080/api/status
2025-08-20 09:40:14 -04:00
Glenn Thompson 4bb1b1697a Implement Hunchentoot-based web server
- Replace RADIANCE with Hunchentoot web framework
- Remove unavailable dependencies (MITO, MITO-AUTH, STR, PZMQ)
- Add working web interface with main, admin, and player pages
- Implement JSON API endpoint at /api/status
- Fix HTML generation issues with proper Spinneret usage
- Add hacker-themed styling (green terminal aesthetic)
- Include comprehensive project documentation

Features:
- Web server on localhost:8080
- Admin dashboard with placeholder controls
- Web player interface (UI ready for streaming integration)
- Station status display
- Server management functions (start/stop/run)
- Upstream git remote configuration

Technical improvements:
- Direct Spinneret macro usage for reliable HTML generation
- Proper error handling and clean server shutdown
- Modular route handlers with consistent styling
- Cross-platform compatibility via app-utils
2025-08-20 09:40:14 -04:00
Brian O'Reilly 746a6c9d72 Project skeleton. 2025-08-12 10:59:34 -04:00