Skip to content

refactor: create MusicLibrary and VideosLibrary models to better track library changes#773

Draft
huynhsontung wants to merge 3 commits intomainfrom
refactor-library-context
Draft

refactor: create MusicLibrary and VideosLibrary models to better track library changes#773
huynhsontung wants to merge 3 commits intomainfrom
refactor-library-context

Conversation

@huynhsontung
Copy link
Owner

@huynhsontung huynhsontung commented Jan 16, 2026

This pull request refactors the way music and video library data is managed in the application, moving from multiple loose collections and view models in LibraryContext to encapsulated MusicLibrary and VideosLibrary model objects. It also updates service interfaces and implementations to support progress reporting and improves code clarity and maintainability. The most important changes are grouped below.

Library Data Model Refactoring

  • Replaced individual collections (Songs, Albums, Artists, etc.) in LibraryContext with new MusicLibrary and VideosLibrary model objects, which encapsulate related data and simplify state management. (Screenbox.Core/Contexts/LibraryContext.cs, Screenbox.Core/Models/MusicLibrary.cs, Screenbox.Core/Models/VideosLibrary.cs) [1] [2] [3]
  • Updated all usages of music and video library properties and queries in controllers and services to use the new encapsulated model objects (StorageMusicLibrary, StorageVideosLibrary, etc.), improving naming consistency and clarity. (Screenbox.Core/Controllers/LibraryController.cs, Screenbox.Core/Services/LibraryService.cs) [1] [2] [3] [4] [5] [6] [7] [8]

Service Interface and Implementation Updates

  • Modified ILibraryService and its implementation to support progress reporting via IProgress<List<MediaViewModel>> when fetching music and videos, allowing for better feedback during long-running operations. (Screenbox.Core/Services/ILibraryService.cs, Screenbox.Core/Services/LibraryService.cs) [1] [2] [3]

Codebase Cleanup

  • Removed the obsolete LibraryContentChangedMessage class and its usages, streamlining message handling and reducing unnecessary complexity. (Screenbox.Core/Messages/LibraryContentChangedMessage.cs, Screenbox.Core/Contexts/LibraryContext.cs, Screenbox.Core/Screenbox.Core.csproj) [1] [2] [3]

Dependency Registration Adjustments

  • Updated service registration to remove transient registrations for ArtistViewModelFactory and AlbumViewModelFactory, reflecting changes in how these factories are used with the new data models. (Screenbox.Core/Common/ServiceHelpers.cs)

Project File Updates

  • Added new model files (MusicLibrary.cs, VideosLibrary.cs) to the project file and removed the obsolete message file, ensuring all changes are properly included in builds. (Screenbox.Core/Screenbox.Core.csproj) [1] [2] [3]

Base automatically changed from copilot/refactor-library-service-stateless to main January 18, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant