You are not logged in.
Pages: 1
Hello,
I know that the title is not very descriptive so here's what I am asking. I have a lot of video files for several TV serials labelled as such: S01E02, S02E07 and so on. I have a text file which has the name of every episode such as:
S01E02 - The Man from The Blue
S02E07 - The Woman in Red
etc . . .
What I want is a way to append those names in the list to their corresponding video files. So if video name is S01E02 then it should look in the text file for the title of that video and append it to the video name.
Thanks
Offline
Sorry, I wrote a Pascal Script for my prior request. Here is it if anyone is interested :
1. First I had to adjust the file names so that they correspond to those in the txt files with RegEx. I am looking for a string like S02E04 or S1E4 or S003E004 etc within the file name.
Expression: .*(S[0-9]{1,3})E([0-9]{1,3}).*
Replace: S$1E$2
2. Now for the pascal script. My script might not be the most efficient in the world but it does the job. I learned PascalScript just a few minutes ago ! Note the text file I'm reading from is written like this:
S02E04 - Bla Bla Bla
S04E12 - Ha Ha Ha
var
i, txtLines: Integer;
oldName, segName: WideString;
begin
txtLines := FileCountLines('C:\Names.txt');
oldName := WideExtractBaseName(FileName);
Repeat
segName := Copy(FileReadLine('C:\Names.txt', I),0,6);
i := i+1;
Until (segName = OldName) OR (i = txtLines);
FileName := FileReadLine('C:\Names.txt', i-1) + WideExtractFileExt(FileName);
i := 0;
end.
Last edited by medwatt (2014-03-08 01:28)
Offline
Your PascalScript is of course more generic and thus more powerful, but if you had files like say:
S01E01.mkv
S01E02.mkv
S01E03.mkv
and Names.txt had:
Name of Episode #1 of Season #1
Name of Episode #2 of Season #1
Name of Episode #3 of Season #1
i.e. a 1:1 correspondence between files and names, you could simply use the UserInput rule to pull the names in from the text file and apply them like so:
Offline
I tried what you're saying. The method you mentioned has a limitation such that the files you want to rename have to be in the same order as the names in the text file. I actually just copied the list of episodes from the internet into a text file. I had some episodes missing meaning that not all of the videos will be in the correct order thereby renaming incorrectly.
Offline
I tried what you're saying. The method you mentioned has a limitation such that the files you want to rename have to be in the same order as the names in the text file.
Of course, that's why I specifically mentioned that you need to have "a 1:1 correspondence between files and names".
Offline
Pages: 1