tracks commands¶
Import the streaming history and delete tracks from the library.
tracks history¶
Imports the extended streaming history from JSON files (see Spotify data export).
| Option | Default | Description |
|---|---|---|
--email |
MUSEFLOW_CLI_DEFAULT_EMAIL |
User email address. |
--directory |
required | Directory containing streaming history JSON files. |
--provider |
spotify |
Music provider to import streaming history from. |
--min-duration-played |
90 |
Minimum duration played in seconds to include. |
--batch-size |
20 |
Number of tracks to upsert per batch (1 to 500). |
--purge / --no-purge |
--no-purge |
Purge existing tracks before import. |
Prerequisites
- The user exists.
- A directory containing the exported
Streaming_History_Audio_*.jsonfiles. Other files of the export (video history,Userdata.json, ...) are ignored.
The history files are copied into the file storage (MUSEFLOW_FILE_STORAGE_DIR, .storage/ at the repository root by
default) for the time of the import, the same path an upload through the API takes, then deleted, also when the import
fails. Your export directory is left as it is.
Example
Output. While it runs, a progress bar on stderr counts the files read, then the tracks saved. Then a green
Import successful in <duration>! line and an Import Streaming History Results table with
these rows: items read; items skipped (no timestamp, short play, no track ID); unique track IDs; tracks already
known; total play events; play events created (each play is saved once); tracks created.
The import can be re-run with newer exports: only the plays not saved yet are added, so the play counts stay exact. Use --purge to
start from a clean library instead (this removes existing tracks of the provider first).
tracks delete¶
Deletes tracks matching filters.
| Option | Default | Description |
|---|---|---|
--email |
MUSEFLOW_CLI_DEFAULT_EMAIL |
User email address. |
--artist |
none | Filter by primary artist name (case-insensitive). |
--name |
none | Filter by track name (case-insensitive). |
--source |
all |
Filter by track source: all, history or discovery. |
--provider |
none | Filter by music provider (spotify): removes only its link from the matching tracks, and deletes the ones left with no provider link. |
--purge |
off | Delete all tracks, or only those matching --source and --provider (with --provider, as described above). Can't be combined with --artist or --name. |
--yes, -y |
off | Skip confirmation prompt. |
Give --artist and/or --name, or --purge.
Example
Output. When filtering by artist only, the matching track names are listed. Unless --yes is given, a
prompt About to delete N track(s) of <email>. Continue? must be confirmed. Then Deleted N track(s) of <email>., or
No tracks found matching the filters..
Warning
Deleting a track also deletes its rating and enrichment. Use rate export and
enrich export first if they should be kept.