Add Musical Work linking and rendition management #349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enables linking songs as renditions of a canonical Musical Work (e.g., studio, live, piano, cello versions of the same composition). Provides intelligent matching suggestions and metadata-driven filtering without breaking existing functionality.
Implementation
Core Models
MusicalWorkrelationship + rendition metadata (RenditionType,Instrumentation,IsLivePerformance,IsRemix,IsCover)Service Layer
Architecture
Usage
Testing
23 unit tests covering CRUD, linking, filtering, suggestions, statistics aggregation, and edge cases.
Notes
MUSICAL_WORK_FEATURE.mdWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
crl.godaddy.com/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Dimmer-MAUI/.codeql-scratch/dbs/csharp/working/EB23B7D1B15B85081672081E55C17E18/missingpackages_workingdir --packages /home/REDACTED/work/Dimmer-MAUI/.codeql-scratch/dbs/csharp/working/missingpackages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal --configfile /home/REDACTED/work/Dimmer-MAUI/.codeql-scratch/dbs/csharp/working/nugetconfig/nuget.config --force(dns block)ocsp.godaddy.com/usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Dimmer-MAUI/.codeql-scratch/dbs/csharp/working/EB23B7D1B15B85081672081E55C17E18/missingpackages_workingdir --packages /home/REDACTED/work/Dimmer-MAUI/.codeql-scratch/dbs/csharp/working/missingpackages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal --configfile /home/REDACTED/work/Dimmer-MAUI/.codeql-scratch/dbs/csharp/working/nugetconfig/nuget.config --force(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>Musical Work Linking and Rendition Management</issue_title>
<issue_description>Summary:
Enable linking of related songs (e.g., instrumental, vocal, piano, cello versions) under a canonical “Musical Work” entity. This will allow better organization, querying, and UI presentation of renditions without convoluted data structures.
Motivation / Why
Currently, each SongModel is independent. This makes it hard to:
Identify songs that are renditions or variations of the same underlying composition.
Provide UI features like “Other Versions”, “Instrumental Only”, or “Vocals Only”.
Avoid duplication or cycles in the database when storing relations between songs.
This feature improves data integrity, query efficiency, and user experience, especially in libraries with multiple versions of the same work.
Proposed Solution
Introduce a new Musical Work abstraction:
Musical Work: The canonical idea of the song or composition.
Rendition / Track (SongModel): Concrete recording of the work, with metadata like instrumental/vocal, instrumentation, live/remix, etc.
Core Principles
The work is the “idea”; renditions are actual files or recordings.
SongModel links to MusicalWork as parent.
MusicalWork contains a list of renditions.
Avoid cycles (SongModel having list of other songs) to simplify queries and updates.
Users explicitly link renditions.
Auto-suggestions may assist but should never auto-commit.
Each SongModel stores flags like IsInstrumental, Instrumentation, IsLivePerformance.
Queries filter on these instead of parsing titles repeatedly.
Steps / Workflow for Implementation
Step 1: Design the Database Model
Add a MusicalWork entity to represent canonical compositions.
Each SongModel optionally links to a MusicalWork.
Ensure MusicalWork contains a list of all linked renditions (SongModels).
Design optional metadata on renditions for filtering (instrumentation, vocals, live, remix, etc.).
Goal: Maintain a clean one-to-many relationship. Avoid lists of songs inside songs.
Step 2: Manual Linking UI
Provide a UI to link a song to an existing work.
Include a “Create New Work” option if no appropriate work exists.
Show all renditions under a work in the UI, with filters (instrumental, live, cover, etc.).
Goal: Users can easily organize songs without creating cycles or redundant links.
Step 3: Suggestion / Recommendation System
Implement a suggestion engine that evaluates potential links based on:
Title similarity (normalized, ignoring keywords like “instrumental”, “piano”, “remix”)
Duration proximity
Artist match
Optional: metadata (genre, album)
Provide scoring rather than automatic linking.
UI can present top suggestions for user confirmation.
Goal: Reduce user effort while maintaining accuracy.
Step 4: Querying and Filtering
Implement efficient queries for:
All renditions of a song
Instrumental only
Live only
Specific instrumentation (piano, cello, etc.)
Ensure queries are Realm-friendly and avoid traversing complex cycles.
Goal: Fast, predictable retrieval of related songs for UI features.
Step 5: Analytics / Metadata Integration
Leverage existing SongModel fields:
Play count, favorite count, BPM, genre, etc.
Allow “Work-level” analytics by aggregating metrics across renditions.
Goal: Features like “Most popular rendition”, “Instrumental versions trending”, etc.
Step 6: Migration Strategy
For existing songs:
Provide a manual linking flow initially.
Optionally run heuristic suggestions for likely matches based on TitleDurationKey.
Ensure no data is lost and existing relationships remain intact.
Goal: Smooth transition without breaking current library data.
Step 7: UI/UX Considerations
Present renditions under a single work in lists or now-playing UI.
Clearly indicate rendition type (instrumental, vocal, live, etc.).
Allow users to filter or jump to other renditions.
Avoid overcomplicated graphs; keep parent-child simple.
Goal: Intuitive interface with minimal cognitive load.
Step 8: Enhancements
Implement merge suggestions for works automatically.
Allow users to tag renditions (e.g., “cover”, “remix”) to enrich metadata. With a dedicated UI
Integrate with recommendation engines (playlists, shuffle variants).
Consider analytics on listening habits per work vs per rendition.
Expected Benefits
Clean, maintainable DB structure.
Efficient retrieval of all renditions for UI or analytics.
Avoid duplication, cycles, and complex relationships.
User-driven linking ensures correctness.
Potential for automated or semi-automated suggestions in future.
References / Inspiration
Namida, Retro: Manual linking of ins...
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.