Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dvd_title [2013/08/01 16:48] – 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. | Most programs that access your DVD will at some point usually spit it out as part of displaying the metadata. | ||
| Line 18: | Line 31: | ||
| < | < | ||
| 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- | ||
| + | </ | ||
| + | |||
| + | 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; | ||
| + | } | ||
| </ | </ | ||