Help Requested with Advanced Episode Renaming Scheme

Any questions? Need some help?
Post Reply
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

I am a noob attempting to change the show title from something that begins with the words "A" or "the" are moved to the end of the title
like G:\My Videos\TV Shows OLD\The New Batman Adventures [1997]\Season 1\The New Batman Adventures - 1x01 - Holiday Knights.avi
to G:\My Videos\TV Shows OLD\New Batman Adventures The, [1997]\Season 1\New Batman Adventures, The - 1x01 - Holiday Knights.avi

My current episode format places items into a specific folder, names title with the year show started, works with placing special episodes into a specials folder and names them accordingly and looks like this

Code: Select all

G:/My Videos/TV Shows/{n} [{startdate.format("yyyy")}]/{episode.special ? 'Special' : 'Season '+ s}/{n} - {episode.special ? '0xSpecial '+special.pad(2) : sxe} - {t}
I would appreciate any help with getting the words "the" and "a" to be moved to the back of the shows title. :geek:
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

Try something like

Code: Select all

{n =~ /^The/ ? n[4..-1]+', The' : n}
Just of the top of my head. Might have syntax bugs.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

Here's our winner:

Code: Select all

{n =~ /^The / ? n[4..-1]+', The' : n =~ /^A / ? n[2..-1]+', A' : n}
:idea: Please read the FAQ and How to Request Help.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

Wow it works hooray!!! Thanks so much I was playing with the first post when I checked back again. Now I'll try to play around with that and get the lowercase "a" and "the" than I want to tackle colons that pop up and see if I can replace them with a dash.

Current code

Code: Select all

g:/My Videos/TV Shows/{n =~ /^The / ? n[4..-1]+', The' : n =~ /^A / ? n[2..-1]+', A' : n} [{startdate.format("yyyy")}]/{episode.special ? 'Specials' : 'Season '+ s}/{n =~ /^The / ? n[4..-1]+', The' : n =~ /^A / ? n[2..-1]+', A' : n} - {episode.special ? '0xSpecial '+special.pad(2) : sxe} - {t}
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

Since I'm at it anyway:

Code: Select all

{(n =~ /^[Tt]he / ? n[4..-1]+', The' : n =~ /^[Aa] / ? n[2..-1]+', A' : n).replace(':',' -')}
:idea: Please read the FAQ and How to Request Help.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

Wow this stuff works like a charm now. You sir have made my life much easier I have 100's of tv shows to go through and this made it much much easier +20 on google in good reviews to you and this software.
I am finding more things to do though, lol... Is there any way of removing empty folders this may be more of a command line area? I do however love being able to see what I am doing via drag and drop method. And once again thank you so mush for your hard work...

current code

Code: Select all

g:/My Videos/TV Shows/{(n =~ /^[Tt]he / ? n[4..-1]+', The' : n =~ /^[Aa] / ? n[2..-1]+', A' : n).replace(':',' -')} [{startdate.format("yyyy")}]/{episode.special ? 'Specials' : 'Season '+ s}/{(n =~ /^[Tt]he / ? n[4..-1]+', The' : n =~ /^[Aa] / ? n[2..-1]+', A' : n).replace(':',' -')} - {episode.special ? '0xSpecial '+special.pad(2) : sxe} - {t}
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

There is a shared script called cleaner.groovy that'll delete empty folder or folder where there is only image/nfo/etc files.
:idea: Please read the FAQ and How to Request Help.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

I am now running into a completely separate issue I'm noticing that seasons are not popping up sometimes. I've tried narrowing down the issue and all I can find is for example TV show "Young Justice" is missing season information for renaming up to episode 19 (using the {s} binding). I'm getting the info from thetvdb.com I checked the websitehttp://thetvdb.com/?tab=season&seriesid ... 9461&lid=7 to see if there was anything missing or different and all I could find was "IMDB.com ID:" and "Absolute Number:" were filled in for all the episodes missing season the number. The odd thing is that the Episodes feature of FileBot gets it exactly right leaving me a bit confused :?:

The other issue I have been having is finding the binding for the episodes that have multiple parts and making it work ex. Young Justice episodes 1 and 2 are part 1 and part 2 (1) (2).

Additional help on this will be once again greatly appreciated thanks...
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

