Code with special "Attributes"

Any questions? Need some help?
Post Reply
r0r5ch4ch
Posts: 5
Joined: 04 Feb 2014, 21:55

Code with special "Attributes"

Post by r0r5ch4ch »

Hi,

first of all: This program is awesome! It saves my day! Thank you so much

I have a lot of questions, but I start with the most important first:

Here is my code:

Code: Select all

{file.path[0]}:/C-M/00-(RealHD)/{n.replaceAll(/:/, " -").replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")} [{imdbid}] [{y}] ({vf}) ([RealHD])/{n.replaceAll(/:/, " -").replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")} [{imdbid}] [{y}] ({ac}) ({vf}) ([RealHD]) (Eng) (Ger)
Is it possible that the code can recognize that a special attribute is in the file or the folder? I mean I tag my movies manually most times with (Extended), (Uncut), (Recut)... etc... Can the code add automatically those attributes?

If the code recognizes: Ah, in this file it says "EC", then I will add afterwards "(Extended)", oh there is "Recut" too, then I will add "(Recut)" afterwards... Is this possible?

I am looking forward hearing from you, thanks in advance!

Greetings
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: Code with special "Attributes"

Post by Ithiel »

Hi r0r5ch4ch,

A great place to start tracking down answers would be these two threads:

Example Renaming Schemes
[HOW TO] Everything: Scripts, Guides & Code Collection!

The functions that you're looking for to find certain characters in the existing file name are fn.contains and fn.matchAll, which you can see an example of in the last post of the first link (http://www.filebot.net/forums/viewtopic ... &t=2#p7320).

In that example, I use the following:

Code: Select all

{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'}
This runs two checks - the first is to find if it as '3D' or '3-D' (and then adds '3D' to the name), while the second looks for any instances of extended, uncensored, remastered, unrated, uncut, directors cut, or special edition and keeps it.

Note: the . in directors.cut means 'wildcard', so it will detect directors.cut, directors-cut, directors cut, or whatever other single character seperates them.

Let us know how you go :-)
There can be only one Power² User
r0r5ch4ch
Posts: 5
Joined: 04 Feb 2014, 21:55

Re: Code with special "Attributes"

Post by r0r5ch4ch »

Hi lthiel!

wow, thank you for your quick answer!

You will not believe it: But I checked the first two threads :). It took me days to find out how my first code works... The problem is, I only understand very little of this codes, how they are working etc. And that should mean something, I learned chinese for a few month and did pretty well, hehe :).

The last function thread is great! The others are great too, but I always don't know how to link them.

In my code now for example, if I have a movie like this:

God, give me wisdom and skills (Extended) (Uncut) (Recut) (Special Edition) (RH)

Later it should look like this:

God, give me widom and skills [tt0328103] [2055] (1080p) (RealHD)\God, give me wisdom and skills [tt0328103] [2055] (DTS) (1080p) (Extended) ([Uncut, Recut, Special Edition, RealHD]) (Eng) (Ger)

Following words should be seperated and each be put in single bracelets:

Extended, Director's Cut, Unrated, 3D (=it should be put in this format too: Ext = (Extended), DC = (Director's Cut)...)

Any other defined thing like (RH), Special Edition, Recut etc. should be put in this form together: ([Uncut, Recut, ...])

I have absoluteley no idea where to start :(.

My try would be something like this:

{file.path[0]}:/C-M/00-({fn.contains('RH') || fn.contains('(RealHD)') ? ' '+'([RealHD])':""}{fn.contains('Eng') ? ' '+'([Eng])':""}{fn.contains('Ger') ? ' '+'([Ger])':""})/{n.replaceAll(/:/, " -").replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")} [{imdbid}] [{y}] ({vf}) ([RealHD])/{n.replaceAll(/:/, " -").replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")} [{imdbid}] [{y}] ({ac}) ({vf}) ([RealHD]) (Eng) (Ger) {fn.contains('EC') || fn.contains('Extended') || fn.contains('SEE') ? ' '+'(Extended)':""} {fn.contains('RH') || fn.contains('(RH)') || fn.contains('(RealHD)') ? ' '+'([RealHD])':""} {fn.contains('EC') || fn.contains('Extended') || fn.contains('SEE') ? ' '+'(Extended)':""} {fn.contains('RH') || fn.contains('(RH)') || fn.contains('(RealHD)') ? ' '+'([RealHD])':""}


The /C-M/00-(.....)/

should sort the movies in it's three possiblilities:

(RH) or (RealHD) should go to for example: Y:/C-M/00-([Real])/

(Eng) or eng should go to for example: Y:/C-M/00-([Eng])/

(Ger) or ger should go to for example: Y:/C-M/00-([Ger])/


but as you maybe think or already know: It isn't working :(...

I have a example movie like this:

