Import dvd, a file by chapter
My goal is to import a lot of dvd, one file by chapter, in the folder ~/dvd/TITLE_OF_THE_DVD/ . Here is a command line I wrote which seems to do it perfectly. One just had to add it to its bash file
And then use the command dvd when a dvd is in the reader.
Of course, sed, lsdvd and HandBrakeCLI must be installed and working. (Which in my case, is not the case with every dvd, for some reason that I do not understand), and /dev/sr0 should be replaced by the path to the dvd if its something else.
Oh, and if you wonder why I'm suddenly writting in english, it's only that I hope that google will index me, and help new people who search for this.
If you want an explanation, this command read the title thanks to lsdvd and then grep/sed. Then it also use lsdvd to read the list of title, and the number of chapter in each title, creating the command it will need to execute in the file output. Then it exececute and delete this file. In this file, for each title, there is a command looping for each chapter, extracting them one by one, in the file titlenumber-chapternumber, finally it deletes its temporary file and eject the dvd (which is REALLY important, because its the best way to let me know it has ended his task, as I'm not always looking at the terminal)
Of course, this is not 100% secure. If two dvd have the same title (can happen for a dvd and its bonus file, or a long film in two parts, or a dvd called "MYDVD") then the second dvd will overwrite the first one. Furthermore, if there is already a dvd/TITLE folder, with an output file containing line of code, then this file will be executed. Or if the title of the dvd contains a command doing bad things to your computer it may also be executed... But I hardly think that anyone will send me a dvd with such a title, so I keep this method.