If it works in Episodes panel then the data should be ok. Might be a problem with your format though I tried your format and it works for me, e.g. g:/My Videos/TV Shows/Young Justice [2010]/Season 2/Young Justice - 2x02 - Earthlings, 1x01-2x02 are formatted correctly.

Do you mean multiple episodes in one file? e.g. 1x01-02
Use {s00e00} {sxe} {t} bindings take care of that automatically. Otherwise u can use {episodes} to access all data and format it yourself.

Or is it about formatting the part identifier? e.g. Independence Day (1)?
{episode.title.replacePart(', Part $1')}

{t} used to remove the (1) automatically, but that doesn't make sense for single episode files, so I'll change that for next release.
:idea: Please read the FAQ and How to Request Help.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

Even though I'm a noob and not a programmer or know how to program I can still typically figure out problems like one. Since the Formula worked for you I checked to see if it worked for me. I was pretty sure it was not the formula I'm using since I also tried the formula on the other machine and it worked there too. I than believed it to be a setting/software that got screwed up somewhere so I uninstalled FileBot deleted all the settings I could find in /AppData/ that had any relation to FileBot than reinstalled. That didn't work so I uninstalled Java 32 and 64 and deleted all settings again and reinstalled 32 bit java and FileBot. It still did not work and I noticed that the format setting still had my formula. So there seemed to be a hidden setting somewhere that once is broken messes up everything else. I realized that it wasn't on my hard drive anywhere as a normal file so I took a look in the registry and I found my formula sitting there and other settings and history from 2011 under HKEY_CURRENT_USER\Software\JavaSoft
Here is my code and what is looks like from the registry.
My Code

Code: Select all

