Detox filenames

by manu

So I’ve this weird issue with my tvheadend setup when recording something. I usually want filenames to contain all the meta data, which is useful to me, such as the name of the movie/show or the episode name. Now with over-the-air EPG data, generally speaking, things are not as easy as they should be. It totally depends on the TV channel. Some of them provide no info at all while others provide too much data in a format that contains all kind of special characters. Sanitizing filenames could definitely be improved.

M720q: /pvr l
total 3.8G
drwxrwxrwx 1 root root 8.0K Sep  2 02:01  movies
drwxrwxrwx 1 root root 4.0K Aug 31 13:09  shows
-rwxrwxrwx 1 root root 2.0G Sep 10 02:25 'John-Wick-Kabel-Eins.John-Wick'$'\n''Action,-USA-2014'$'\n''Altersfreigabe_-ab-16'$'\n''(WH-vom-Mittwoch,
-04.09.2024,-23_30-Uhr).mkv'
-rwxrwxrwx 1 root root 931M Sep 10 12:57  Knight-Rider-Nitro.Das-zweite-Gesicht.mkv
-rwxrwxrwx 1 root root 933M Sep 10 13:52  Knight-Rider-Nitro.Fahrerflucht.mkv

My go-to solution so far has been to open pcmanfm in that folder, right click the filename and rename it to something more simple. The other day I got to know a better tool for the job. The detox command has been around for a few decades now. I simply run it in the current folder with detox . and I get a filename that I’m able to tab complete again.

M720q: /pvr l
total 3.8G
drwxrwxrwx 1 root root 8.0K Sep  2 02:01 movies
drwxrwxrwx 1 root root 4.0K Aug 31 13:09 shows
-rwxrwxrwx 1 root root 2.0G Sep 10 02:25 John-Wick-Kabel-Eins.John-Wick_Action,-USA-2014_Altersfreigabe-ab-16-WH-vom-Mittwoch,-04.09.2024,-23_30-Uhr.mkv
-rwxrwxrwx 1 root root 931M Sep 10 12:57 Knight-Rider-Nitro.Das-zweite-Gesicht.mkv
-rwxrwxrwx 1 root root 933M Sep 10 13:52 Knight-Rider-Nitro.Fahrerflucht.mkv