Splits single-file albums for Lidarr using included CUE files
10K+
Splittarr is a small companion service for Lidarr that handles albums delivered as a single audio file plus one or more CUE sheets.
Lidarr usually expects individual track files. When a single-file album fails to import, Splittarr detects that failed queue item, finds the CUE file, splits the referenced audio into FLAC tracks with shnsplit, records the full processing history in SQLite, and removes only those generated files after Lidarr has imported them.
Splittarr continuously polls Lidarr's download queue and looks for queue records where:
completedimportFailedFor each matching download, Splittarr:
.cue filesshnsplit in that directorycompletedSplittarr does not delete the original album file, the CUE file, or arbitrary files in the download directory. Cleanup is based on the exact generated track paths recorded during splitting.
A common problematic album layout looks like this:
Album/
├── album.cue
└── album.flac
Lidarr may fail to import this because it wants separate track files. Splittarr turns it into something like:
Album/
├── album.cue
├── album.flac
├── Artist - Album - 01 - First Track.flac
├── Artist - Album - 02 - Second Track.flac
└── Artist - Album - 03 - Third Track.flac
Lidarr can then import the generated tracks. Once Lidarr no longer reports the download in its queue, Splittarr deletes the generated split files so the download directory is cleaned up while keeping the full history in its database and UI.
Splittarr serves a built-in monitoring UI. By default it listens on 127.0.0.1:9899.
The UI does not implement authentication, so avoid binding it to a public interface.
The UI includes:
//downloads/{download_id}When running Splittarr directly on the host, these tools need to be installed and available on PATH:
shnsplitflacOn Debian/Ubuntu-based systems, these are typically provided by:
sudo apt install shntool flac cuetools
When running the Docker image, the required tools are already installed in the image.
services:
splittarr:
image: gnarr/splittarr:latest
container_name: splittarr
restart: unless-stopped
environment:
SPLITTARR_LIDARR__URL: http://lidarr:8686
SPLITTARR_LIDARR__API_KEY: ${LIDARR_API_KEY}
# Optional, defaults shown:
SPLITTARR_DATA_DIR: /config
SPLITTARR_CHECK_FREQUENCY_SECONDS: 60
SPLITTARR_SERVER__BIND_ADDRESS: 127.0.0.1:9899
SPLITTARR_LOGGING__DOWNLOAD_LOG_ENABLED: "true"
SPLITTARR_LIDARR__MANUAL_IMPORT_ENABLED: "false"
SPLITTARR_GNUDB__DISC_LOOKUP_ENABLED: "false"
SPLITTARR_GNUDB__SERVER: gnudb.gnudb.org
SPLITTARR_GNUDB__USER_EMAIL: ""
SPLITTARR_CUE__STRICT: "false"
SPLITTARR_SHNSPLIT__PATH: shnsplit
SPLITTARR_SHNSPLIT__OVERWRITE: "true"
SPLITTARR_SHNSPLIT__FORMAT: "%p - %a - %n - %t"
volumes:
- ./config:/config
- /path/to/media:/data
The important bit is that Splittarr must see the same download paths that Lidarr reports in its queue.
For example, if Lidarr reports a failed download path as:
/data/downloads/Artist/Album
then Splittarr must also be able to access that exact path inside its container.
Splittarr can be configured with a TOML file, environment variables, or both.
Configuration is loaded in this order, with later sources overriding earlier ones:
config.toml in the current directory/config/config.toml~/.config/splittarr/config.toml-c or --configSPLITTARR_data_dir = "/config"
check_frequency_seconds = 60
[server]
bind_address = "127.0.0.1:9899"
[logging]
download_log_enabled = true
[gnudb]
disc_lookup_enabled = false
# Use "gnudb.gnudb.org", your signup host like "7vrcg0sd.gnudb.org",
# or just the unique signup code like "7vrcg0sd".
server = "gnudb.gnudb.org"
user_email = ""
[musicbrainz]
disc_lookup_enabled = true
base_url = "https://musicbrainz.org"
trust_disc_lookup = false
add_missing_release_group_enabled = false
[lidarr]
url = "http://lidarr:8686"
api_key = "your-lidarr-api-key"
manual_import_enabled = true
[cue]
strict = false
[shnsplit]
path = "shnsplit"
overwrite = true
format = "%p - %a - %n - %t"
Run with an explicit config file:
splittarr --config /path/to/config.toml
or:
splittarr -c /path/to/config.toml
Nested configuration keys use a double underscore.
export SPLITTARR_LIDARR__URL=http://lidarr:8686
export SPLITTARR_LIDARR__API_KEY=your-lidarr-api-key
export SPLITTARR_LIDARR__MANUAL_IMPORT_ENABLED=true
export SPLITTARR_LOGGING__DOWNLOAD_LOG_ENABLED=true
export SPLITTARR_GNUDB__DISC_LOOKUP_ENABLED=false
export SPLITTARR_GNUDB__SERVER=gnudb.gnudb.org
export [email protected]
export SPLITTARR_MUSICBRAINZ__DISC_LOOKUP_ENABLED=true
export SPLITTARR_MUSICBRAINZ__BASE_URL=https://musicbrainz.org
export SPLITTARR_MUSICBRAINZ__TRUST_DISC_LOOKUP=false
export SPLITTARR_MUSICBRAINZ__ADD_MISSING_RELEASE_GROUP_ENABLED=false
export SPLITTARR_CHECK_FREQUENCY_SECONDS=60
export SPLITTARR_SERVER__BIND_ADDRESS=127.0.0.1:9899
export SPLITTARR_SHNSPLIT__FORMAT="%p - %a - %n - %t"
splittarr
| Setting | Environment variable | Default | Description |
|---|---|---|---|
data_dir | SPLITTARR_DATA_DIR | platform data dir, /config in Docker | Directory used for Splittarr's SQLite database. |
check_frequency_seconds | SPLITTARR_CHECK_FREQUENCY_SECONDS | 60 | How often Splittarr polls Lidarr's queue. |
server.bind_address | SPLITTARR_SERVER__BIND_ADDRESS | 127.0.0.1:9899 | Address for the built-in web UI and health endpoint. |
logging.download_log_enabled | SPLITTARR_LOGGING__DOWNLOAD_LOG_ENABLED | true | Whether Splittarr writes splittarr.log into processed download folders. |
gnudb.disc_lookup_enabled | SPLITTARR_GNUDB__DISC_LOOKUP_ENABLED | false | Whether Splittarr may use CUE REM DISCID values to ask GnuDB for release-selection hints. |
gnudb.server | SPLITTARR_GNUDB__SERVER | gnudb.gnudb.org | GnuDB hostname or signup code, for example 7vrcg0sd.gnudb.org or 7vrcg0sd. |
gnudb.user_email | SPLITTARR_GNUDB__USER_EMAIL | empty | Email used in GnuDB's required hello field; required when GnuDB lookup is enabled. |
musicbrainz.disc_lookup_enabled | SPLITTARR_MUSICBRAINZ__DISC_LOOKUP_ENABLED | true | Whether Splittarr may calculate a MusicBrainz Disc ID from CUE/audio lengths and query MusicBrainz before GnuDB fallback. |
musicbrainz.base_url | SPLITTARR_MUSICBRAINZ__BASE_URL | https://musicbrainz.org | MusicBrainz base URL. |
musicbrainz.trust_disc_lookup | SPLITTARR_MUSICBRAINZ__TRUST_DISC_LOOKUP | false | Whether a successful MusicBrainz Disc ID match may override the initial CUE-title album match and choose another compatible Lidarr album/release for the same artist. |
musicbrainz.add_missing_release_group_enabled | SPLITTARR_MUSICBRAINZ__ADD_MISSING_RELEASE_GROUP_ENABLED | false | Whether Splittarr may add a missing Lidarr album for the same artist from a single MusicBrainz release-group Disc ID result before manual-import fallback gives up. |
lidarr.url | SPLITTARR_LIDARR__URL | required | Base URL for Lidarr, for example http://lidarr:8686. |
lidarr.api_key | SPLITTARR_LIDARR__API_KEY | required | Lidarr API key. |
lidarr.manual_import_enabled | SPLITTARR_LIDARR__MANUAL_IMPORT_ENABLED | true | Whether Splittarr should ask Lidarr to manually import generated tracks after splitting. |
cue.strict | SPLITTARR_CUE__STRICT | false | Whether CUE parsing should run in strict mode. |
shnsplit.path | SPLITTARR_SHNSPLIT__PATH | shnsplit | Path to the shnsplit executable. |
shnsplit.overwrite | SPLITTARR_SHNSPLIT__OVERWRITE | true | Whether shnsplit should overwrite existing output files. |
shnsplit.format | SPLITTARR_SHNSPLIT__FORMAT | %p - %a - %n - %t | Output filename format passed to shnsplit -t. |
MusicBrainz lookup is enabled by default. Splittarr reads referenced WAV/FLAC lengths, calculates a true MusicBrainz Disc ID, asks MusicBrainz /ws/2/discid, and selects a Lidarr release when MusicBrainz and Lidarr agree on a compatible release. If MusicBrainz is disabled or inconclusive, Splittarr falls back to GnuDB.
musicbrainz.trust_disc_lookup is a stronger, separate opt-in. Leave it false if Splittarr should only use MusicBrainz as a release-ID tie breaker inside the album Lidarr already matched from the CUE/download title. Set it to true if you want a MusicBrainz Disc ID match to be trusted enough to search the same Lidarr artist for another album whose title matches the MusicBrainz release or release-group title. Even when enabled, Splittarr still requires compatible track counts and still runs the final generated-track-to-Lidarr-track mapping before starting manual import.
musicbrainz.add_missing_release_group_enabled is disabled by default because it can change your Lidarr library. When enabled, if MusicBrainz Disc ID lookup returns releases that all belong to one release group and Splittarr cannot find a compatible Lidarr release, Splittarr asks Lidarr for lidarr:<release-group-mbid>, adds that album for the same artist as unmonitored, does not trigger a Lidarr search/download, and then tries the manual import again against the newly added album.
GnuDB lookup only uses 8-character CDDB/freeDB-style REM DISCID values from CUE files. If GnuDB registration says to change gnudb.gnudb.org to <code>.gnudb.org, put either that hostname or just <code> in gnudb.server; Splittarr builds the required plain HTTP CDDB endpoint internally.
Splittarr passes shnsplit.format directly to shnsplit -t.
The default is:
%p - %a - %n - %t
Common placeholders include:
| Placeholder | Meaning |
|---|---|
%p | performer |
%a | album |
%n | track number |
%t | track title |
So the default format creates filenames like:
Artist - Album - 01 - Track Title.flac
By default, Splittarr runs shnsplit with overwrite enabled.
That means generated files with the same names may be overwritten. This is usually what you want for repeated processing of the same failed download, but it is worth being aware of.
To disable overwriting:
[shnsplit]
overwrite = false
or:
SPLITTARR_SHNSPLIT__OVERWRITE=false
Splittarr keeps a SQLite database in data_dir/data.db.
It stores:
When a tracked download disappears from Lidarr's queue, Splittarr assumes Lidarr has either imported it or no longer needs it. Splittarr then deletes only the generated tracks recorded in its database.
If a generated track is already gone, Splittarr records that as missing and continues cleanup. Tracked downloads are never deleted from the database.
Build:
cargo build --release
Run with a config file:
cargo run -- --config config.toml
Run tests:
cargo test
Check that the path reported by Lidarr exists from Splittarr's point of view.
This is especially common with Docker. Lidarr and Splittarr need compatible volume mappings. If Lidarr reports /data/downloads/foo, Splittarr must also be able to read /data/downloads/foo.
Check:
SPLITTARR_LIDARR__URLSPLITTARR_LIDARR__API_KEYFor Docker Compose, using the service name usually works:
SPLITTARR_LIDARR__URL: http://lidarr:8686
Check that:
shnsplit is installedflac is installedSplittarr only creates track files. Lidarr still needs to be able to see and import those files itself.
Check that Lidarr and Splittarr share the same media/download volume paths.
Cleanup happens after the download disappears from Lidarr's queue.
If the item remains in Lidarr's queue, Splittarr keeps the generated files in place so Lidarr can still import them.
status = completed and trackedDownloadState = importFailed.Licensed under either of:
at your option.
Content type
Image
Digest
sha256:194335445…
Size
47.6 MB
Last updated
4 months ago
docker pull gnarr/splittarr