Commit Graph

80 Commits

Author SHA1 Message Date
Alexander d52ce9508e Some more 2026-07-01 20:07:49 +02:00
Alexander b448e076bc Leftovers 2026-07-01 20:07:31 +02:00
Alexander b5b175a8e9 Publish download events from PollDownloadWorker to event stream
PollDownloadWorker now publishes status/result/error events to both the
EventBus (for live UI updates via SubscribeEvents) and AlbumEventRepository
(for DB persistence and replay on reconnect).

- Add AlbumID, Quality, WorkflowRunID to PollDownloadArgs
- Add EventBus and AlbumEvents fields to PollDownloadWorker
- Publish status events with progress % on each poll tick
- Publish result event on download completion
- Publish error events on torrent failure
- Thread workflowRunID through saveTorrentAndDownload for event correlation
- RecoverOrphanedDownloads populates AlbumID/Quality from download record

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 14:57:25 +02:00
Alexander b5849d6ad1 Wire shared EventBus from main into PollDownloadWorker and server
Create EventBus in serveGrpc() and pass to both setupRiver() and
NewMusicAgregatorServer() so PollDownloadWorker and the gRPC server
share the same event bus instance.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 14:57:02 +02:00
Alexander 908c37f73f Add NixOS module for full agregators stack with VM test
Module manages PostgreSQL (both databases + schema init), qBittorrent
(VPN-confined via VPN-Confinement), Jackett, metadata-agregator,
musicfs, and the main orchestrator. All services are independently
enableable with auto-wired inter-service configuration.

