Arlodotexe / strix-music

Combine any music sources into a single library. It's your music. Play it your way.

Home Page:http://www.strixmusic.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove FileMetadataManager dependency in file scanners

Arlodotexe opened this issue · comments

commented

Background

The AudioMetadataScanner is responsible for scanning a folder for audio files, then scanning those files for audio metadata.
The PlaylistMetadataScanner is responsible for scanning a folder for playlist files, then scanning those files for playlist metadata.
The FileMetadataManager is responsible for managing the metadata scans of both audio and playlist files, then holding the data in memory and persisted to disk in "repositories".

The problem

These things have a pretty clear separation of concerns. FileMetadataManager internally uses AudioMetadataScanner and PlaylistMetadataScanner to scan files.

However, the scanners also take on a dependency of FileMetadataManager. It appears that this is currently being used to get scan type settings and update the number of files or folders scanned.

These are trivial things that don't require a full dependency on FileMetadataManager. Instead, let's:

  • Pass ScanType settings into scanner constructors
  • Use an event on the scanners to notify of a change in file found or files scanned
  • Write unit tests to ensure it works, if missing.