Common tasks to be performed, by user without Java knowledge

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

Common tasks to be performed, by user without Java knowledge

Postby Sparky21 » Fri May 26, 2017 11:55 pm

Hi Folks, I use BRU a lot as files arrive on the hard drive. The renaming process I have to put them through each time is basically the same, depending of course on the names used in the original file.

But it always goes, remove "." [periods] and replace with [space]. Then look for any of the following and more to delete the terms from the file names:

Starting files names with: [with the space at the end of the phrase]
National Geographic, CH4, ch5, sbs, bbc, itv, nhk, etc

Then with [space] at the front;
av3-evo, 1080p, 720p, dvdrip, brrip, xvid, web-dl, x264, xvid-afg, ac3-manning, ac3, etc

So I do these manually now each time with batches of files.

It is no biggy as I love the product anyway and have been doing it manually each time for months. But does anyone have an easy scripted way of doing this type of "common" renaming for each batch of files? (I do have have standard removal patterns also. Not all the "normal" ones are captured above)

Thanks in advance for the reply, to a user without any Java knowledge at all.
Sparky21
 
Posts: 8
Joined: Fri May 26, 2017 11:24 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby KenP » Sat May 27, 2017 12:23 am

It sounds like you may be able to do this with Regex, perhaps if you posted a few existing file names and how you want them to be after renaming it would help.
KenP
 
Posts: 199
Joined: Sat Jul 30, 2016 11:25 am

Re: Common tasks to be preformed, by user without Java knowledge

Postby therube » Sat May 27, 2017 12:28 am

(As a start, JavaScript is not Java.
BRU does not use Java at all.
JavaScript is only available in the licensed version.)

Otherwise, check Help for - Saving Your Settings & Using Favorites.
(I'm not well versed in that.)

Also some actual examples of your renames (in addition to your descriptions) would probably help.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby Sparky21 » Sat May 27, 2017 3:12 am

BBC.Mexico.Earths.Festival.of.Life.3of3.Burning.North.720p.HDTV.x264.AAC.MVGroup.org.mkv

Will end up being: Mexico Earths Festival of Life 3of3 Burning North.mkv

Child-of-Satan-720p-bluray-x264-rovers[etHD].mkv

Will become Child of Satan.mkv

Also thanks, folks on the Java / Javascript thing. Just me not being accurate enough with the language.
Sparky21
 
Posts: 8
Joined: Fri May 26, 2017 11:24 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby Admin » Sat May 27, 2017 4:36 am

Need to find if there is an algorithm here that you can convert into a script.
To start, is this a correct criteria:
drop everything in the file name after .720p .1080p , what resolutions are possible here?
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby Sparky21 » Sat May 27, 2017 4:39 am

Don't go to too much bother. The file names are not consistent. But the main resolutions I take are 720p and 1080p. Those that are naming the files are anyone and everyone.

gary
Sparky21
 
Posts: 8
Joined: Fri May 26, 2017 11:24 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby Sparky21 » Sat May 27, 2017 4:40 am

But yes your correct criteria stands the test of time. But some of them don't state the res in the file naming convention used
Sparky21
 
Posts: 8
Joined: Fri May 26, 2017 11:24 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby Admin » Sat May 27, 2017 4:59 am

So if the renaming criteria do change all the times, it is still be possible to come up with a Javascript script that addresses all situations, however this might require a little bit of work to account for all different and possible situations.
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby Sparky21 » Sat May 27, 2017 6:10 am

Yeah don't worry it all gets a bit hard for little return. Wouldn't want to waste others time on this anymore.

It is a manual process I have been doing for maybe 4 years with BRU and looks like I'll be doing in the future also :-) All Good

Gary
Sparky21
 
Posts: 8
Joined: Fri May 26, 2017 11:24 pm

Re: Common tasks to be preformed, by user without Java knowledge

Postby spamspambaconspam » Sat Sep 18, 2021 10:16 pm

Old thread, but posting a possible "shortcut", for future readers.

I have needed to do this, also.

What I did was to add CHARACTER TRANSLATIONS [Special, 14] that "removed" acronyms or abbreviations that commonly occurred, but weren't wanted.

So, using the OP's examples:

BBC.Mexico.Earths.Festival.of.Life.3of3.Burning.North.720p.HDTV.x264.AAC.MVGroup.org.mkv
Child-of-Satan-720p-bluray-x264-rovers[etHD].mkv

I would add the following CHARACTER TRANSLATIONS [Special, 14] to a favorite settings file:

BBC.Mexico.Earths.Festival.of.Life.3of3.Burning.North.720p.HDTV.x264.AAC.MVGroup.org.mkv
B,B,C,.=.
.,7,2,0,p=.
.,H,D,T,V=.
.,x,2,6,4,.=.
.,A,A,C,.=.
.,M,V,G,r,o,u,p,.,o,r,g,.=.

Child-of-Satan-720p-bluray-x264-rovers[etHD].mkv

-,7,2,0,p,-=-
-,b,l,u,r,a,y,-=-
-,x,2,6,4,-=-
-,r,o,v,e,r,s,=-
[,e,t,H,D,]=

Things I know about the OP's files:
  • most filenames use the same exact abbreviations... so "720p" will almost invariably have the "p" at the end, "x264" would never be just "264", etc.
  • Abbreviations/acronyms will (almost) always be the same, case-wise... so "AAC" would almost never be "Aac".
  • When a "name" like "MVGroup.org" appears, it will always look that same exact way... capitalization and the "dot org".

Some notes about what I did and why:

For the first example, I included the leading and trailing periods/dots for each string, then added ONE of those back, as the replacement.
This makes sure the string isn't found inside a larger word (it must start and end with a "."') and it also ensures that the dot that separates the file extension from the filename is never removed.

For the second example, I did the same thing with the dashes, but here, my reason was more obscure:
(note: this reason also holds for the first example, but it's not as easily noticed because of the period separating the file extension)

I added one dash back in, to keep the delineation between segments.
This is so that the filename will retain the separators between segments, for those segments that remain. This allows the filename to be processed again, using more specific constraints.

Lastly, it took me a loooong time to learn how to use CHARACTER TRANSLATIONS [Special, 14]... so to help others avoid some of my blunders, do this:

Add your character translations to a setup, then save it as a favorite. Name it something like "Char Translations" or similar.
Use that favorite as your "main list"... any new translations should get added here and any corrections be made here, as well.
When you need to use them, just open the favorite, copy the list, and paste it into a NEW setup.
If, after playing around, you've found you've edited the CHARACTER TRANSLATIONS that you'd pasted in, then COPY those and paste them back into the favorite (your main list). Otherwise, whatever edits you made will be lost the next time you use them.

(There are other ways to "keep a master list of char translations", but at least knowing one way will help you save work, that you've sometimes spent hours working on.)

HTH...

~spammy
spamspambaconspam
 
Posts: 6
Joined: Mon Nov 03, 2014 12:47 am


Return to Javascript Renaming


cron