dharple/detox

Why detox removes underscores surrounding hyphens?

Closed this issue · 1 comments

Hi,

I have a large music collection I want to have "command line friendly". The newer albums I already named in a way

<countofalbumsongs>-<songnumber>_<songtitle>_-_<artist>_-_<album>_-_<releaseyear>.flac

Example: 05-03_-_street_dancing_-_timecrawler_82_-_osaka_lights_-_2018.flac

If I detox the directory it will replace all _-_ with - so the file names will look like

<countofalbumsongs>-<songnumber>-<songtitle>-<artist>-<album>-<releaseyear>.flac

Example: 05-03-street_dancing-timecrawler_82-osaka_lights-2018.flac

But this is not what I want because a hyphen is not a proper replacement for a space in my case. Reason: Some languages use hyphens in words to indicate a strong connection between the word meanings so I need a visual difference between a hyphen used in a word and a hypen separating to file name sections (like songtitle and artist). Using just an underscore as separator is not satisfying as well because some song song titles contain multiple words separated by space and these spaces I replaced with underscores. I want to have a visual distinction between a former space within a certain section (like "songtitle") and a space between these sections.

So how can I tell detox to just keep valid symbol combinations like _-_ in the middle of a file name?

Hello,

detox runs files through multiple filters. You can see them in /etc/detoxrc or /usr/local/etc/detoxrc, depending on how you installed it. You most likely only want to run the "safe" filter.

If you're using detox v1.x, you could add this to your detoxrc:

sequence "test" {
    safe;
};

And then run:

echo "this - is - a - test" | inline-detox -v -s test

And see if that outputs what you're expecting. The filter that converts _-_ to - is "wipeup".


If you're using detox v2.x or v3.x, you can add this to your detoxrc instead:

sequence "test" {
    safe {
        builtin "safe";
    };
};

You can use the same test.

Good luck! If you're not using inline-detox, you can use -n or --dry-run to test your config before actually renaming files.