Skip to main content

Normalise iTunes-imported track filenames with a configurable delimiter and DiscN folders.

Project description

1. Environment

  • Python 3.14.6
  • pip 26.1.2

2. Installation

$ pipx install spreen-tracks

(pip install spreen-tracks works too if you prefer managing the environment yourself.)

For development, install the dependencies via requirements.txt:

$ pip install -r requirements.txt

3. Execution

Run the command inside your music directory — with no options it dry-runs, printing every rename it would perform without touching a file:

$ cd ~/Music
$ track-delimiter
Target extension is `.m4a`
========== [DRY RUN] Total File Count to Clean: 4 ==========
========== [DRY RUN] The delimiters of those files will be replaced with `_` ==========
========== [DRY RUN] Start! ==========
========== [DRY RUN] Replacing the delimiter: `./Artist/Album1/1-01 Title.m4a` => `./Artist/Album1/Disc1/01_Title.m4a` ==========
========== [DRY RUN] Replacing the delimiter: `./Artist/Album1/2-01 Title.m4a` => `./Artist/Album1/Disc2/01_Title.m4a` ==========
========== [DRY RUN] Replacing the delimiter: `./Artist/Album2/01 Title.m4a` => `./Artist/Album2/01_Title.m4a` ==========
========== [DRY RUN] Replacing the delimiter: `./Artist/Album2/02 Title.m4a` => `./Artist/Album2/02_Title.m4a` ==========
========== [DRY RUN] Done! ==========
========== [DRY RUN] Total Target File Count: 4 ==========

When the plan looks right, execute it with --mode e; --extension and --delimiter override the defaults:

$ track-delimiter --mode e
$ track-delimiter --extension .mp3 --delimiter - --mode e

As a library:

from spreen_tracks import Application

Application.run()                            # dry run over ./**/*.m4a
Application.run(delimiter='-', mode='e')     # execute the renames

4. Unit Test

$ pytest
============================= test session starts ==============================
platform linux -- Python 3.14.6, pytest-9.1.1, pluggy-1.6.0
rootdir: spreen-tracks/PyPI
configfile: pyproject.toml
collected 9 items

test/test_application.py ....                                            [ 44%]
test/test_cli.py .....                                                   [100%]

============================== 9 passed in 0.16s ===============================

5. Static Code Analysis

$ flake8 .
$ autoflake8 --in-place --remove-duplicate-keys --remove-unused-variables --recursive .
$ autopep8 --in-place --aggressive --aggressive --recursive .

6. Type Checks

$ mypy .
Success: no issues found in 6 source files

7. Build

$ python -m build
$ pipx install ./dist/spreen_tracks-0.1.0-py3-none-any.whl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spreen_tracks-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spreen_tracks-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file spreen_tracks-0.1.0.tar.gz.

File metadata

  • Download URL: spreen_tracks-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for spreen_tracks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 77bb543ae564ea1bee695b9f0e0de71254e9a0dbccdea4a0ad22fb828fc57a63
MD5 42ab400d616c42db363a08cb42da1ca5
BLAKE2b-256 befc22d923ec01921938708fb30d3ae71d0d0478836f71b28378079489f7d477

See more details on using hashes here.

File details

Details for the file spreen_tracks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: spreen_tracks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for spreen_tracks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae31f4aeafed97885563c270d598f8d4cee2dc1f13df6276642f48d8aec69c45
MD5 8338af89547afd96a3093f381fcbb1ff
BLAKE2b-256 945f752424e93791d4147ae9f86af6983f8fdc1087b015e72c7bdf465b5e67a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page