mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-07 05:31:11 -07:00
add option to join multiple videos. Fixes #570
This commit is contained in:
parent
4f025dd6ca
commit
e192f9a52c
3 changed files with 38 additions and 2 deletions
|
@ -255,6 +255,8 @@
|
||||||
transcode = 0
|
transcode = 0
|
||||||
###### duplicate =1 will cretae a new file. =0 will replace the original
|
###### duplicate =1 will cretae a new file. =0 will replace the original
|
||||||
duplicate = 1
|
duplicate = 1
|
||||||
|
# concat. joins cd1 cd2 etc into a single video.
|
||||||
|
concat = 1
|
||||||
ignoreExtensions = .avi,.mkv,.mp4
|
ignoreExtensions = .avi,.mkv,.mp4
|
||||||
# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used.
|
# outputFastStart. 1 will use -movflags + faststart. 0 will disable this from being used.
|
||||||
outputFastStart = 0
|
outputFastStart = 0
|
||||||
|
|
|
@ -127,6 +127,7 @@ CATEGORIES = []
|
||||||
|
|
||||||
GETSUBS = False
|
GETSUBS = False
|
||||||
TRANSCODE = None
|
TRANSCODE = None
|
||||||
|
CONCAT = None
|
||||||
FFMPEG_PATH = None
|
FFMPEG_PATH = None
|
||||||
DUPLICATE = None
|
DUPLICATE = None
|
||||||
IGNOREEXTENSIONS = []
|
IGNOREEXTENSIONS = []
|
||||||
|
@ -193,7 +194,7 @@ def initialize(section=None):
|
||||||
SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USELINK, OUTPUTDIRECTORY, \
|
SABNZB_NO_OF_ARGUMENTS, SABNZB_0717_NO_OF_ARGUMENTS, CATEGORIES, TORRENT_CLIENTAGENT, USELINK, OUTPUTDIRECTORY, \
|
||||||
NOFLATTEN, UTORRENTPWD, UTORRENTUSR, UTORRENTWEBUI, DELUGEHOST, DELUGEPORT, DELUGEUSR, DELUGEPWD, \
|
NOFLATTEN, UTORRENTPWD, UTORRENTUSR, UTORRENTWEBUI, DELUGEHOST, DELUGEPORT, DELUGEUSR, DELUGEPWD, \
|
||||||
TRANSMISSIONHOST, TRANSMISSIONPORT, TRANSMISSIONPWD, TRANSMISSIONUSR, COMPRESSEDCONTAINER, MEDIACONTAINER, \
|
TRANSMISSIONHOST, TRANSMISSIONPORT, TRANSMISSIONPWD, TRANSMISSIONUSR, COMPRESSEDCONTAINER, MEDIACONTAINER, \
|
||||||
METACONTAINER, SECTIONS, ALL_FORKS, TEST_FILE, GENERALOPTS, LOG_GIT, GROUPS, SEVENZIP, \
|
METACONTAINER, SECTIONS, ALL_FORKS, TEST_FILE, GENERALOPTS, LOG_GIT, GROUPS, SEVENZIP, CONCAT, \
|
||||||
__INITIALIZED__, AUTO_UPDATE, APP_FILENAME, USER_DELAY, APP_NAME, TRANSCODE, DEFAULTS, GIT_PATH, GIT_USER, \
|
__INITIALIZED__, AUTO_UPDATE, APP_FILENAME, USER_DELAY, APP_NAME, TRANSCODE, DEFAULTS, GIT_PATH, GIT_USER, \
|
||||||
GIT_BRANCH, GIT_REPO, SYS_ENCODING, NZB_CLIENTAGENT, SABNZBDHOST, SABNZBDPORT, SABNZBDAPIKEY, \
|
GIT_BRANCH, GIT_REPO, SYS_ENCODING, NZB_CLIENTAGENT, SABNZBDHOST, SABNZBDPORT, SABNZBDAPIKEY, \
|
||||||
DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \
|
DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \
|
||||||
|
@ -378,6 +379,7 @@ def initialize(section=None):
|
||||||
GETSUBS = int(CFG["Transcoder"]["getSubs"])
|
GETSUBS = int(CFG["Transcoder"]["getSubs"])
|
||||||
TRANSCODE = int(CFG["Transcoder"]["transcode"])
|
TRANSCODE = int(CFG["Transcoder"]["transcode"])
|
||||||
DUPLICATE = int(CFG["Transcoder"]["duplicate"])
|
DUPLICATE = int(CFG["Transcoder"]["duplicate"])
|
||||||
|
CONCAT = int(CFG["Transcoder"]["concat"])
|
||||||
IGNOREEXTENSIONS = (CFG["Transcoder"]["ignoreExtensions"])
|
IGNOREEXTENSIONS = (CFG["Transcoder"]["ignoreExtensions"])
|
||||||
if isinstance(IGNOREEXTENSIONS, str): IGNOREEXTENSIONS = IGNOREEXTENSIONS.split(',')
|
if isinstance(IGNOREEXTENSIONS, str): IGNOREEXTENSIONS = IGNOREEXTENSIONS.split(',')
|
||||||
OUTPUTFASTSTART = int(CFG["Transcoder"]["outputFastStart"])
|
OUTPUTFASTSTART = int(CFG["Transcoder"]["outputFastStart"])
|
||||||
|
|
|
@ -500,6 +500,7 @@ def processList(List, newDir, bitbucket):
|
||||||
remList = []
|
remList = []
|
||||||
newList = []
|
newList = []
|
||||||
delList = []
|
delList = []
|
||||||
|
combine = []
|
||||||
vtsPath = None
|
vtsPath = None
|
||||||
success = True
|
success = True
|
||||||
for item in List:
|
for item in List:
|
||||||
|
@ -519,9 +520,14 @@ def processList(List, newDir, bitbucket):
|
||||||
remList.append(item)
|
remList.append(item)
|
||||||
elif re.match(".+VIDEO_TS.", item) or re.match(".+VTS_[0-9][0-9]_[0-9].", item):
|
elif re.match(".+VIDEO_TS.", item) or re.match(".+VTS_[0-9][0-9]_[0-9].", item):
|
||||||
remList.append(item)
|
remList.append(item)
|
||||||
|
elif nzbtomedia.CONCAT and re.match(".+[cC][dD][0-9].", item):
|
||||||
|
remList.append(item)
|
||||||
|
combine.append(item)
|
||||||
else: continue
|
else: continue
|
||||||
if vtsPath:
|
if vtsPath:
|
||||||
newList.extend(combineVTS(vtsPath))
|
newList.extend(combineVTS(vtsPath))
|
||||||
|
if combine:
|
||||||
|
newList.extend(combineCD(combine))
|
||||||
for file in newList:
|
for file in newList:
|
||||||
if isinstance(file, str) and not 'concat:' in file and not os.path.isfile(file):
|
if isinstance(file, str) and not 'concat:' in file and not os.path.isfile(file):
|
||||||
success = False
|
success = False
|
||||||
|
@ -553,6 +559,7 @@ def ripISO(item, newDir, bitbucket):
|
||||||
out, err = proc.communicate()
|
out, err = proc.communicate()
|
||||||
result = proc.returncode
|
result = proc.returncode
|
||||||
fileList = [ re.match(".+(VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb])", line).groups()[0] for line in out.splitlines() if re.match(".+VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line) ]
|
fileList = [ re.match(".+(VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb])", line).groups()[0] for line in out.splitlines() if re.match(".+VIDEO_TS[\\\/]VTS_[0-9][0-9]_[0-9].[Vv][Oo][Bb]", line) ]
|
||||||
|
combined = []
|
||||||
for n in range(99):
|
for n in range(99):
|
||||||
concat = []
|
concat = []
|
||||||
m = 1
|
m = 1
|
||||||
|
@ -565,9 +572,14 @@ def ripISO(item, newDir, bitbucket):
|
||||||
break
|
break
|
||||||
if not concat:
|
if not concat:
|
||||||
break
|
break
|
||||||
|
if nzbtomedia.CONCAT:
|
||||||
|
combined.extend(concat)
|
||||||
|
continue
|
||||||
name = '%s.cd%s' % (os.path.splitext(os.path.split(item)[1])[0] ,str(n+1))
|
name = '%s.cd%s' % (os.path.splitext(os.path.split(item)[1])[0] ,str(n+1))
|
||||||
newFiles.append({item: {'name': name , 'files': concat}})
|
newFiles.append({item: {'name': name , 'files': concat}})
|
||||||
|
if nzbtomedia.CONCAT:
|
||||||
|
name = os.path.splitext(os.path.split(item)[1])[0]
|
||||||
|
newFiles.append({item: {'name': name , 'files': combined}})
|
||||||
if not newFiles:
|
if not newFiles:
|
||||||
logger.error("No VIDEO_TS folder found in image file %s" % (item), "TRANSCODER")
|
logger.error("No VIDEO_TS folder found in image file %s" % (item), "TRANSCODER")
|
||||||
newFiles = [failure_dir]
|
newFiles = [failure_dir]
|
||||||
|
@ -578,6 +590,7 @@ def ripISO(item, newDir, bitbucket):
|
||||||
|
|
||||||
def combineVTS(vtsPath):
|
def combineVTS(vtsPath):
|
||||||
newFiles = []
|
newFiles = []
|
||||||
|
combined = ''
|
||||||
for n in range(99):
|
for n in range(99):
|
||||||
concat = ''
|
concat = ''
|
||||||
m = 1
|
m = 1
|
||||||
|
@ -590,6 +603,25 @@ def combineVTS(vtsPath):
|
||||||
break
|
break
|
||||||
if not concat:
|
if not concat:
|
||||||
break
|
break
|
||||||
|
if nzbtomedia.CONCAT:
|
||||||
|
combined = combined + concat + '|'
|
||||||
|
continue
|
||||||
|
newFiles.append('concat:%s' % concat[:-1])
|
||||||
|
if nzbtomedia.CONCAT:
|
||||||
|
newFiles.append('concat:%s' % combined[:-1])
|
||||||
|
return newFiles
|
||||||
|
|
||||||
|
def combineCD(combine):
|
||||||
|
newFiles = []
|
||||||
|
for item in set([ re.match("(.+)[cC][dD][0-9].",item).groups()[0] for item in combine ]):
|
||||||
|
concat = ''
|
||||||
|
for n in range(99):
|
||||||
|
files = [ file for file in combine if n+1 == int(re.match(".+[cC][dD]([0-9]).",file).groups()[0]) and item in file ]
|
||||||
|
if files:
|
||||||
|
concat = concat + files[0] + '|'
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
if concat:
|
||||||
newFiles.append('concat:%s' % concat[:-1])
|
newFiles.append('concat:%s' % concat[:-1])
|
||||||
return newFiles
|
return newFiles
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue