Welcome Guest

Pages: 1
Truncate title for filename
hoeniPostMay 10, 2014, 11:12
Newbie
Posts: 19
Registered:
April 30, 2014, 07:38
Normal topicTruncate title for filename

Hi,

when rename the Files I have not found a way to truncate long titles to a maximum size for filenames.
So when I was cleaning up this album http://en.wikipedia.org/wiki/Every_Red_Heart_Shines_Toward_the_Red_Sun it was trying to rename the files which stops at Track 6 with an error (I suppose due to the long names).

Is there a way I can workaround this?

Hoeni

PS:
Wonderful album nevertheless 🙂

2MR2PostMay 10, 2014, 17:27
Avatar photo
Administrator
Posts: 2084
Registered:
August 23, 2012, 19:27
Normal topicRe: Truncate title for filename

The issue is that the max filename length is file system dependent. To make matters worse, some file systems have a maximum path length. Even doing a simple truncate is not great. if the truncated name is a duplicate there has to be room to apply the duplicate name logic. Further, if you are adding suffix information (which is quite common) you more than likely want to truncate the offending field rather than lose data at the end.

I could simply apply a rule (or option) to truncate any field inserted via a rename template to a fixed or specific length. This would still not be perfect.

I'm open to suggestions.

hoeniPostMay 13, 2014, 03:02
Newbie
Posts: 19
Registered:
April 30, 2014, 07:38
Normal topicRe: Truncate title for filename

Well, in my case, it would be sufficient to simply cut the name down to a fixed length nicely that would be far away from most system limitations. The filename ist just a memo for me when adinistrating the files, for the correct title I (and my mediaplayers) use the Metadata anyway.

I would want to cut lengthy names down even if the file system would be able to store them properly.
So a fixed length would be perfect. Nice to have would be the possibility to apply a different length for each field and a nice truncation ending with "..."

2MR2PostMay 13, 2014, 11:34
Avatar photo
Administrator
Posts: 2084
Registered:
August 23, 2012, 19:27
Normal topicRe: Truncate title for filename

I've implemented some new Rename Template tokens in v2.7.4.

You can make as many length tests as you wish but they are always on the current value of the constructed name at the time of the test.

<IfLength> integer

tests if the current length is greater than the specified integer.

<Truncate> integer

truncates the current name to 'integer' characters

<Break>

is a dummy token used to separate sequences of text...primarily for the above tokens.

eg.

Desired template: <Track Pad2>-<Title>-<Year>

You could do the following:

<Track Pad2>-<Title><IfLength>100<Truncate>97<Break>...<EndIf>-<Year>

This seems to be a fairly good trade-off.

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.018 seconds.