{file.path[0]}:/My Videos/TV Shows/{(n =~ /^[Tt]he / ? n[4..-1]+', The' : n =~ /^[Aa] / ? n[2..-1]+', A' : n).replace(':',' -').replaceTrailingBrackets()} [{startdate.format("yyyy")}]/{episode.special ? 'Season '+0 : 'Season '+s}/{(n =~ /^[Tt]he / ? n[4..-1]+', The' : n =~ /^[Aa] / ? n[2..-1]+', A' : n).replace(':',' -')} - {episode.special ? '0xSpecial '+special.pad(2) : s+'x'+e.pad(2)} - {episode.title.replacePart(', Part $1').replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'") .lowerTrail()} {".CD$pi"}{if (ext == 'nfo' && folder.list().find{it =~ /(?i:CD\d+)/}) ".CD1"}
Registry Code

Code: Select all

{file.path[0]}:\/My /Videos\/T/V /Shows\{(n =~ \^[/Tt]he \ ? n[4..-1]+', /The' : n =~ \^[/Aa] \ ? n[2..-1]+', /A' : n).replace(':',' -').replace/Trailing/Brackets()} [{startdate.format("yyyy")}]\{episode.special ? '/Season '+0 : '/Season '+s}\{(n =~ \^[/Tt]he \ ? n[4..-1]+', /The' : n =~ \^[/Aa] \ ? n[2..-1]+', /A' : n).replace(':',' -')} - {episode.special ? '0x/Special '+special.pad(2) : s+'x'+e.pad(2)} - {episode.title.replace/Part(', /Part $1').replace/All(\[!?.]+$\).replace/All(\[`/u00b4/u2018/u2019/u02bb]\, "'") .lower/Trail()} {"./C/D$pi"}{if (ext == 'nfo' && folder.list().find{it =~ \(?i:/C/D//d+)\}) "./C/D1"}
After deleting those registry settings and reopening FileBot, the Format field was blank and I was once again able to get season information for all episodes. I did confirm one thing though the absolute episode number and/or IMDB number was in conjunction with a bad registry setting somewhere was messing up the season number.
It seems to me that having that information in the registry causes elements to become a bit volatile and bits of format code got messed up in the registry a bit like an SQL injection.

I did save the all the deleted registry settings if you want to look over them to see what is was that broke. Just let me know if you want to see them.
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

You can run filebot -clear to reset everything as well.

If the registry setting was corrupt then the format just won't load. Cant affect the data bindings like {s}. In anycase if you continue to encounter problems let me know. If resetting things solves the problem then I'll leave it at that.
:idea: Please read the FAQ and How to Request Help.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

Is there any way to get a script such as "cleaner.groovy" to be able to be run from the movie/episode format area so that for each file renamed it runs the script with the argument coming from the original folder location?

My objective is to have all folders that are either empty or full of junk files like dat nfo txt jpg to be deleted directly after I rename all of the files in a folder that I have dropped into filebot without any additional work like finding and running the script for the desired folder only.
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

Not really, I don't like the idea that it'll silently delete files in the background. Just use Windows Task Scheduler or something to make the cleanup script run every once in a while on your downloads folder.
:idea: Please read the FAQ and How to Request Help.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

What is the best way to preserve odd double extinctions. I use a tivo to stream my media to and media requirements are a bit odd for pictures and info.
I have art and info in "file name.ext.jpg" and "file name.ext.txt", but want to keep part of the original name and extension in the files names.
Example
Original Filename.avi -> New Filename.avi
Original Filename.avi.txt ->New Filename.avi.txt
Original Filename.avi.jpg ->New Filename.avi.jpg
I do have quite a few different extensions such as .mov .xvid etc... hence use of ext
Original Filename.ext ->New Filename.ext
Original Filename.ext.txt ->New Filename.ext.txt
Original Filename.ext.jpg ->New Filename.ext.jpg

Any help on this would be greatly appreciated.
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

You can use String.match(regex) for that.

e.g.

Code: Select all

{fn.match(/[.]\w{3}$/)}
@see
http://filebot.sourceforge.net/naming.html#functions
:idea: Please read the FAQ and How to Request Help.
larsser15
Posts: 6
Joined: 09 Feb 2012, 05:05

Re: Help Requested with Advanced Episode Renaming Scheme

Post by larsser15 »

This is awesome, thank you.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

I've recently updated to a flavor of Ubuntu (mint 14) installed the latest filebot and ran into some trouble with my odd requirement for .txt files where I need to rename them "file name.ext.txt" at current this is my naming scheme.

Code: Select all

/media/Movies/My Videos/Movies/{(n =~ /^[Tt]he / ? n[4..-1]+', The' : n =~ /^[Aa] / ? n[2..-1]+', A' : n).replace(':',' -').replaceTrailingBrackets()} [{y}]/{n.replace('-',' -').replace('  -',' -').replace(':',' -').replaceTrailingBrackets()}{", Part $pi"}{t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'") .lowerTrail().replacePart(', Part $1')} [{y}]{fn.match(/[.]\w{03}$/)}
I also tried using this on my windows machine same problem. this used to work on previuse versons but they seem to be broken in getting data from older api or something. I also called txt a video type in the media.types to try and fix this problem, it just breaks the .jar file not alowing me to import any files at all. Any Ideas?
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

So you want filebot to treat .txt files as if they were .avi files instead of ignore them? That's all in media.types so just edit that and make sure you don't break the xml syntax.

Or you mean add .txt extension to all video files even when you're renaming .avi .mkv etc files? That one is only possible in the GUI via setting Extension::Override.
:idea: Please read the FAQ and How to Request Help.
thomaseo1
Posts: 9
Joined: 09 Apr 2012, 08:08

Re: Help Requested with Advanced Episode Renaming Scheme

Post by thomaseo1 »

Wow thanks for the fast response. I tried doing it again making sure I moved media.types as file back into jar file under /net/sourceforge/filebot/ again and it seemed to work this time. I must have moved it back improperly or something last time. :oops:
moved <extension>txt</extension> (not copy)

Code: Select all

<type name="video/txt">
		<extension>txt</extension>
	</type>
By the way I forgot to ask, this used to work before without changing media.types before did something change? Also is there any way to do this same action without replying media.types file change to any past, current or future release like through the Renaming Scheme itself of another similar system?
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help Requested with Advanced Episode Renaming Scheme

Post by rednoah »

If you have an name.avi video file and name.* in the same folder these name.* will be considered dependent child files and automatically be matched to the object that the parent files gets matched to.

If you only have a 1 text file => Doesn't work. If you have 1 episode file, 1 xml file, 1 txt file etc all with the same name the xml/txt files will be recognized based on the episode file as long as the filenames match.
:idea: Please read the FAQ and How to Request Help.
Post Reply