DMouayad / DUNE

DUNE offers seamless music streaming from YouTube, YouTube Music, Spotify and local library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

implement `LocalMusicLibrary`

DMouayad opened this issue · comments

What needs to be done:

  • LocalMusicLibraryFacade: contains only a public interface which can be used by other components. Has a LocalMusicRepository

  • AudioLibraryScanner (with unit tests).

  • Implement the following functions in LocalMusicLibraryFacade:
    - addMusicDirectory
    - removeMusicDirectory

  • Turns out a LocalMusicLibraryRepository was not required and it only added an extra layer of complexity,
  • Now LocalMusicLibraryFacade manages the ops of:
    • loading previously stored music library.
    • add a list of tracks to the music library.
  • Finished unit-testing the following functionalities of LocalMusicLibraryFacade:
    • getLibrary
    • getAlbums
    • getArtists
    • getTracks
    • addTracksToLibrary

Implementing AudioLibraryScanner to search for audio files in a given directory(folder):

  • Option 1: read all files in a directory using dart:io package => then use metadata_god to read each file metadate => use Isolate.run to save the track cover to the app's direcotry => return the list of tracks when finished.

  • Option 2: add the previously described process to a custom package built upon metadata_god . This option may give us a performance advantage. especially with saving files in the backgroud.
    Note: check if we can save a group of files once instead of one each time.

Updates on

Implementing AudioLibraryScanner:

  • handle the search for music files in a given directory via AudioFilesScanner; a mixin to give us only audio files in a
    directory and its sub-directories.
  • extract a [BaseTrack] from a file via BaseTrackFromFileExtractor.
  • in an Isolate, saves the extracted image into the application directory.
  • add unit tests for AudioFileScanner.
  • add unit tests for AudioLibraryScanner's image saving feature.
  • in an Isolate, saves the extracted image into the application directory.

For now, we won't be using an Isolate for saving the image since it appears to take more time.
TODO: test this again in an integration test