I need script that mass renames SRTs using AVI file basename
Posted: 31 Oct 2010 01:32
I have a directory D:\MY_VIDEOS
and I have a list of folders inside it:
STARGATE UNIVERSE - 2 x 05 - FQM
SUPERNATURAL - 6 x 05 - FQM
and so on
-----------------------------------------------------------------------------------------
Inside a folder looks like this:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
In case of SUPERNATURAL - 6 x 05 - FQM
1
Supernatural - 06x05 - Live Free or Twihard.FQM.Eng.srt
Supernatural s06e05 (hdtv-fqm) magyar.rar
Supernatural s06e05 (hdtv-fqm, 720p-ctu) angol.rar
supernatural.s06e05.hdtv.xvid-fqm.avi
where 1 is also a folder,
and .zip or.rar files always have the same ending:
magyar.zip or angol.zip OR magyar.rar or angol.rar OR mixed
All my folders have this same look or pattern.
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
shortly:
MY FOLDER BEFORE THE SCRIPT:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt <= 1. give it the basename of avi + .ENG2.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
2. unzip Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip <= 3. move this to folder 1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt <= 4. move this to folder 1 if this exists
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt <= 5. give it the basename of avi + .ENG.srt
6. unzip Stargate Universe s02e05 (hdtv-fqm) magyar.zip <= 7. move this to folder 1
stargate universe s02e05 hdtv-fqm.srt <= 8. give it the basename of avi + .srt
MY FOLDER AFTER THE SCRIPT:
Let my folder STARGATE UNIVERSE - 2 x 05 - FQM look like this
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
9. REPEAT THESE STEPS all the folders inside my directory D:\MY_VIDEOS
10. DONE
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
detailed and algoritmically thinking
(1.) Go to D:\MY_VIDEOS directory
(2.) Open the first folder -> STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
(4.) Find the .avi file -> stargate.universe.s02e05.hdtv.xvid-fqm.avi
(5.) Copy its basename without the .avi -> stargate.universe.s02e05.hdtv.xvid-fqm
(6.) Find the .srt file -> Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
(6.1.) first copy&paste it to folder 1, just a backup, after that
(6.2.) give the basename of the .avi file and a .ENG2 tag to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
So, now my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(7.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
(7.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip to the folder 1, just a backup.
(Sometimes there can be more than 1 or 2 .srt files inside the extracted .zip file.)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(8.) Find the .srt files inside the folder
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(9.1) If the ending of the .srt file is .ENG2.srt, then do nothing with it.
(9.2) If there is a 720p string in the name of the .srt file (not always exists this file), then move it to the folder 1, just a backup.
(9.3) Count how many .srt files left, if there is exactly 2,
then give the basename of the .avi file and a .ENG tag to the .srt file that has not been renamed yet -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
else if there are more .srt files left than 2, then create a folder 2 below folder 1 and copy all the .srt files inside it.
I will rename them manually.
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(10.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm) magyar.zip
(10.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm) magyar.zip to the folder 1, just a backup.
(there is only one .srt file inside the .zip file)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate universe s02e05 hdtv-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(11.) Find the .srt files inside the folder
If there is no .ENG tag in the name of the .srt file
then give the basename of the .avi file to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.srt
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(12.) Go to D:\MY_VIDEOS directory
(13.) Open the second folder -> SUPERNATURAL - 6 x 05 - FQM
and repeat the above steps to each folder which are inside the D:\MY_VIDEOS directory.
If these steps can be solved using XYplorer's scripts, that would be a great help for me.
thanks
---
and I have a list of folders inside it:
STARGATE UNIVERSE - 2 x 05 - FQM
SUPERNATURAL - 6 x 05 - FQM
and so on
-----------------------------------------------------------------------------------------
Inside a folder looks like this:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
In case of SUPERNATURAL - 6 x 05 - FQM
1
Supernatural - 06x05 - Live Free or Twihard.FQM.Eng.srt
Supernatural s06e05 (hdtv-fqm) magyar.rar
Supernatural s06e05 (hdtv-fqm, 720p-ctu) angol.rar
supernatural.s06e05.hdtv.xvid-fqm.avi
where 1 is also a folder,
and .zip or.rar files always have the same ending:
magyar.zip or angol.zip OR magyar.rar or angol.rar OR mixed
All my folders have this same look or pattern.
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
shortly:
MY FOLDER BEFORE THE SCRIPT:
In case of STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt <= 1. give it the basename of avi + .ENG2.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
2. unzip Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip <= 3. move this to folder 1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt <= 4. move this to folder 1 if this exists
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt <= 5. give it the basename of avi + .ENG.srt
6. unzip Stargate Universe s02e05 (hdtv-fqm) magyar.zip <= 7. move this to folder 1
stargate universe s02e05 hdtv-fqm.srt <= 8. give it the basename of avi + .srt
MY FOLDER AFTER THE SCRIPT:
Let my folder STARGATE UNIVERSE - 2 x 05 - FQM look like this
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
9. REPEAT THESE STEPS all the folders inside my directory D:\MY_VIDEOS
10. DONE
-----------------------------------------------------------------------------------------
What I would like to do automatically using XYplorer are the followings:
detailed and algoritmically thinking
(1.) Go to D:\MY_VIDEOS directory
(2.) Open the first folder -> STARGATE UNIVERSE - 2 x 05 - FQM
1
Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
(4.) Find the .avi file -> stargate.universe.s02e05.hdtv.xvid-fqm.avi
(5.) Copy its basename without the .avi -> stargate.universe.s02e05.hdtv.xvid-fqm
(6.) Find the .srt file -> Stargate Universe - 02x05 - Cloverdale.hdtv.xvid-fqm.Eng.srt
(6.1.) first copy&paste it to folder 1, just a backup, after that
(6.2.) give the basename of the .avi file and a .ENG2 tag to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
So, now my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(7.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip
(7.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm, 720p-ctu) angol.zip to the folder 1, just a backup.
(Sometimes there can be more than 1 or 2 .srt files inside the extracted .zip file.)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(8.) Find the .srt files inside the folder
Stargate Universe - 02x05 - Cloverdale.720p.CTU.English.C.orig.Addic7ed.com.srt
Stargate Universe - 02x05 - Cloverdale.FQM.English.C.orig.Addic7ed.com.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(9.1) If the ending of the .srt file is .ENG2.srt, then do nothing with it.
(9.2) If there is a 720p string in the name of the .srt file (not always exists this file), then move it to the folder 1, just a backup.
(9.3) Count how many .srt files left, if there is exactly 2,
then give the basename of the .avi file and a .ENG tag to the .srt file that has not been renamed yet -> stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
else if there are more .srt files left than 2, then create a folder 2 below folder 1 and copy all the .srt files inside it.
I will rename them manually.
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
Stargate Universe s02e05 (hdtv-fqm) magyar.zip
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(10.1) Extract/unzip/unrar using WinRAR Stargate Universe s02e05 (hdtv-fqm) magyar.zip
(10.2) and if it is done move Stargate Universe s02e05 (hdtv-fqm) magyar.zip to the folder 1, just a backup.
(there is only one .srt file inside the .zip file)
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate universe s02e05 hdtv-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
(11.) Find the .srt files inside the folder
If there is no .ENG tag in the name of the .srt file
then give the basename of the .avi file to the .srt file -> stargate.universe.s02e05.hdtv.xvid-fqm.srt
Now, my STARGATE UNIVERSE - 2 x 05 - FQM folder will look like this:
1
stargate.universe.s02e05.hdtv.xvid-fqm.avi
stargate.universe.s02e05.hdtv.xvid-fqm.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG.srt
stargate.universe.s02e05.hdtv.xvid-fqm.ENG2.srt
Next step:
(12.) Go to D:\MY_VIDEOS directory
(13.) Open the second folder -> SUPERNATURAL - 6 x 05 - FQM
and repeat the above steps to each folder which are inside the D:\MY_VIDEOS directory.
If these steps can be solved using XYplorer's scripts, that would be a great help for me.
thanks
---