Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dvd_title [2013/08/01 16:44] – created beandog | dvd_title [2018/03/28 05: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. | + | * [[dvd_info]] |
+ | * [[lsdvd]] | ||
+ | * [[volname]] | ||
+ | |||
+ | I used to have a '' | ||
+ | |||
+ | < | ||
+ | $ dvd_info --title | ||
+ | BATMAN_BEYOND_SEASON_1_DISC_2 | ||
+ | </ | ||
+ | |||
+ | Each disc will have a title assigned to it. This is a small string. | ||
+ | |||
+ | 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. | ||
There are a few ways to get the title from a disc. In this case, I'm using Ruby Spears Superman, disc one. | There are a few ways to get the title from a disc. In this case, I'm using Ruby Spears Superman, disc one. | ||
+ | |||
+ | Volname is the simplest one, if you are looking to use it for a shell script: | ||
< | < | ||
Line 9: | Line 26: | ||
RUBY_SPEARS_SUPERMAN_DISC_01 | RUBY_SPEARS_SUPERMAN_DISC_01 | ||
</ | </ | ||
+ | |||
+ | Some other ways to get it: | ||
+ | |||
+ | < | ||
+ | lsdvd dvd.iso 2> /dev/null | grep "^Disc Title" | cut -d " " -f 3- | ||
+ | </ | ||
+ | |||
+ | Or you can use '' | ||
+ | |||
+ | < | ||
+ | dd if=VIDEO_TS.IFO bs=1 count=32 skip=64 2> /dev/null | ||
+ | </ | ||
+ | |||
+ | Also, here's a small C program I < | ||
+ | |||
+ | <code c> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | /** | ||
+ | * 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 = "/ | ||
+ | else | ||
+ | dvd_device = argv[1]; | ||
+ | |||
+ | // Check if device exists | ||
+ | if(access(dvd_device, | ||
+ | fprintf(stderr, | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | // Open device | ||
+ | cdrom = open(dvd_device, | ||
+ | if(cdrom < 0) { | ||
+ | fprintf(stderr, | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | drive_status = ioctl(cdrom, | ||
+ | |||
+ | // 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' | ||
+ | // 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, | ||
+ | sleep(1); | ||
+ | num_sleepy_times++; | ||
+ | } | ||
+ | if(ioctl(cdrom, | ||
+ | close(cdrom); | ||
+ | return 1; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | close(cdrom); | ||
+ | |||
+ | filehandle = fopen(dvd_device, | ||
+ | if(filehandle == NULL) { | ||
+ | fprintf(stderr, | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | if(fseek(filehandle, | ||
+ | fprintf(stderr, | ||
+ | fclose(filehandle); | ||
+ | return 1; | ||
+ | } | ||
+ | |||
+ | x = fread(title, | ||
+ | if(x == 0) { | ||
+ | fprintf(stderr, | ||
+ | fclose(filehandle); | ||
+ | return 1; | ||
+ | } | ||
+ | title[32] = ' | ||
+ | |||
+ | fclose(filehandle); | ||
+ | |||
+ | y = sizeof(title); | ||
+ | while(y-- > 2) { | ||
+ | if(title[y] == ' ') { | ||
+ | title[y] = ' | ||
+ | } | ||
+ | } | ||
+ | |||
+ | for(z = 0; z < strlen(title); | ||
+ | printf(" | ||
+ | } | ||
+ | printf(" | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | </ | ||
+ |