Get useful stats about your libraries

In this example, you will:
  • Get stats on the differences in playlists between two libraries

  • Get stats on the missing tags in a local library

Set up logging

Set up logging to ensure you can see all info reported by the later operations. Libraries log info about loaded objects to the custom STAT level.

import logging
from musify.log import STAT

logging.basicConfig(format="%(message)s", level=STAT)

Report on differences in playlists

  1. Load two libraries. See other guides for more info on how to do this.

  2. Run the report:

    from musify.report import report_playlist_differences
    
    report_playlist_differences(source=local_library, reference=remote_library)
    

Report on missing tags

  1. Load a local library or collection of local objects. See other guides for more info on how to do this.

  2. Run the report:

    from musify.libraries.local.track.field import LocalTrackField
    from musify.report import report_missing_tags
    
    tags = [
        LocalTrackField.TITLE,
        LocalTrackField.GENRES,
        LocalTrackField.KEY,
        LocalTrackField.BPM,
        LocalTrackField.DATE,
        LocalTrackField.COMPILATION,
        LocalTrackField.IMAGES
    ]
    
    report_missing_tags(collections=local_library, tags=tags, match_all=False)