Scent of a woman (1992) (RH) (EC)\Scent.of.a.Woman.1992.720p.BluRay.x264.YIFY.mp4

Shouldn't the could recognizes, that (RH) is written in the folder name and do it? What am I doing wrong?

Thank you very much in advance :)
User avatar
Ithiel
Power² User
Posts: 204
Joined: 11 Jul 2013, 14:58

Re: Code with special "Attributes"

Post by Ithiel »

Blimey, and I thought my naming scheme was complicated, lol.

Depending on the path that you're storing the files, you may end up running into character limits on the path.

Also, scanning for RH and EC are likley to run into a number of false positives. For a wacky example, "See the Engrained Germs of a Rhino Economy" (not that there is any movie by that name) would most likely trigger ENG, GER, RealHD and Extended Edition, lol.

While it's probably going to be a pain, I think you'd have a lot less problems if you ran a search in explorer for '(ec)' and '(rh)' and manually swapped out that part of the name for Extended and RealHD respectively (keep the replacement word in your copy buffer, run through the search results in list view.. shouldn't take more than a minute or two). This will then allow you to simplify your filter and reduce the number of false positives. Stopping a problem from happening takes a lot less time than fixing it once it has :-)

Additionally, I'd probably look at combining (Extended) into the bracket set for (Uncut, Recut.. etc) and (Eng) and (Ger) into (Eng, Ger). Also, if you're using something like Plex or XBMC to manage the media, I would advise against having the resolution or RealHD in the folder name - occasionally you'll end up with 2 resolutions of the same movie (or a 3D version and a normal). Having the folder name not specific to the encode would allow both of them to share the same folder, and the media manager to present it as having multiple resolution options... and it saves a few characters :-)

Hitting character limits mid way through a rename really throws a spanner in the works (especially if you're forced to then break pattern for that one, which if you're as particular as your naming scheme would suggest - the inconsistency that would bring about would annoy you to to end haha).

On a side note, fn.contains means "file name contains". I believe that for file path, you use "file." instead of "fn." but I'm not 100% sure if it will work the way you're hoping (have a look here http://www.filebot.net/naming.html under Binding References for more).

To help me get my head around what you're aiming for, can you please give me a 'before and after' (including full ideal path, folder and file name) of what you're aiming for?
There can be only one Power² User
r0r5ch4ch
Posts: 5
Joined: 04 Feb 2014, 21:55

Re: Code with special "Attributes"

Post by r0r5ch4ch »

Hi and thanks again for your quick answer :).

At the moment I am tagging my movies manually before filebot like this:

English title (year) + Attributes (possible attributes: (RH) means RealHD, FIle Size bigger than..., (Extended), (Uncut), (Unrated), (Director's Cut)

Your oppinions are really correct. I am developing my naming-tagging system now about over 2 or 3 month :). The problem is, I am using not XMBC or Plex, I am using Media Portal, which is in my opinion the better program for home entertainment (without PocketPCs or other stuff like Pi).

I have a NAS and travelling a lot, which means I need two versions of each film. One with a little file-size (portable less then 1000 gb) and one big filesize for the homecinema. For that I am tagging the big ones with (RH) which becomes after Filebot (RealHD). And the other small sizes just will include the language.

So, I want two different Movies. There are movies out there which are in 1080p, but are not really HD (bad sound etc.). So I want to differ between those two formats. You see, I made some thinking befor :), and so that I will not forget this whole complicated tagging standard, I wrote a "Standard Codex" for me... It's crazy, but hopefully in the future I will have a standard, which makes it possible to switch systems if necessary (XBMC etc.).

Despite your oppionion, I have never problems with the 260 Chars, even with Anime-Series like Naruto with double episodes.

The situation is following:

Downloading/Ripping movie and putting the FOLDER in following structure:
  • First Step: English title (year) + Attributes (possible attributes: (RH) means RealHD, FIle Size bigger than..., (Extended), (Uncut), (Unrated), (Director's Cut)

    Example:: I am a tomato (Eng) (Extended)
    Example2:: I am a tomato II (RH) (Uncut)
    Example3:: I am a tomato III (Ger) (Director's Cut)

    Second Step: Importing all same folders (all "(Eng)" for example) into filebot and choosing the right script:

    {file.path[0]}:/C-M/00-Eng/{n.replaceAll(/:/, " -").replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")} [{imdbid}] [{y}] ({vf}) (Eng)/{n.replaceAll(/:/, " -").replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, "'")} [{imdbid}] [{y}] ({ac}) ({vf}) (Eng)

    Example:: y:/C-M/00-Eng/I am a tomato [tt281282] [2099] (720p) (Eng)/I am a tomato [tt281282] [2099] (DTS) (720p) (Eng).mkv
    Example2:: y:/C-M/00-RealHD/I am a tomato [tt281282] [2099] (720p) (RealHD)/I am a tomato [tt281282] [2099] (DTS) (1080p) (RealHD).mkv
    Example3:: y:/C-M/00-Ger/I am a tomato [tt281282] [2099] (720p) (Ger)/I am a tomato [tt281282] [2099] (DTS) (720p) (Ger).mkv

    Third Step: Manually adding the special Attributes to the folder and the file and the subtitles if existing:

    Example:: y:/C-M/00-Eng/I am a tomato [tt281282] [2099] (Extended) (720p) (Eng)/I am a tomato [tt281282] [2099] (Extended) (DTS) (720p) (Eng).mkv
    Example2:: y:/C-M/00-RealHD/I am a tomato [tt281282] [2099] ([Uncut, Extended, RealHD]) (720p)/I am a tomato [tt281282] [2099] ([Uncut, Extended, RealHD]) (DTS) (1080p).mkv
You are right, Things like "RH", "EC" are really a problem. But this above is crying for an automisation :). There are really to many ways to do failures...

The problem is "MP Moving Pictures", the import addon of Media Portal is automatically adding special Attributes, but only following:

- (3D), (Extended), (Unrated), (Director's Cut).

If those MM will detect in the file, it is automatically adding "(Extended)" + "(Director's Cut)" etc. to the movie name in the database.

But all other special Attributes "(RealHD)", "(Uncut)" etc. must be in this form to be added: "([.....])". If now MM detects in the filename for example "([Uncut, RealHD])" it will add automatically "[Uncut, RealHD]" to the filename in the database.

So what I want is:

1.) I always tag my folder for downloading or ripping good, which means always this structure: english title (year) +Special Attributes such as (RH) for RealHD, (Extended), (Uncut) etc. But I can change the structure, I could make the Special Attributes look like from the start ([Extended, Uncut, RealHD]), would be possible too

2.) I want the code this way, that I only have to use one code. Which means, code is checking the folder and then 3 possible ways:
  • 2.1) (Eng) is written in folder: Use filepath/CM/00-Eng/ and add "(Eng)" to folder and file
    2.2) (Ger) is written in folder: use filepath/CM/00-Ger/ and add "(Ger)" to folder and file
    2.3) (RH) or (RealHD) or ([Uncut, RealHD]) is written in folder: Use filepath /CM/00-RH/ and add at least ([RealHD]) or + other special attributes such as ([Extended, Uncut, RealHD]) to folder and file
