I have an issue with subtitles being moved into separate folder from movies.
My current script...
Code: Select all
\\192.168.0.160\Multimedia/Movies/{f =~ /(?i)3D|3\.D|3\-D/ ? '3D Movies' : vf =~ /2160p/ ? '4K Movies' : 'Movies'}/{AZ}/
{kodi.name} [{director}] [{imdbid}]
/{kodi.name} [{vf} {vc} {hdr}
{
def codecList =
[
'MP3' : 'MP3',
'PCM' : 'PCM',
'AAC LC' : 'AAC',
'AAC LC SBR' : 'AAC',
'AC 3' : 'AC3',
'AC 3 Dep' : 'EAC3',
'E AC 3' : 'EAC3',
'E AC 3 JOC' : 'EAC3 Atmos',
'DTS' : 'DTS',
'DTS 96 24' : 'DTS 96-24',
'DTS ES' : 'DTS-ES',
'DTS ES XXCH' : 'DTS-ES',
'DTS XBR' : 'DTS-HD HRA',
'DTS ES XBR' : 'DTS-HD HRA',
'DTS ES XXCH XBR' : 'DTS-HD HRA',
'DTS XLL' : 'DTS-HD MA',
'DTS ES XLL' : 'DTS-HD MA',
'DTS ES XXCH XLL' : 'DTS-HD MA',
'DTS XLL X' : 'DTS-X',
'MLP FBA' : 'TrueHD',
'MLP FBA 16 ch' : 'Dolby Atmos'
]
def filter = { [it.codec, it.ch, it.objects] }
def audioStreams = []
def audioClean = { it.replaceAll(/[\p{Pd}\p{Space}]/, ' ').replaceAll(/\p{Space}{2,}/, ' ').slash(' ') }
def channelClean = { it.replaceAll(/Debug.+|Object\sBased\s?\/?|(\d+)?\sobjects\s\/\s|0.(?=\d.\d)|20/).replaceAll(/6.0/,'5.1').replaceAll(/8.0/,'7.1')}
def oneStream = { it.collect{ filter(it) }*.minus(null).unique().flatten().join(' ') }
def dString = { it.toDouble().toString() }
def toInt = { it.toInteger() }
audio.collect{ au ->
def codec = audioClean(any{ au['CodecID/Hint'] }{ au['Format'] })
def format_profile = any{ audioClean(au['Format_AdditionalFeatures'])}{}
def String ch = any{ channelClean(au.ChannelPositionsString2).tokenize('\\/')*.toDouble().toString().sum() }
{ channelClean(dString(au.ChannelsOriginal)) } { channelClean(dString(au.Channels)) }
def chFilter = (( ( (ac == 'AAC'||ac == 'MP3') && ch != '2.0') || ( (ac == 'AC3'||ac == 'EAC3'||ac == 'DTS'||ac == 'TrueHD'||ac == 'MLPFBA') && ch != '5.1' ) ) ? ch : null)
def combined = allOf{codec}{format_profile}.join(' ')
audioStreams << ['index' : codecList.findIndexOf {it.key == combined}, 'default' : au['default'][0].toBoolean(),
'codec' : codecList.get(combined, 'UNKNOWN_FORMAT'), 'combined' : combined, 'ch' : ch,
'bitrate' : any{toInt(au.BitRate)}{toInt(au.BitRate_Maximum)}{au.FrameRate.toDouble()}{null},
'objects' : any{'(' + au['NumberOfDynamicObjects'] + ' Objs)'}{null}, 'lang' : any{au.'LanguageString3'.upperInitial()}{null} ]
return audioStreams
}
def allStreams = audioStreams.collect{ filter(it) }*.minus(null).unique()*.join(' ')
def preferredStream = oneStream(audioStreams.findAll{ it.index == audioStreams.index.max() })
def bestBitRate = oneStream(audioStreams.findAll{ it.bitrate == audioStreams.bitrate.max() })
def defaultStream = oneStream(audioStreams.findAll{it.default == true})
}]
{[source]} [{runtime}mins]
Example
The film gets put into correct folder and named properly
Code: Select all
\\192.168.0.160\Multimedia\Movies\Movies\A\Æon Flux (2005) [Karyn Kusama] [tt0402022]\Æon Flux (2005) [1080p x265 AAC 5.1] [BluRay] [93mins].mp4
Code: Select all
\\192.168.0.160\Multimedia\Movies\A\Æon Flux (2005).eng [Karyn Kusama] [tt0402022]\Æon Flux (2005).eng [ ] [93mins].srt
I can only guess that the subtitle has no video information so its named differently... that's all i have got

Thank you