Page 1 of 1

Titles To Long

Posted: 28 Mar 2015, 17:13
by Urlryn
I Keep running into the file naming size limit. And since the below formatting doesn't really use {t} anyplace....I haven't figured out how to take advantage of {t.take(100)} to limit them.

Is there a option to limit size length in {n} and {primaryTitle}? I did try (n.take(100)) and (primaryTitle.take(100)) but didn't seem to do anything. But i couldn't find anything saying that was even possible to do like that.

Example: Seikon No Qwaser specials

J:/Anime/Seikon No Qwaser (Qwaser of Stigmata, The)/Qwaser of Stigmata, The - Special xx - Picture Drama: Doki! Seikon no Qwaser Secret Episode 1 - Tomo Edition [720p x264 AAC 2ch]

Anime Format:

Code: Select all

{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´‘’?""“”]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() }).replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}; norm(primaryTitle)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(n)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y}{' '+any{certification}{imdb.certification}.replaceAll(/^\d+$/, 'PG-$0')})/{norm(n)} - {absolute.pad(episodelist.size() < 99 ? 2 : 3)}{'Special '+special.pad(episodelist.size() < 99 ? 2 : 3)} - {norm(t)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'}{" Part $pi"}{" [$resolution $vc $ac $af]"}

Re: Titles To Long

Posted: 28 Mar 2015, 17:33
by rednoah
Well, what do you expect it to do? {n.take(100)} will limit {n} to 100 chars, so it'll do nothing if {n} is less than 100 so effectively always.

What you want is difficult because it naturally can't be achieved by limiting each {expression} but the result of all expressions, which is not supported.

It can be done, but you'd have to completely rewrite your code and fit everything into one expressions ala

Code: Select all

/Anime/{(code code code).limit(100)}
If your code is mostly Copy & Paste without understanding how the code works you will most likely won't be able to rewrite it this way.

I recommend simplifying your expression and putting less information into the filenames.

Re: Titles To Long

Posted: 28 Mar 2015, 19:37
by Urlryn
Thanks Red!

I was just using the 100 as the example, which i had gotten from one your previous posts talking about {t.take(100)}, but I was not sure writing the variable.take(value) would work for any of the other variables types such as {n} and {primaryTitle}.

But again your right i don't completely understand how to write the expresses just yet, hence why i am using Ithiel's version. I probably started off with one of the more complex ones to learn off of. Blame the naming OCD! :) And since it seems like Ithiel isn't around or is to busy to respond to his own threads....I figured you would be able to point me in the right direction!

Urlryn

Re: Titles To Long

Posted: 28 Mar 2015, 19:55
by rednoah
String.take(int) will work for all String type objects.

Simple style expression:

Code: Select all

{n.take(10)} - {s00e00} - {t.take(10)}
Groovy style expression:

Code: Select all

{"$n - $s00e00 - $t".take(20)}
In the latter you're able to use take(int) on the Groovy String. Though errors / exception behaviour will be different depending on the circumstances.