Search and Replace, a chain of commands
Search and Replace, a chain of commands
Hello
I have lots of movies, all containing 1080p, Web-dl, YIFY, etc... I want to remove them right?
this is my command to remove some unwanted Infos:
WEB-DL|YIFY|1080p|web-dl|WEB-Dl|WEB DL|BluRay|10bit x265|WEBRip 6CH PSA|WEBRip|BrRip| | >>
It works but the left-offs are like this:
Movie___2022__.mp4
I added a |_| too
WEB-DL|YIFY|1080p|web-dl|WEB-Dl|WEB DL|BluRay|10bit x265|WEBRip 6CH PSA|WEBRip|BrRip|_| | >>
but as long as all replacements occur simultaneously, It looks like this:
Movie2022.mp4 instead of Movie 2022.mp4!
is there a way to chain these commands to be executed one after another?
Thaaaank you
I have lots of movies, all containing 1080p, Web-dl, YIFY, etc... I want to remove them right?
this is my command to remove some unwanted Infos:
WEB-DL|YIFY|1080p|web-dl|WEB-Dl|WEB DL|BluRay|10bit x265|WEBRip 6CH PSA|WEBRip|BrRip| | >>
It works but the left-offs are like this:
Movie___2022__.mp4
I added a |_| too
WEB-DL|YIFY|1080p|web-dl|WEB-Dl|WEB DL|BluRay|10bit x265|WEBRip 6CH PSA|WEBRip|BrRip|_| | >>
but as long as all replacements occur simultaneously, It looks like this:
Movie2022.mp4 instead of Movie 2022.mp4!
is there a way to chain these commands to be executed one after another?
Thaaaank you
Re: Search and Replace, a chain of commands
Only by scripting it
One of my scripts helped you out? Please donate via Paypal
Re: Search and Replace, a chain of commands
would you please let me know how?
Re: Search and Replace, a chain of commands
Post full original file names
One of my scripts helped you out? Please donate via Paypal
Re: Search and Replace, a chain of commands
Aww thank you:
Deadstream_2022_1080p_WEB-DL_YIFY_30NAMA.mp4
I want it to be like :
Deadstream 2022.mp4
Deadstream_2022_1080p_WEB-DL_YIFY_30NAMA.mp4
I want it to be like :
Deadstream 2022.mp4
Re: Search and Replace, a chain of commands
And ALL of them follow this format?
<name of move>_<year>_<unnecessary stuff>.<extension>?
What if a movie name contains spaces, or are there only underscores in them?
<name of move>_<year>_<unnecessary stuff>.<extension>?
What if a movie name contains spaces, or are there only underscores in them?
One of my scripts helped you out? Please donate via Paypal
Re: Search and Replace, a chain of commands
no not all of them,
I thought you might give me a template script with these words so I can give or take a few words to make it work for other movies.
my first post shows 80% of the info I don't want.
A Quiet Place Part II_2020_10bit__x265_BrRip_8CH_PSA.mkv
I thought you might give me a template script with these words so I can give or take a few words to make it work for other movies.
my first post shows 80% of the info I don't want.
A Quiet Place Part II_2020_10bit__x265_BrRip_8CH_PSA.mkv
Re: Search and Replace, a chain of commands
|t is perfect
Thank you
but with the script, the movie :
The_School_for_Good_and_Evil_2022_10bit_720p_x265_WEB-DL_6CH_PSA_30NAMA.mkv
becomes :
The.mkv
It think there's something wrong!
Thanks again
Thank you
but with the script, the movie :
The_School_for_Good_and_Evil_2022_10bit_720p_x265_WEB-DL_6CH_PSA_30NAMA.mkv
becomes :
The.mkv
It think there's something wrong!
Thanks again
Re: Search and Replace, a chain of commands
Code: Select all
// Do not add the space here!
$remove = <<<>>>
_
6ch
8ch
720p
1080p
10bit
30nama
bluray
brrip
psa
web dl
web-dl
webrip
x264
x265
yify
>>>;
$remove = replace(regexreplace($remove, "^[ \t]+"), <crlf>, "|");
$items = <get SelectedItemsNames>;
$pattern = "([ ]|" . replace($remove, " ", "(_| )+") . ")";
foreach($item, $items, <crlf>, "e") {
if (regexmatches($items, $pattern)) {
$ext = gpc($item, "ext");
$base = gpc($item, "base");
$base = regexreplace($base, $pattern, " ");
$base = trim(regexreplace($base, "[ ]{2,}", " "));
// This could catch multiple dates, we'll only use the last found
$date = gettoken(regexmatches($base, "\b\d{4}\b"), -1, "|");
$new = $base . "." . $ext;
if ($date) { $new = gettoken($base, 1, $date, "t") . " " . $date . "." . $ext; }
if ($new UnLikeI $item) { renameitem($new, $item); }
}
}
One of my scripts helped you out? Please donate via Paypal
Re: Search and Replace, a chain of commands
Coooooooool
doing exactly what I wanted.
Thank youuuuuu
doing exactly what I wanted.
Thank youuuuuu
Re: Search and Replace, a chain of commands
hello sir,highend wrote: ↑28 Oct 2022 00:01Code: Select all
// Do not add the space here! $remove = <<<>>> _ 6ch 8ch 720p 1080p 10bit 30nama bluray brrip psa web dl web-dl webrip x264 x265 yify >>>; $remove = replace(regexreplace($remove, "^[ \t]+"), <crlf>, "|"); $items = <get SelectedItemsNames>; $pattern = "([ ]|" . replace($remove, " ", "(_| )+") . ")"; foreach($item, $items, <crlf>, "e") { if (regexmatches($items, $pattern)) { $ext = gpc($item, "ext"); $base = gpc($item, "base"); $base = regexreplace($base, $pattern, " "); $base = trim(regexreplace($base, "[ ]{2,}", " ")); // This could catch multiple dates, we'll only use the last found $date = gettoken(regexmatches($base, "\b\d{4}\b"), -1, "|"); $new = $base . "." . $ext; if ($date) { $new = gettoken($base, 1, $date, "t") . " " . $date . "." . $ext; } if ($new UnLikeI $item) { renameitem($new, $item); } } }
i want to remove (2022) , (202x+192kbps), any thing between (), ...,any thing between [],Tam, Mal,Kan,Hin etc with above code. can you plsease add these in your code?
Re: Search and Replace, a chain of commands
I love this script.
I use it every day without a problem.
I just wanted to change the code a bit to serve to rename versioning movies like:
Ginger_Snaps_2_Unleashed_2004_1080p_BrRip_YIFY.mp4
I think "_2" after Ginger_Snaps makes the script malfunction!
and the error is :
The new name "Ginger Snaps 2 Unleaseashed 2004.mp4 2|2004.mp4" contains invalid characters.
and of course, I don't know how to fix it in the code.
I use it every day without a problem.
I just wanted to change the code a bit to serve to rename versioning movies like:
Ginger_Snaps_2_Unleashed_2004_1080p_BrRip_YIFY.mp4
I think "_2" after Ginger_Snaps makes the script malfunction!
and the error is :
The new name "Ginger Snaps 2 Unleaseashed 2004.mp4 2|2004.mp4" contains invalid characters.
and of course, I don't know how to fix it in the code.
Re: Search and Replace, a chain of commands
I don't get an error message with that file name and the original script?
One of my scripts helped you out? Please donate via Paypal