Removing last characters from a field like samplerate and kbps to only keep the numbers

I’m trying to find a way to remove the last x characters from a field.
So that I can build a '(FLAC 24-192) string in my path. Therefore I have to remove the ‘kHz’ string.

I’ve looked at the %left{text,n} command but I’d run into problems with the difference between 96kHz and 192Khz files. Since it’s not 2 but 3 characters.

So I’m looking for a way to remove x characters from the end.

Thanks for any ideas.

Jan

I recommend taking a look at the inline plugin, which lets you write little Python snippets to define fields that look however you like. For example:

item_fields:
    my_samplerate: samplerate / 1000

Great, I’m already using the inline plugin so this is easily added. Thanks.

This worked nicely thanks!

If you want a rounded value please use the following code:

   my_samplerate: round(samplerate / 1000)
1 Like