That would make things a lot easier for me, because I can't easily overlook special features and do not have to use 3 codes if necessary...


Hope, I could make the problem a little more clear :).

Is this possible to do?

Greetings
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Code with special "Attributes"

Post by rednoah »

I guess Ithiel is already doing a good job helping out with this one, but the logic you describe seems a bit complicated, so the format will be a bit complicated. Maybe good to have a another look at the other example formats/bindings and a bit of Groovy coding in general.

Though why not keep it simple? This sorta reminds me of the 畫蛇添足 story. :P
:idea: Please read the FAQ and How to Request Help.
r0r5ch4ch
Posts: 5
Joined: 04 Feb 2014, 21:55

Re: Code with special "Attributes"

Post by r0r5ch4ch »

Hi rednoah,

I didn't thought it would be that hard, I just thought it is hard for me :). It sound complicated, but it is just a little "if" - "then"-problem: If (RH), use Code for (RealHD), if not check for (Eng), use (Eng)-Code, if not use (GerCode), if anything else use (Other)-Code...

The system so far works really good for me. I can use it for XBMC and for MediaPortal...

So if it isn't working out with a code, because it is to complex, I really don't want you guys to do hard work for me :), then I will just do it manually, did it a hundred times before and will make it another hundred times again :).

Thanks anyway :)

By the way, another question: How is it possible to delete the "last used codes" in Movies or TVSeries section? Or do I have to reinstall it everytime?

Thank you so much, and sorry for the trouble guys :)
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Code with special "Attributes"

Post by rednoah »

Yep, it's really easy:
http://groovy.codehaus.org/Logical+Branching

But i still have to codify all your conditions. The example already contains many many expressions with if-then-else code.


You mean you wanna delete the "recently used expressions" history? It's limited to 7 so you just add new ones and the old ones will be deleted.
:idea: Please read the FAQ and How to Request Help.
r0r5ch4ch
Posts: 5
Joined: 04 Feb 2014, 21:55

Re: Code with special "Attributes"

Post by r0r5ch4ch »

Thanks rednoah :),

ok, I just added new ones :).

Cool, In study I did a little of java, this looks exactly like the "if"-"then" I had used there! I also remembered all the error I got using it, hehe, so I understand what you mean by "all conditions" :).

Maybe it will be an interesting thing for an later update: To give the user the opportunity to switch with special expressions through the different codes :).


Thank you both again for all your time and your effort and this great program!


Really great support, hope you guys rock on :)!

Best wishes!
Post Reply