Support multiple SRTs for same language for CC and Forced file naming

Request Type:
NEW FEATURE

Summary of the problem or suggestion:
Prior to processing videos through MCEBuddy I make sure that I’ve named the SRT files to match what Plex supports in regards to Forced and SDH. (Adding Local Subtitles to Your Media | Plex Support)

I would like for MCEBuddy to find matching SRTs based on the first part of the filename for processing and carry that over when outputting them.

For example:
If the original files are like this
Title.mp4
Title.eng.srt
Title.eng.cc.srt
Title.eng.forced.srt

That the output would have it be as follows
Title (2021).mkv
Title (2021).eng.srt
Title (2021).eng.cc.srt
Title (2021).eng.forced.srt

Any chance we could have this added soon? The manual effort of renaming these srt files after the processing is cumbersome.

INFORMATION> 2021-10-30T13:06:27 MCEBuddy.Engine.ConversionJob --> Found SRT file, moving to destination SRT:D:\Temp\working0\Cowboy Bebop - S01E17 - Mushroom Samba.eng.forced.srt Destination:\\NAS\Video\TV\Cowboy Bebop (1998)\Season 01\Cowboy Bebop - S01E17 - Mushroom Samba.eng.srt
2021-10-30T13:06:27 MCEBuddy.Engine.ConversionJob --> Subtitle file \\NAS\Video\TV\Cowboy Bebop (1998)\Season 01\Cowboy Bebop - S01E17 - Mushroom Samba.eng.srt exists, creating a new unique SRT filename
INFORMATION> 2021-10-30T13:06:27 MCEBuddy.Engine.ConversionJob --> Found SRT file, moving to destination SRT:D:\Temp\working0\Cowboy Bebop - S01E17 - Mushroom Samba.eng.srt Destination:\\NAS\Video\TV\Cowboy Bebop (1998)\Season 01\Cowboy Bebop - S01E17 - Mushroom Samba.eng0.srt

(match title).(lang code 2 or 3 character)(.cc or .sdh or .forced).srt

Thank you

1 Like

I too would love and welcome this feature!!!
I have many rips that include 3 sets of subtitles set up for use on my Plex server:
.eng.
.eng.sdh.
.eng.forced

While the above option does work by manually renaming all the external srt files to match the video files name generated by MCEBuddy, it still doesn’t merge the additional subs into the video (.mkv)
lastly and most imporatntly, the above solution ONLY works if I am “copying” (using the Unprocessed) profile. Other profiles which trim the start of each video no longer match the video file created by MCEBuddy.
I have found an app on GitHub which allows me to merge my external srt subs into an mkv file so that MCEBuddy can process the video and srt at the same time, but this app doesn’t keep the srt naming and instead just inserts them as 01, 02, 03. Mkvtoolnix Batch Tool

alternatively, is there or could there be a way of MCEBuddy to (at the very least) trim, rename and move the additional srt files to the output folder – keeping the .eng.forced.srt naming?

Since I really don’t trim my files anymore I wrote a PowerShell Core script that I execute as a PreCustomCommand. I pass the source path, source filename, destination path and destination filename as parameters. It will copy any srt or vtt that matches source video file, rename it to match the final video name (minus extension) and keep the language (although I change to eng if en-US or en) and the type if any.
I did it as a PreCustomCommand because at that point the normal MCEBuddy process hasn’t looked for a subtitle file but does have the metadata needed for renaming or custom renaming.
The process copies instead of moves so that it can verify that the subtitle file is in the destination properly and if it is it will delete the source subtitle file.

profile.config:

PreCustomCommandPath="C:\Program Files\PowerShell\7\pwsh.exe"
PreCustomCommandParameters="\\NAS\Video\Temp\Subtitle-Copy.ps1" -SourcePath "%originalfilepath%" -SourceFileBaseName "%originalfilename%" -DestinationPath "%destinationpath%" -DestinationFileBaseName "%convertedfilename%"
PreCustomCommandPeriod=0
PreCustomCommandCritical=false
PreCustomCommandUiSession=false
PreCustomCommandUiSession=false
PreCustomCommandShowWindows=false
PreCustomCommandExitCodeCheck=false

Subtitle-Copy.ps1:

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$SourcePath,
    [Parameter(Mandatory = $true)]
    [string]$SourceFileBaseName,
    [Parameter(Mandatory = $true)]
    [string]$DestinationPath,
    [Parameter(Mandatory = $true)]
    [string]$DestinationFileBaseName
)
try {
    $subtitleFileSuffix = ''
    $subtitleFiles = Get-ChildItem -Path $SourcePath -Filter "$($SourceFileBaseName)*" | Where-Object Extension -Match '\.(vtt|srt)'
    if ($subtitleFiles) {
        foreach ($subtitleFile in $subtitleFiles) {
            Write-Host "Subtitle File: $($subtitleFile.Name)"
            $subtitleFileSuffix = $subtitleFile.Name -replace "$([Regex]::Escape($SourceFileBaseName))\.(en-US|en)", '.eng'
            Write-Host "Subtitle File Suffix: $subtitleFileSuffix"
            if (!(Test-Path -Path $DestinationPath)) {
                Write-Host "Create Destination Directory: $DestinationPath"
                New-Item $DestinationPath -Type Directory | Out-Null
            }
            Write-Host "Copy $($subtitleFile.FullName) to $($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)"
            Copy-Item -Path $subtitleFile.FullName -Destination "$($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)" -Force
            $copyVerify = Test-Path -Path "$($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)"
            if ($copyVerify) {
                Write-Host "Delete $($subtitleFile.FullName)"
                Remove-Item -Path $subtitleFile.FullName -Force
            } else {
                Write-Host "Unable to verify $($subtitleFile.FullName) was copied to $($DestinationPath)\$($DestinationFileBaseName)$($subtitleFileSuffix)."
            }
        }
    } else {
        Write-Host 'No subtitle files found that match $($SourcePath)\$($SourceFileBaseName)* with extension srt or vtt.'
    }
} catch {
    $error[0]
}
1 Like

This feature has been added to today’s 2.5.7 beta build. It should detect qualifiers in SRT file names and retain then in the destination SRT filenames.

Try it out and let us know how it goes.

1 Like

downloading the updated beta now! thank you.!!!

Will the above feature added to today’s MCEBuddy Beta trim the additional eng.xxx.srt files as well as rename and copy them to their destination?

MCEBuddy syncs the srt with the conversion. So for example if the converted files has the first 60 seconds trimmed, it’ll do the same from the srt. If the converted file is having some sections of commercials removed, it’ll update the srt files to remove those sections as well.

1 Like