Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dvd_title [2013/08/01 10:48]
beandog
dvd_title [2018/03/27 23:53] (current)
beandog
Line 1: Line 1:
 ====== DVD Title ====== ====== DVD Title ======
  
-Each disc will have a title assigned to it.  This is a small string. ​ The disc title is **not** a unique identifer in itself, but it can be used as an element in creating one if you are archiving your titles.+  * [[dvd_info]] 
 +  * [[lsdvd]] 
 +  * [[volname]] 
 + 
 +I used to have a ''​dvd_title''​ binary I wrote, but I merged it into [[dvd_info]] instead. It returns the UDF volume name. It must be an ISO or the DVD itself in the drive to print it. 
 + 
 +<​code>​ 
 +$ dvd_info --title 
 +BATMAN_BEYOND_SEASON_1_DISC_2 
 +</​code>​ 
 + 
 +Each disc will have a title assigned to it.  This is a small string. ​ The disc title is **not** a unique identifer in itself, but it can be used as an element in creating one if you are archiving your titles. I recommend using the [[dvd_id|DVD id instead]]. 
 + 
 +Most of this page content is old, since I have [[dvd_info]] now.
  
 Most programs that access your DVD will at some point usually spit it out as part of displaying the metadata. Most programs that access your DVD will at some point usually spit it out as part of displaying the metadata.
Line 18: Line 31:
 <​code>​ <​code>​
 lsdvd dvd.iso 2> /dev/null | grep "^Disc Title" | cut -d " " -f 3- lsdvd dvd.iso 2> /dev/null | grep "^Disc Title" | cut -d " " -f 3-
 +</​code>​
 +
 +Or you can use ''​dd'':​
 +
 +<​code>​
 +dd if=VIDEO_TS.IFO bs=1 count=32 skip=64 2> /dev/null
 +</​code>​
 +
 +Also, here's a small C program I <​del>​wrote</​del>​ cobbled together from multiple sources to get it as well:
 +
 +<code c>
 +#include <​stdio.h>​
 +#include <​stdlib.h>​
 +#include <​unistd.h>​
 +#include <​string.h>​
 +#include <​sys/​ioctl.h>​
 +#include <​fcntl.h>​
 +#include <​linux/​cdrom.h>​
 +
 +/**
 + * A simple little program to get the DVD title
 + *
 + * Checks if the device is a DVD drive or not, and if it is, also looks to see
 + * if it can be polled or not.
 + */
 +
 +int main(int argc, char **argv) {
 +
 + int cdrom;
 + int drive_status;​
 + int disc_status;​
 + char* dvd_device;
 + char* status;
 + char title[33];
 + FILE* filehandle = 0;
 + int x, y, z;
 +
 + if(argc == 1)
 + dvd_device = "/​dev/​dvd";​
 + else
 + dvd_device = argv[1];
 +
 + // Check if device exists
 + if(access(dvd_device,​ F_OK) != 0) {
 + fprintf(stderr,​ "​cannot access %s\n", dvd_device);​
 + return 1;
 + }
 +
 + // Open device
 + cdrom = open(dvd_device,​ O_RDONLY | O_NONBLOCK);​
 + if(cdrom < 0) {
 + fprintf(stderr,​ "error opening %s\n", dvd_device);​
 + return 1;
 + }
 +
 + drive_status = ioctl(cdrom,​ CDROM_DRIVE_STATUS);​
 +
 + // If the device is a DVD drive, then wait up to 30 seconds for it to be ready (not opening or closing),
 + // and then check if there is a disc in the tray.  If there'​s no disc, exit quietly.
 + // If the drive is open, then it just quietly exits.
 + if(drive_status > 0) {
 + int max_sleepy_time = 30;
 + int num_sleepy_times = 0;
 + while(ioctl(cdrom,​ CDROM_DRIVE_STATUS) == CDS_DRIVE_NOT_READY && num_sleepy_times < max_sleepy_time) {
 + sleep(1);​
 + num_sleepy_times++;​
 + }
 + if(ioctl(cdrom,​ CDROM_DRIVE_STATUS) != CDS_DISC_OK) {
 + close(cdrom);​
 + return 1;
 + }
 + }
 +
 + close(cdrom);​
 +
 + filehandle = fopen(dvd_device,​ "​r"​);​
 + if(filehandle == NULL) {
 + fprintf(stderr,​ "could not open device %s for reading\n",​ dvd_device);​
 + return 1;
 + }
 +
 + if(fseek(filehandle,​ 32808, SEEK_SET) == -1) {
 + fprintf(stderr,​ "could not seek on device %s\n", dvd_device);​
 + fclose(filehandle);​
 + return 1;
 + }
 +
 + x = fread(title,​ 1, 32, filehandle);​
 + if(x == 0) {
 + fprintf(stderr,​ "could not read device %s\n", dvd_device);​
 + fclose(filehandle);​
 + return 1;
 + }
 + title[32] = '​\0';​
 +
 + fclose(filehandle);​
 +
 + y = sizeof(title);​
 + while(y-- > 2) {
 + if(title[y] == ' ') {
 + title[y] = '​\0';​
 + }
 + }
 +
 + for(z = 0; z < strlen(title);​ z++) {
 + printf("​%c",​ title[z]);
 + }
 + printf("​\n"​);​
 +
 + return 0;
 +}
 </​code>​ </​code>​
  

Navigation