mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 06:13:19 -07:00
fix BMDV format handling. Fixes #1588
This commit is contained in:
parent
c39ebb8e2b
commit
066e93e807
1 changed files with 17 additions and 10 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
|
@ -664,15 +665,15 @@ def mount_iso(item, new_dir, bitbucket): #Currently only supports Linux Mount wh
|
||||||
except Exception:
|
except Exception:
|
||||||
vts_path = os.path.split(full_path)[0]
|
vts_path = os.path.split(full_path)[0]
|
||||||
return combine_vts(vts_path)
|
return combine_vts(vts_path)
|
||||||
elif re.match('.+BDMV[/\\]SOURCE[/\\][0-9]+[0-9].[Mm][Tt][Ss]', full_path) and '.mts' not in core.IGNOREEXTENSIONS:
|
elif re.match('.+BDMV[/\\]STREAM[/\\][0-9]+[0-9].[Mm]', full_path) and '.mts' not in core.IGNOREEXTENSIONS:
|
||||||
logger.debug('Found MTS image file: {0}'.format(full_path), 'TRANSCODER')
|
logger.debug('Found MTS image file: {0}'.format(full_path), 'TRANSCODER')
|
||||||
try:
|
try:
|
||||||
mts_path = re.match('(.+BDMV[/\\]SOURCE)', full_path).groups()[0]
|
mts_path = re.match('(.+BDMV[/\\]STREAM)', full_path).groups()[0]
|
||||||
except Exception:
|
except Exception:
|
||||||
mts_path = os.path.split(full_path)[0]
|
mts_path = os.path.split(full_path)[0]
|
||||||
return combine_mts(mts_path)
|
return combine_mts(mts_path)
|
||||||
logger.error('No VIDEO_TS or BDMV/SOURCE folder found in image file {0}'.format(item), 'TRANSCODER')
|
logger.error('No VIDEO_TS or BDMV/SOURCE folder found in image file {0}'.format(mount_point), 'TRANSCODER')
|
||||||
return [] # If we got here, nothing matched our criteria
|
return ['failure'] # If we got here, nothing matched our criteria
|
||||||
|
|
||||||
|
|
||||||
def rip_iso(item, new_dir, bitbucket):
|
def rip_iso(item, new_dir, bitbucket):
|
||||||
|
@ -723,9 +724,9 @@ def rip_iso(item, new_dir, bitbucket):
|
||||||
name=os.path.splitext(os.path.split(item)[1])[0], x=n + 1
|
name=os.path.splitext(os.path.split(item)[1])[0], x=n + 1
|
||||||
)
|
)
|
||||||
new_files.append({item: {'name': name, 'files': concat}})
|
new_files.append({item: {'name': name, 'files': concat}})
|
||||||
else: #check BlueRay for BDMV/SOURCE/XXXX.MTS
|
else: #check BlueRay for BDMV/STREAM/XXXX.MTS
|
||||||
mts_list_gen = (
|
mts_list_gen = (
|
||||||
re.match(r'.+(BDMV[/\\]SOURCE[/\\][0-9]+[0-9].[Mm][Tt][Ss])', line)
|
re.match(r'.+(BDMV[/\\]STREAM[/\\][0-9]+[0-9].[Mm]).', line)
|
||||||
for line in out.decode().splitlines()
|
for line in out.decode().splitlines()
|
||||||
)
|
)
|
||||||
mts_list = [
|
mts_list = [
|
||||||
|
@ -733,7 +734,10 @@ def rip_iso(item, new_dir, bitbucket):
|
||||||
for file_match in mts_list_gen
|
for file_match in mts_list_gen
|
||||||
if file_match
|
if file_match
|
||||||
]
|
]
|
||||||
mts_list.sort(key=lambda f: int(filter(str.isdigit, f))) # Sot all .mts files in numerical order
|
if sys.version_info[0] == 2: # Python2 sorting
|
||||||
|
mts_list.sort(key=lambda f: int(filter(str.isdigit, f))) # Sort all .mts files in numerical order
|
||||||
|
else: # Python3 sorting
|
||||||
|
mts_list.sort(key=lambda f: int(''.join(filter(str.isdigit, f))))
|
||||||
n = 0
|
n = 0
|
||||||
for mts_name in mts_list:
|
for mts_name in mts_list:
|
||||||
concat = []
|
concat = []
|
||||||
|
@ -785,8 +789,11 @@ def combine_vts(vts_path):
|
||||||
def combine_mts(mts_path):
|
def combine_mts(mts_path):
|
||||||
new_files = []
|
new_files = []
|
||||||
combined = ''
|
combined = ''
|
||||||
mts_list = [f for f in listdir(mts_path) if isfile(join(mts_path, f))]
|
mts_list = [f for f in os.listdir(mts_path) if os.path.isfile(os.path.join(mts_path, f))]
|
||||||
mts_list.sort(key=lambda f: int(filter(str.isdigit, f)))
|
if sys.version_info[0] == 2: # Python2 sorting
|
||||||
|
mts_list.sort(key=lambda f: int(filter(str.isdigit, f)))
|
||||||
|
else: # Python3 sorting
|
||||||
|
mts_list.sort(key=lambda f: int(''.join(filter(str.isdigit, f))))
|
||||||
for mts_name in mts_list: ### need to sort all files [1 - 998].mts in order
|
for mts_name in mts_list: ### need to sort all files [1 - 998].mts in order
|
||||||
concat = ''
|
concat = ''
|
||||||
concat += '{file}|'.format(file=os.path.join(mts_path, mts_name))
|
concat += '{file}|'.format(file=os.path.join(mts_path, mts_name))
|
||||||
|
@ -912,7 +919,7 @@ def transcode_directory(dir_name):
|
||||||
print_cmd(cmd)
|
print_cmd(cmd)
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=bitbucket)
|
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=bitbucket)
|
||||||
out, err = proc.communicate()
|
out, err = proc.communicate()
|
||||||
os.unlink(core.MOUNTED)
|
os.rmdir(core.MOUNTED)
|
||||||
core.MOUNTED = None
|
core.MOUNTED = None
|
||||||
if final_result == 0 and not core.DUPLICATE:
|
if final_result == 0 and not core.DUPLICATE:
|
||||||
for file in rem_list:
|
for file in rem_list:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue