Bash script help needed to process a dvd
by GPGAgent from LinuxQuestions.org on (#4Y2P0)
Okay, I can use lsdvd to see what titles and chapters there are on a dvd, easy
I can manually run HandbrakeCLI to process a Title and Chapter
I would like to create a bash script to use the output of lsdvd to loop through that output to run HandbrakeCLI to extract the Title, and optionaly Titles and Chapters, but my beginner skills in bash aren't good enough.
One idea I have is to use lsdvd -C > dvd-structure.txt, then to process that file. But then I get stuck, I'm not sure how to process that file.
Any tips or help much appreciated.
This is what lsdvd -c gives me:
Code:charlie@charlie-machine:~$ lsdvd -c
Disc Title: WRONG TURN
Title: 01, Length: 01:29:28.920 Chapters: 13, Cells: 13, Audio streams: 01, Subpictures: 00
Chapter: 01, Length: 00:09:39.720, Start Cell: 01
Chapter: 02, Length: 00:06:44.560, Start Cell: 02
Chapter: 03, Length: 00:09:24.600, Start Cell: 03
Chapter: 04, Length: 00:06:26.920, Start Cell: 04
Chapter: 05, Length: 00:09:17.360, Start Cell: 05
Chapter: 06, Length: 00:09:44.800, Start Cell: 06
Chapter: 07, Length: 00:09:56.960, Start Cell: 07
Chapter: 08, Length: 00:06:59.280, Start Cell: 08
Chapter: 09, Length: 00:06:20.280, Start Cell: 09
Chapter: 10, Length: 00:04:44.160, Start Cell: 10
Chapter: 11, Length: 00:07:06.680, Start Cell: 11
Chapter: 12, Length: 00:03:03.120, Start Cell: 12
Chapter: 13, Length: 00:00:00.480, Start Cell: 13
Title: 02, Length: 00:00:01.000 Chapters: 01, Cells: 01, Audio streams: 00, Subpictures: 00
Chapter: 01, Length: 00:00:01.000, Start Cell: 01
Title: 03, Length: 00:00:12.000 Chapters: 01, Cells: 01, Audio streams: 00, Subpictures: 00
Chapter: 01, Length: 00:00:12.000, Start Cell: 01
Title: 04, Length: 00:01:46.440 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 00
Chapter: 01, Length: 00:01:46.440, Start Cell: 01Maybe I need to use awk? Somehow I need to find Title: and/or Chapter: and from that I can create a handbrakeCLI command......


I can manually run HandbrakeCLI to process a Title and Chapter
I would like to create a bash script to use the output of lsdvd to loop through that output to run HandbrakeCLI to extract the Title, and optionaly Titles and Chapters, but my beginner skills in bash aren't good enough.
One idea I have is to use lsdvd -C > dvd-structure.txt, then to process that file. But then I get stuck, I'm not sure how to process that file.
Any tips or help much appreciated.
This is what lsdvd -c gives me:
Code:charlie@charlie-machine:~$ lsdvd -c
Disc Title: WRONG TURN
Title: 01, Length: 01:29:28.920 Chapters: 13, Cells: 13, Audio streams: 01, Subpictures: 00
Chapter: 01, Length: 00:09:39.720, Start Cell: 01
Chapter: 02, Length: 00:06:44.560, Start Cell: 02
Chapter: 03, Length: 00:09:24.600, Start Cell: 03
Chapter: 04, Length: 00:06:26.920, Start Cell: 04
Chapter: 05, Length: 00:09:17.360, Start Cell: 05
Chapter: 06, Length: 00:09:44.800, Start Cell: 06
Chapter: 07, Length: 00:09:56.960, Start Cell: 07
Chapter: 08, Length: 00:06:59.280, Start Cell: 08
Chapter: 09, Length: 00:06:20.280, Start Cell: 09
Chapter: 10, Length: 00:04:44.160, Start Cell: 10
Chapter: 11, Length: 00:07:06.680, Start Cell: 11
Chapter: 12, Length: 00:03:03.120, Start Cell: 12
Chapter: 13, Length: 00:00:00.480, Start Cell: 13
Title: 02, Length: 00:00:01.000 Chapters: 01, Cells: 01, Audio streams: 00, Subpictures: 00
Chapter: 01, Length: 00:00:01.000, Start Cell: 01
Title: 03, Length: 00:00:12.000 Chapters: 01, Cells: 01, Audio streams: 00, Subpictures: 00
Chapter: 01, Length: 00:00:12.000, Start Cell: 01
Title: 04, Length: 00:01:46.440 Chapters: 01, Cells: 01, Audio streams: 01, Subpictures: 00
Chapter: 01, Length: 00:01:46.440, Start Cell: 01Maybe I need to use awk? Somehow I need to find Title: and/or Chapter: and from that I can create a handbrakeCLI command......