Page 1 of 1

Name a srt file to match movie name within folder?

PostPosted: Fri May 22, 2020 9:02 pm
by CHA0SENG7NE
Hi

Completely new to this software. Im trying to find a solution to rename srt (subtitle) file to match the video file in the same folder.

Can this software do this?

Many thanks for any guidance.

Re: Name a srt file to match movie name within folder?

PostPosted: Sat May 23, 2020 3:55 am
by Admin
Hello, please provide a few examples, from -> to (usually at least 5 examples would be useful) thanks

Re: Name a srt file to match movie name within folder?

PostPosted: Sat May 23, 2020 12:55 pm
by therube
Code: Select all
The 3 Stooges - New Malice.avi
3Stooges-NewMalice [EN-DVD].srt

Code: Select all
The 3 Stooges - New Malice.avi
The 3 Stooges - New Malice.srt

Re: Name a srt file to match movie name within folder?

PostPosted: Sat May 23, 2020 1:06 pm
by therube
JavaScript renaming, perhaps?

Rename-Pairs, perhaps?


The video file name & the .srt file name need not have commonality between them (like I've shown).
So you'd have to "pair" them up, in some manner.

Re: Name a srt file to match movie name within folder?

PostPosted: Sat May 23, 2020 1:23 pm
by CHA0SENG7NE
Sure here are a few examples I have...
I use emby server for my media so the corresponding subtitle usually an srt will need the movie file name plus language code.
For example..
Guardians of the Galaxy (2014) [1080p x264 AAC 5.1] [BluRay] [121mins].en.srt

I have a huge amount of srt that are labelled like this...

Movie file named

Frozen (2013) [1080p x265 AAC 5.1] [BluRay] [102mins].mp4

Srt's in same folder that arent recognised

Frozen (2013).eng [1080p x265 AAC 5.1] [BluRay] [102mins].srt

Frozen (2013) [ ] [102mins].eng.srt

For these to be recognised they would have to be named

Frozen (2013) [1080p x265 AAC 5.1] [BluRay] [102mins].eng.mp4

Hope that explains...

Thank you for getting back to me.

Re: Name a srt file to match movie name within folder?

PostPosted: Sun May 24, 2020 3:26 am
by Admin
Are these files all in the same folder? e.g. multiple movies and multiple subtitles files?
I think the best option would be to export all file names into Excel (select all the files you need in BRU, right click and select Clipboard Copy from the menu, then one of the formats).
Once the file list is in Excel use formulas to match files (like this cell value equal previous cell value) and create an Import Rename file to be imported in BRU and then rename them.

Re: Name a srt file to match movie name within folder?

PostPosted: Sun May 24, 2020 11:36 am
by CHA0SENG7NE
Thank you for the info
Each movie is in its own folder with the corresponding subtitle.

Re: Name a srt file to match movie name within folder?

PostPosted: Mon May 25, 2020 1:21 pm
by therube
(I'm not good with batch files...)


Since each movie/sub are in their own directory, you could use a batch file like:

Code: Select all
for  %%i  in (*.mp4 *.avi *.mpg *.flv)  do  rename  *.srt  "%%~ni.srt"


That should work when run within a particular directory.
Now if you were to get it to iterate down a directory tree...

Re: Name a srt file to match movie name within folder?

PostPosted: Mon May 25, 2020 9:58 pm
by CHA0SENG7NE
Thank you, I'll give that a try and report back.
If you have a moment to explain the code it would be appreciated. Seems like I have stumbled onto a very powerful and very well supported software!
Appreciated therube

Re: Name a srt file to match movie name within folder?

PostPosted: Wed May 27, 2020 4:53 pm
by therube
Basically, it looks for "video" files:
(*.mp4 *.avi *.mpg *.flv)
(adjust as needed)

At that point, it assumes it will find a .srt file in the same directory.
Then it renames said .srt - based upon the file name of the video file.

So if the video is
123.mp4
& the .srt is
abc.srt

it finds 123.mp4, the video file
the %~ni, says use the name portion of the filename - without the extension, so "123".

then it renames the .srt - no matter what it's current name is, to the (video) file name (as found above - without its' extension)

so, again "123", only it leave the existing .srt extension as it was
so "abc.srt" is renamed to 123.srt

& since 123.mp4 & 123.srt are both named the "same", when you play 123.mp4, the subtitles should then display, as expected. (And as you know, the file names, name part, exclusive of extension, of the video & the .srt must be the same for this to happen.)

Re: Name a srt file to match movie name within folder?

PostPosted: Wed May 27, 2020 10:01 pm
by CHA0SENG7NE
Thank you for taking the time, that is very helpful.
Its great to have a solution but understanding it is so much better.
Its just i have no idea how to implement this!

Im sorry

Is this for javascript renaming? Im so stuck!