JasonMillward / Autorippr

Rip discs automatically using a blend of Python, MakeMKV and HandBrake
MIT License
241 stars 60 forks source link

Limit Makemkv to first title, or don't overwrite existing encodes #75

Closed ascendedguard closed 9 years ago

ascendedguard commented 9 years ago

Currently using 1.7.0-test1.

I'm looking for a way to limit the script to only ripping/compressing the first title for Blu-ray movies. Currently, it will run makemkvcon on all titles > minLength, compress the 1st, then compress the 2nd, overwriting the first.

The larger problem is that the second tends to be a "special features" version of the movie. In the case of Inception, the 2nd title was the full movie with director commentary mixed in.

An alternate solution could be preventing the second encode from overwriting the first, so I could examine both and delete the wrong one.

Here's what the autorippr.log looks like in the case of multiple titles:

2015-03-21 02:55:53 - Rip - INFO - It took 30 minute(s) to complete the ripping of Inception_t01.mkv from Inception
2015-03-21 03:30:35 - Rip - INFO - It took 34 minute(s) to complete the ripping of Inception_t00.mkv from Inception
2015-03-21 03:30:35 - Compress - INFO - Compressing Inception
2015-03-21 07:44:10 - Compress - INFO - Movie was compressed and encoded successfully
2015-03-21 07:44:10 - Compress - INFO - It took 253 minutes to compress Inception
2015-03-21 07:44:11 - Extras - INFO - Attempting movie rename
2015-03-21 07:45:06 - Rip - INFO - Movie folder Inception already exists
2015-03-21 07:45:06 - Compress - INFO - Compressing Inception
2015-03-21 13:05:17 - Compress - INFO - Movie was compressed and encoded successfully
2015-03-21 13:05:17 - Compress - INFO - It took 320 minutes to compress Inception
2015-03-21 13:05:18 - Extras - INFO - Attempting movie rename
2015-03-21 13:10:06 - Rip - INFO - Movie folder Inception already exists
2015-03-21 13:10:06 - Compress - INFO - Queue does not exist or is empty
2015-03-21 13:10:06 - Extras - INFO - No movies ready for filebot

The end result was a single Inception.mkv where I'm not sure which title was the one saved.

JasonMillward commented 9 years ago

Yeah, that's not good. Overwriting shouldn't be happening but I can see why. I'll have a fix for you soon.

ascendedguard commented 9 years ago

I guess the real issue is here:

https://github.com/JasonMillward/Autorippr/blob/master/classes/handbrake.py#L41-L43

Since all titles will have the same moviename, multiple titles get named the same, and HandBrakeCLI appears to overwrite automatically (FFmpeg does not and errors out on title 2).

If you have an idea on how you want to fix this, I could likely work on it over the weekend. I'm guessing you have to change the name otherwise the files would be named the same. I also thought about ripping in /tmp/ and encoding to the output dir (and not renaming), but that only makes sense if doing both --rip --compress.

JasonMillward commented 9 years ago

The origin of the problem is more here: https://github.com/JasonMillward/Autorippr/blob/master/autorippr.py#L134

Which sets movie_title before its time: https://github.com/JasonMillward/Autorippr/blob/master/autorippr.py#L137

And gets stored https://github.com/JasonMillward/Autorippr/blob/master/autorippr.py#L155


The way I see it, the following changes need to happen.

And optionally:

I've started work on fixing this but I have limited free time so I might be slow in fixing. If you want to work on a solution I'm very happy to accept pull requests.

ascendedguard commented 9 years ago

I coded together an option to encode a single title where titleId == '0', but 0 doesn't appear to always be the main track. On "The Hangover", this was correct (total of 3 tracks). On "Inception", 0 was the commentary track (total of 2 tracks).

This is what the disc titles looked like for the two:

The Hangover

2015-05-04 22:50:54 - Makemkv - DEBUG - MakeMKV found 3 titles
2015-05-04 22:50:54 - Makemkv - DEBUG - MakeMKV title info: Disc Title: ['The Hangover'], Title No.: 1, Title: ['The_Hangover_t01.mkv'],
2015-05-04 22:50:54 - Makemkv - DEBUG - Title skipped due to singleReturn.
2015-05-04 22:50:54 - Makemkv - DEBUG - MakeMKV title info: Disc Title: ['The Hangover'], Title No.: 0, Title: ['The_Hangover_t00.mkv'],
2015-05-04 22:50:54 - Makemkv - DEBUG - MakeMKV title info: Disc Title: ['The Hangover'], Title No.: 2, Title: ['The_Hangover_t02.mkv'],
2015-05-04 22:50:54 - Makemkv - DEBUG - Title skipped due to singleReturn.
2015-05-04 22:50:55 - Rip - DEBUG - Attempting to rip The_Hangover_t00.mkv from The Hangover
2015-05-04 23:09:02 - Rip - INFO - It took 18 minute(s) to complete the ripping of The_Hangover_t00.mkv from The Hangover

Inception

2015-05-05 03:20:32 - Makemkv - DEBUG - MakeMKV found 2 titles
2015-05-05 03:20:32 - Makemkv - DEBUG - MakeMKV title info: Disc Title: ['Inception'], Title No.: 1, Title: ['Inception_t01.mkv'],
2015-05-05 03:20:32 - Makemkv - DEBUG - Title skipped due to singleReturn.
2015-05-05 03:20:32 - Makemkv - DEBUG - MakeMKV title info: Disc Title: ['Inception'], Title No.: 0, Title: ['Inception_t00.mkv'],
2015-05-05 03:20:33 - Rip - DEBUG - Attempting to rip Inception_t00.mkv from Inception
2015-05-05 03:55:13 - Rip - INFO - It took 34 minute(s) to complete the ripping of Inception_t00.mkv from Inception

I'll take a closer look and see if there's either a better way to determine which is the main track, but preventing the overwrites may still be the best option here. I could do a pull request for the singleReturn, but it seems like it wont solve the problem.

JasonMillward commented 9 years ago

Closing as #78 should fix this.