Renaming Multiple Same Language Subtitles
-
- Posts: 70
- Joined: 19 Apr 2017, 22:13
Re: Renaming Multiple Same Language Subtitles
this is on strict mode
Re: Renaming Multiple Same Language Subtitles
No file / episode match for rows 2-5 and so your custom format is completely irrelevant since it's never applied to any file / episode matches other than row 1.
2_English means nothing and could be anything. We would expect Strict Mode to reject and ignore that file with extreme prejudice. Unless the parent folder was named Friends 2x01 maybe or some other clearly determining factor.
2_English means nothing and could be anything. We would expect Strict Mode to reject and ignore that file with extreme prejudice. Unless the parent folder was named Friends 2x01 maybe or some other clearly determining factor.
Please read the FAQ and How to Request Help.
Re: Renaming Multiple Same Language Subtitles
How are files organized into folders?
If those 5 files were in a common folder named Friends.S02E01 then it would work. But if you're not using Episode folders, then file names such as 2_English just won't work, because the file path must have some identifying information.rednoah wrote: ↑31 Jul 2014, 16:40 Include file paths as text when reporting mismatches (press F7 to copy debug information)
Please read the FAQ and How to Request Help.
Re: Renaming Multiple Same Language Subtitles
Some Plain File Mode pre-processing is conceivable. Just a matter of taking all the subtitle files, and then renaming to the same file name of whatever video file is in the same folder. It's not an assumption FileBot can make by default, but it's certainly an assumption you can make for your specific use case.
Code: Select all
{ folder.files.max{ it.length() }.nameWithoutExtension }{ subt }
Please read the FAQ and How to Request Help.
-
- Posts: 70
- Joined: 19 Apr 2017, 22:13
Re: Renaming Multiple Same Language Subtitles
Hi Renoah
After using all the info you have supplied I have a great way (workaround) that im very happy with.
I have used the presets function.
Initially I run a preset that renames the subtitles to match the file name in the folder with the (digit) on the end.
Then I run the next preset which is my format which moves it to the correct target location and the multiple subtitles.
Big thanks for the insight how to do this.
After using all the info you have supplied I have a great way (workaround) that im very happy with.
I have used the presets function.
Initially I run a preset that renames the subtitles to match the file name in the folder with the (digit) on the end.
Then I run the next preset which is my format which moves it to the correct target location and the multiple subtitles.
Big thanks for the insight how to do this.
-
- Posts: 70
- Joined: 19 Apr 2017, 22:13
Re: Renaming Multiple Same Language Subtitles
Initial Subs Renaming
-
- Posts: 70
- Joined: 19 Apr 2017, 22:13
Re: Renaming Multiple Same Language Subtitles
The Final naming
-
- Posts: 70
- Joined: 19 Apr 2017, 22:13
Re: Renaming Multiple Same Language Subtitles
Case closed
Re: Renaming Multiple Same Language Subtitles
Hey CHA0SENG7NE, can you share your final script. Thanks.
-
- Posts: 70
- Joined: 19 Apr 2017, 22:13
Re: Renaming Multiple Same Language Subtitles
Movie
TV Shows
Rename subs same as movie (must all be in same folder)
Use plain file
Once you have run the renaming of subs to match the file you can run the tv show to name correctly and traansfer
Hope that helps
Code: Select all
Your Target/{f =~ /(?i)3D|3\.D|3\-D/ ? '3D Movies' : vf =~ /2160p/ ? '4K Movies' : 'Movies'}/{AZ}/
{ny}
/{ny} - [{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',
'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' : 'Dolby TrueHD',
'MLP FBA 16 ch' : 'Dolby Atmos'
]
def filter = { [it.codec, it.ch, it.objects, it.lang] }
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}]
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})
allStreams.join(' ').space(' ')
preferredStream.space(',')
defaultStream.space(' ')
bestBitRate.space(' ')
[bestBitRate, preferredStream].unique().join(' ')
}]
{[source]}{subt}
{if (f.subtitle) '(' + { fn.matchAll(/\d+/).last() } + ')' }
{ if (f.subtitle) '(' + fn.match(/_(\d+)$/) + ')' }
Code: Select all
Your Target/{n}/Season {s00}/{episode}{" [$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',
'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' : 'Dolby TrueHD',
'MLP FBA 16 ch' : 'Dolby Atmos'
]
def filter = { [it.codec, it.ch, it.objects, it.lang] }
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}]
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})
allStreams.join(' ').space(' ')
preferredStream.space(',')
defaultStream.space(' ')
bestBitRate.space(' ')
[bestBitRate, preferredStream].unique().join(' ')
}]
{[source]}
{subt}{if (f.subtitle) '(' + fn.match(/_(\d{1,2})$|\((\d{1,2})\)$|^(\d+)_/) + ')' }
Use plain file
Code: Select all
{ folder.files.max{ it.length() }.nameWithoutExtension }{ subt }{ if (f.subtitle) '(' + fn.match(/_(\d{1,2})$|\((\d{1,2})\)$|^(\d+)_/) + ')' }
Hope that helps
-
- Posts: 32
- Joined: 15 Jun 2017, 00:46
Re: Renaming Multiple Same Language Subtitles
Thank you for the code above. Well done.
Question:
After the script renames the subs to match the movie, HOW do you rename to a final destination folder (I am copying across volumes and maintaining Plex naming standards) while keeping multiple subs (for me, typically, English, French, Spanish and Greek).
Question:
After the script renames the subs to match the movie, HOW do you rename to a final destination folder (I am copying across volumes and maintaining Plex naming standards) while keeping multiple subs (for me, typically, English, French, Spanish and Greek).
-
- Posts: 32
- Joined: 15 Jun 2017, 00:46
Re: Renaming Multiple Same Language Subtitles
Never mind, I figured out the changes I have to make to the code.... Sorry. Momentary brain fart. Must be old age and why no one wants to hire me.
Take care.
Take care.