mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-18 16:46:17 +00:00
3.8 KiB
3.8 KiB
Merging Bose-SoundTouch-API into Bose-SoundTouch
This document outlines the plan to merge the Bose-SoundTouch-API project into this repository. The actual Go implementation in that repository is located in the soundcork-go subdirectory. The goal is to provide both a CLI (soundtouch-cli) and a service (soundtouch-service) from a single codebase.
Goals
- Maintain the existing
soundtouch-clifunctionality. - Introduce
soundtouch-serviceas a new command (based on thesoundcork-goproject). - Consolidate shared logic (models, clients, discovery) into the
pkg/directory. - Simplify maintenance by having a single Go module and shared CI/CD pipeline.
Current Directory Structure
.
├── cmd/
│ ├── soundtouch-cli/ # Existing CLI implementation
│ │ └── main.go
│ └── soundtouch-service/ # New service implementation (REST API / Websocket)
│ └── main.go
├── pkg/
│ ├── client/ # Shared SoundTouch API client
│ ├── models/ # Shared data models
│ ├── discovery/ # Shared device discovery logic
│ └── service/ # Service-specific logic (from Bose-SoundTouch-API)
│ ├── bmx/ # BMX service logic
│ ├── marge/ # Marge service logic
│ ├── datastore/ # Device and configuration storage
│ ├── proxy/ # Logging proxy logic
│ ├── setup/ # Device setup and migration logic
│ └── handlers/ # HTTP handlers (adapted from soundcork-go/soundcork-go)
│ └── soundcork/ # Embedded resources (index.html, media/, etc.)
├── docs/
│ └── MERGE_PROJECTS.md # This document
├── go.mod
└── go.sum
Step-by-Step Merge Status
1. Preparation
- Review
go.modin both projects to identify dependency overlaps and conflicts.
2. Code Integration
- Models & Client: Merged missing functionality from
soundcork-go/internal/modelsintopkg/models. Renamed overlapping models toService*(e.g.,ServiceContentItem,ServicePreset). - Service Logic: Adapted internal packages from
soundcork-go/internal/topkg/service/. - Handlers: Moved and adapted HTTP handlers into
pkg/service/handlers/. - New Command: Created
cmd/soundtouch-service/main.goas the service entry point usingchirouter. - Embedded Resources: Integrated
index.html,bmx_services.json,swupdate.xml, andmedia/folder into the binary using//go:embed.
3. Dependency Management
- Update
go.modto include:github.com/go-chi/chi/v5github.com/srwiley/oksvgandgithub.com/srwiley/rasterxgolang.org/x/crypto
- Run
go mod tidyto clean up dependencies.
4. Shared Logic Refactoring
- Identify common code between
soundtouch-cliand the new service. - Move shared logic into
pkg/to ensure both commands use the same underlying implementation.
5. Documentation & Examples
- Update
README.mdto mention the newsoundtouch-servicecommand. - Add service-specific documentation in
docs/SOUNDTOUCH-SERVICE.md. - Provide examples of how to run and interact with the service in
examples/service-demo/.
6. CI/CD Updates
- Update
.github/workflows/release.ymlto build and release thesoundtouch-servicebinary alongsidesoundtouch-cli. - Update any test workflows to include tests for the service logic.
Verification
go build ./cmd/soundtouch-cliworks as expected.go build ./cmd/soundtouch-serviceworks as expected.- All tests pass:
go test ./.... - Resources are correctly served from the embedded filesystem.