Includes NixOS VM test validating PostgreSQL setup, schema
initialization, service startup, and directory creation.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 12:39:04 +02:00
Alexander 10a5fd5707 Package with nix, some fixes 2026-05-20 09:46:43 +02:00
Alexander 76e426c5d3 feat: integrate musicfs for post-download metadata enrichment
- Add internal/musicfs package: gRPC client, TriggerRescan (stream consumer), EnrichFiles (BatchUpdateMetadata), DeriveSubdir helper
- Add MusicFS config section (enabled, endpoint, origin_id, origin_root, timeout)
- Wire MusicFSClient into PollDownloadWorker: on download completion, trigger scoped rescan then push enriched metadata
- Fix album auto-persist in monitor workflow: persist artist+album from metadata-agregator before saving torrent/download
- Add filterByActiveSeeders: skip torrents where magnet resolution found 0 real active seeders
- Add musicfs proto to buf.gen.yaml inputs
- Enricher only sends non-empty fields to avoid overwriting existing file tag data with empty values
2026-05-17 23:32:44 +02:00
Alexander eac8196dcc Add beetfs submodule with reverse-engineered documentation
Fork of github.com:LichHunter/beetfs - a FUSE filesystem for metadata
overlay on audio files. Includes comprehensive documentation covering:
- Architecture and component analysis
- Data flow diagrams for read/write operations
- Performance analysis (latency, memory footprint)
- 27 identified drawbacks and limitations
- Python 3 modernization guide
2026-05-12 11:52:55 +02:00
Alexander 451fd97c95 Return NotFound error when no torrents or quality matches found instead of silent empty response
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 20:46:40 +02:00
Alexander 0fd51a1e03 Retry indexer search with stripped parenthetical suffixes when initial query returns no results
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 20:38:39 +02:00
Alexander 9aff4b0a29 Return all downloads per album grouped by quality, filter out failed/cancelled from listings
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 20:15:33 +02:00
Alexander ff6bc444d0 Prefer torrents with real seeders: resolve connected seeder count from swarm during magnet resolution
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 20:02:02 +02:00
Alexander 3e8b8153b6 Bruno requests 2026-05-11 19:52:55 +02:00
Alexander 69752bd6a2 Update flow diagrams for event bus architecture, cancel cleanup, and SubscribeEvents
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:54:32 +02:00
Alexander 93821ab214 Add streaming, subscribe, cancel cleanup, and recovery component tests
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:54:25 +02:00
Alexander be859e87c0 Add DeleteTorrent to torrent client interface for cancel cleanup
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:54:17 +02:00
Alexander e5bdf2c4ce Add SubscribeEvents RPC, AlbumEvent message, deprecate unary MonitorAlbum
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:54:09 +02:00
Alexander 5a5660bf21 Refactor MonitorAlbumStream: EventPublisher interface, background workflows, DB-before-qBit save order
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:54:01 +02:00
Alexander 52e81faedd Add workflow registry for background goroutine lifecycle management
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:53:52 +02:00
Alexander 7582279077 Add in-process event bus with ring buffer for workflow event broadcasting
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:53:43 +02:00
Alexander f52e9abb0a Add WorkflowRun and AlbumEvent repositories with download cancel support
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:53:35 +02:00
Alexander 7d11b729a5 Add DB migration for workflow_runs, album_events tables and cancelled download state
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 15:53:27 +02:00
Alexander eab92dd40b Add SearchArtists and GetArtistAlbums proxy RPCs to music-agregator service
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 10:30:18 +02:00
Alexander ad03caa3f4 Add streaming flow diagrams, update existing flows with streaming references
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 10:26:45 +02:00
Alexander 24f355c5ae Add MonitorAlbumStream bidirectional streaming RPC with automatic and manual interaction modes
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/claude-agent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-11 10:26:37 +02:00
Alexander f5e2f764b5 Optimize GetArtists: parallel artist processing, batch album upserts, batch download lookups, retry on metadata calls 2026-05-10 00:06:58 +02:00
Alexander 6320f37240 Deduplicate GetAlbum response: merge release info into AlbumDetail, track release into TrackDetail 2026-05-09 23:23:34 +02:00
Alexander 2740585261 Add album/track releases with audio analysis, AnalyzeAlbumRelease RPC, Docker path auto-resolution, release parsing decision tree 2026-05-09 23:16:59 +02:00
Alexander 1e8506f146 Deduce bit depth, sample rate, and bitrate from file sizes; add comprehensive parser tests 2026-05-09 22:09:17 +02:00
Alexander 7fa859e815 Remove rutracker parser, replace with GenericParser for all indexer results 2026-05-09 21:50:55 +02:00
Alexander ef75b9bfba Share single torrent client across all services, eliminate triple qBittorrent login on startup 2026-05-09 21:42:53 +02:00
Alexander 758a4b909a Leftovers 2026-05-09 21:31:24 +02:00
Alexander 31ec3f9826 Add MonitorAlbum component tests: 21 cases covering all flow diagrams (bufconn + testcontainers + hand-rolled mocks) 2026-05-09 21:31:09 +02:00
Alexander 6f31698006 Fix monitor state: never downgrade on upsert, explicitly set monitored on MonitorAlbum 2026-05-09 20:26:38 +02:00
Alexander 3ce6e23421 Fix duplicate download insert: handle NULL columns in download scan, check by torrent ID, enrich MonitorAlbum response, recover orphaned downloads on startup 2026-05-09 20:13:43 +02:00
Alexander cca404bcc0 Enrich MonitorAlbum response, prevent duplicate downloads, recover orphaned jobs on startup 2026-05-09 20:01:53 +02:00
Alexander 5257ed0f1b Fix album persistence by passing artist DB ID directly to PersistAlbum 2026-05-09 11:18:52 +02:00
Alexander 8c60fe5e35 Add GetAlbum RPC with track details and persist metadata on discovery 2026-05-09 10:47:06 +02:00
Alexander e61e58be72 Expand GetArtists with album details, download info, and generic MonitorState enum 2026-05-08 23:00:42 +02:00
Alexander e49cc25372 Add GetArtists RPC with artist monitor state (monitored/unmonitored/excluded) 2026-05-08 22:27:56 +02:00
Alexander 60c94935b2 Persist metadata to DB, poll download worker, metadata service layer 2026-05-08 11:00:04 +02:00
Alexander 66264e1314 Add database schema, ERD, and repository layer 2026-05-08 10:03:28 +02:00
Alexander 84a6fe8ec7 Refactor MonitorAlbum into focused methods 2026-05-07 23:28:35 +02:00
Alexander 8ad2734964 Implement MonitorAlbum: search, parse, filter by quality, add best to qbittorrent 2026-05-07 23:21:21 +02:00
Alexander 79f3f145de Add indexer cache with River queue for scheduled refresh 2026-05-07 21:41:17 +02:00
Alexander 2041c154cf Add the proxing to metadata-agregator 2026-05-07 12:00:37 +02:00
Alexander 97a57c10fd Added add endpoint 2026-05-07 10:27:20 +02:00
Alexander 6071bc7980 Implement the list endpoint for qbittorrent 2026-05-06 22:53:55 +02:00
Alexander 36416081c1 Create torrent proto stub 2026-05-06 22:26:40 +02:00
Alexander 3249bdc35c Add gRPC observability: logging, metrics, recovery interceptors 2026-05-06 21:58:24 +02:00