LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Get video DVD title string for shell script? (http://www.linuxquestions.org/questions/linux-hardware-18/get-video-dvd-title-string-for-shell-script-319571/)

cheesekeeper 05-02-2005 11:50 PM

Get video DVD title string for shell script?
 
Should be a simple one:

How can I grab the title string of a video DVD for a shell script? I want to write a script that runs dd on disc insertion, and I want to set the title of the iso file to the title of the DVD.

Simon Bridge 05-03-2005 04:24 AM

um ... FC2 does this sort of thing for you: i.e. without requiring you to write a script to do it. You go to the main menue > preferences > CD and DVD. Theres a place to stick in the command you want to run and a radio button to check to run the command on insertion.

hw-tph 05-03-2005 05:01 AM

Our moderator acid_kewpie has made a nice DVD ripping tool called acidrip. This requires a tiny little helper utility called lsdvd which you could use: lsdvd -c | grep "Disc Title" | gawk '{print $3}' should give you the title of the inserted DVD.


Håkan

cheesekeeper 05-03-2005 12:37 PM

Not there
 
I don't have a CD and DVD menu item under Preferences. Is that an optional install? I'm using FC 2.

Quote:

Originally posted by Simon Bridge
um ... FC2 does this sort of thing for you: i.e. without requiring you to write a script to do it. You go to the main menue > preferences > CD and DVD. Theres a place to stick in the command you want to run and a radio button to check to run the command on insertion.

Electro 05-03-2005 07:57 PM

The utility dd will not work on DVD video disc. I suggest vobcopy or dvd::rip (transcode). vobcopy can list the title of the disc and also rip the whole disc. Then you can use mkisofs or growisofs to make an ISO image. mplayer's mencoder loses audio and video sync so I suggest not using acid::rip.

cheesekeeper 05-04-2005 01:03 AM

It's worked for me (but I'm tricking it)
 
I'm assuming you're telling me dd won't work because of the disc protections? I'm using a workaround for that, in which I call a program that uses libdvdcss right before dd.

I like your suggestion, though, and I will try that. I don't want to transcode anything, so I won't use mencoder.

Thanks.

Quote:

Originally posted by Electro
The utility dd will not work on DVD video disc. I suggest vobcopy or dvd::rip (transcode). vobcopy can list the title of the disc and also rip the whole disc. Then you can use mkisofs or growisofs to make an ISO image. mplayer's mencoder loses audio and video sync so I suggest not using acid::rip.

Simon Bridge 05-04-2005 04:55 AM

Not there??? Huh?!
 
Quote:

Originally posted by cheesekeeper
I don't have a CD and DVD menu item under Preferences. Is that an optional install? I'm using FC 2.
Good grief - well I have FC2, a standard install, and it's right there off the main menue in Gnome. The command is "gnome-cd-properties" which will also call the dialog from terminal. However, if you use KDE...?

cheesekeeper 05-04-2005 11:24 AM

Re: Not there??? Huh?!
 
Hehehe. Yes. I'm on KDE. I should have mentioned that.

Quote:

Originally posted by Simon Bridge
Good grief - well I have FC2, a standard install, and it's right there off the main menue in Gnome. The command is "gnome-cd-properties" which will also call the dialog from terminal. However, if you use KDE...?

urka58 05-04-2005 06:31 PM

This script could be useful for the purpose. It gives you the infos you need to rip a DVD. Some extra programs are required such as
lsdvd
streamanalyze
streamdvd
figlet
The comments are in italian

#!/bin/sh
# dvdinfo.sh
# script per rilevare le informazioni di un DVD VIDEO. Richiede streamanalyze e lsdvd
# Per poter estrarre il DVD bisogna avere installato streamdvd.
clear
echo "INSERIRE IL TITOLO DEL DVD"
# directory dove verranno creati i files temporanei
dir=/home/$(whoami)/tmp_dvd
# definisce il titolo che verrą usato come nome base dei vari files creati
read film
# inizializza la variabile "titolo" con l'output del comando. (restituisce un numero intero decimale)
titolo=`lsdvd -x | grep Longest | awk '{print $3}'`
# inizializza la variabile "audio" con l'output del comando. (restituisce un numero esadecimale 0xNN)
audio=`lsdvd -t "$titolo" -v -a | grep Italiano | grep ac3 | awk '{print $20}'`
clear
# redirige l'output sul file che conterrą le informazioni del DVD
streamanalyze -i /dev/dvd -t $titolo -s 0xe0,$audio 1>&/$dir/$film
# inizializza la variabile "factor" con l'ouput del comando (restituisce un numero decimale in virgola mobile)
factor=`grep Factor $dir/$film | awk '{print $3,$4}'`
# inizializza la variabile "capitoli" con l'output del comando (restituisce un numero intero decimale)
capitoli=`grep Chapters $dir/$film | awk '{print $4}'`
echo
echo
echo "RIASSUNTO DEI VALORI DEL FILM"
figlet -c $film
echo "IL TITOLO CONTENENTE IL FILM E'---------------$titolo"
echo "RANGE DEI CAPITOLI----------------------------1-$capitoli"
echo "IL VALORE DEL FLUSSO VIDEO E'-----------------0xe0"
echo "IL VALORE DEL FLUSSO AUDIO (Italiano) E'------$audio"
echo "IL VALORE DEL FATTORE DI REQUANT E'-----------$factor"
# Qui termina la parte di raccolta delle info sul DVD
echo
echo
echo
# Esegue il ripping del DVD in caso di risposta affermativa, altrimenti termina il programma
echo "E' ORA POSSIBILE INIZIARE IL RIPPING DEL DVD $film"
echo "VUOI INIZIARE IL RIPPING ?"
read risposta
case $risposta in
y|yes|s|si)
if [ "$factor" != "not needed" ]; then
streamdvd -i /dev/dvd -t $titolo -c 1-$capitoli -s 0xe0,$audio -f $factor > /home/$(whoami)/$film.mpeg
else
streamdvd -i /dev/dvd -t $titolo -c 1-$capitoli -s 0xe0,$audio > /home/$(whoami)/$film.mpeg
fi
;;
n|no)
echo "IL PROGRAMMA VERRA' TERMINATO"
;;
esac


Hope this helps
Ciao

Simon Bridge 05-05-2005 06:53 AM

cheeskeeper: don't sweat it - you asked for a script... you had no reason to know that Gnome had a built-in to deal with what you wanted. Now... re: ripping dvd's, you seem to be in good hands...


All times are GMT -5. The time now is 06:19 AM.