Modify titles with track numbers?

Thanks for the wonderful beets tool. It is just amazing!

However one thing isn’t clear to me: I have albums (audiobooks) where the title (template var $title) contains the track number, i.e.

In Zeiten des abnehmenden Lichts (Ungekürzte Lesung) 01/69

Here is 01 the track number. I would like to change this to

In Zeiten des abnehmenden Lichts 01

However the track number isn’t fixed, so In Zeiten des abnehmenden Lichts (Ungekürzte Lesung) 02/69 I’d like to change to In Zeiten des abnehmenden Lichts 02, etc.

Can I do this somehow with the modify command for all tracks in the “In Zeiten des abnehmenden Lichts” album?


ps: I want to keep the track number in the title because of the audio player I use.

There’s not an obvious way to do this currently. This feature would probably be relevant to you:

Maybe some clever shell scripting could take the results of beet ls -f <something>, do some string manipulation, and then feed the results back into beet modify title=<something>?

1 Like

I just [quote=“adrian, post:2, topic:1598”]
Maybe some clever shell scripting could take the results of beet ls -f <something> , do some string manipulation, and then feed the results back into beet modify title=<something> ?
[/quote]

For my particular case I did just that using xonsh:

for line in $(beet ls "title:In Zeiten des abnehmenden Lichts (Ungekürzte Lesung)" -f '$title%$track').splitlines():
    (title, track) = line.split('%')
    beet modify @(f'title:{title}') @(f'track:{track}') f'title=In Zeiten des abnehmenden Lichts {track}'

But I guess some enhanced modify command is more practical - or a plugin providing a new template variable $title_with_track_num or similar…