clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
673 stars 176 forks source link

Handle bluray folders #1588

Open breezytm opened 5 years ago

breezytm commented 5 years ago

Hello Clinton,

Is there a way for nzbToMedia to transcode the bluray to mkv?

breezytm commented 5 years ago

Before I do that, would you encrypt the password on the text .cfg file?

breezytm commented 5 years ago

Also how come it is working for you but not working for me? Do you nzbget or whatever tool you use running as root? I have nzbget running as nzbget user

clinton-hall commented 5 years ago

fair call.. I currently don't have any encryption in the .cfg file... I'll need to do some research as to how to handle that... personally, my biggest concern is around giving the script sudo access (as opposed to the sudo password being stored within the .cfg). encrypting this will prevent anyone with access to the .cfg learning the password, and also protect people when they post their .cfg here asking for help.

For me this works becasue my NAS does not accept su or sudo. NZBGet runs as admin user, but the way the busybox commands work mount and umount work when called by admin.

labrys commented 5 years ago

@clinton-hall From a security perspective I see this is as a very bad idea. The permissions of the user to run that command should be an environment configuration. For example you can use a combination of sudo and visudo to give passwordless access to the user for discretionary access to execute the command while not allowing other root commands. This should not be done by the application, there are too many ways it could be a security concern.

Edit: Just saw that this was related to mounting/unmounting - there's a good reason that mounting/unmounting requires root as it can be used for privilege escalation. I don't see an effective way of automating this without opening serious security concerns.

clinton-hall commented 5 years ago

@labrys agreed... the 7zip methodology worked well, but the issue is 7zip does not support bluray .iso. Likewise isoparser fails.

There has to be someway of using python to browse and extract from bluray .iso files, but this is way above my capabilities...

mount works fine for me on my NAS but obviously not on any system requiring sudo.

do you know if the ctypes library (snippet of code above that came from a sourceforge page) would allow mounting and parsing without requiring root privileges? or is that essentially going to emulate the mount command and have the same limitations?

clinton-hall commented 5 years ago

FWIW, I note a request on 7zip page to support BD iso. I have provided info there to see if this can be added.

labrys commented 5 years ago

I'm fairly certain that mounting with ctypes requires root.

labrys commented 5 years ago

Have you tried using rar? I'm fairly sure it can extract bluray isos.

clinton-hall commented 5 years ago

testing unrar at my end does not work. I have seen some indication online that winRAR does work, but unrar on linux does not.

I have provided more info to 7zip dev to see if 7zip can support UDF 2.50 and 2.60 iso files. If so, then I am confident the changes I have made will work for bluray images.

To Sum up: -1. Bluray file structure is supported. - All video files are transoced in order (main movie followed by extra features) -2. 7zip is called first for .iso files -3. If 7zip failed to match DVD or Bluray file structure the script attempts to mount and then parse the folder structure.

So if mount works (some busybox systems or any system where the downloader runs as root) this will work. Otherwise if/when 7zip is updated, this will work.

I'll remove the changes I have made for the sudo password...

breezytm commented 5 years ago

Sounds good. Is there a ticket on their side you can add to this thread for us to track the changes on there end.

labrys commented 5 years ago

@clinton-hall can you detect that the reason for failure is a bluray iso? If so then possibly raise warning informing user to manually extract?

clinton-hall commented 5 years ago

Ticket at 7zip: https://sourceforge.net/p/sevenzip/discussion/45797/thread/21f213e2/

I can't currently detect bluray iso as the reason for failure. In fact the issue is that 7zip actually does produce a file list, but it isn't correct (as per thread linked above Igor has indicated this is actually parsing an internal zip file) and therefore doesn't look like the expected DVD / BluRay structure.

clinton-hall commented 5 years ago

@breezytm for what it is worth, I transcoded that same movie to 1080p (so it should now be playable). Remembering that this is for the full 3+ hours of bonus features etc as well... the transcoding on my NAS took about 48 hours!

breezytm commented 5 years ago

Hey I was out for a little while dealing with my mothers passing. Glad to see you open a case to get this included.

clinton-hall commented 5 years ago

@breezytm Sorry to hear that. I hope you and your family are doing well. As soon as I can get either 7zip that handles these, or another iso-parsing tool, I will update this further.