Add subtitle code

Support for macOS users
Post Reply
Lily
Posts: 8
Joined: 19 May 2024, 08:05

Add subtitle code

Post by Lily »

So I have a plain text code that you suggested for my art tutorial video, but the only issue is for the subtitle to be recognized as related to the episode below or above it. Please can you suggest a subtitle code that I can add to it.
The plain text code is:

Format: Select all

{
	folder.dir.dir
}
/
{
	def n = folder.dir.name
	def s = folder.name.match(/\d+/)
	def e = i.pad(2)
	def t = fn.replace('_':' ', '-':' ').upperInitial()
	
	"$n/Season $s/$n - S${s}E${e} - $t"
}
Example of art tutorial series

Code: Select all

2. Basic of Head Drawing.mp4
2. Basic of Head Drawing.srt
It changes to

Code: Select all

Illustrating Male Characters by Hyunkyu Kim - S02E01 - 02. Basics of Head Drawing.mp4
Illustrating Male Characters by Hyunkyu Kim - S02E02 - 02. Basics of Head Drawing.srt
What I want it to produce was

Code: Select all

Illustrating Male Characters by Hyunkyu Kim - S02E01 - 02. Basics of Head Drawing.mp4
Illustrating Male Characters by Hyunkyu Kim - S02E01 - 02. Basics of Head Drawing.srt
Thank you for your immediate response.
User avatar
rednoah
The Source
Posts: 24009
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Add subtitle code

Post by rednoah »

CONTEXT: Rename my training tutorial


{i} is a running number. No more. No less. It'll therefore yield 1 2 3 4 5 one after another for one file after another.


:idea: You could probably do something like this to generate 1 1 2 2 3 3 and so on, assuming that you can assume that all your files come in pairs:

Groovy: Select all

def e = (i/2).round().pad(2)


:idea: Alternatively, you can first only process the *.mkv files and then only process the *.srt files.



:idea: Alternatively alternatively, you can first only process the *.mkv files, and then drop the already renamed *.mkv files into New Names to use them as template to rename the *.srt files.
:idea: Please read the FAQ and How to Request Help.
Post Reply