Help needed with nfo export please!


#1

I'm really sorry if this is simple and I'm just missing something but I've searched around for a few days and tried to do it myself by reading the help pages (and adjusting examples posted by others) however I just cant seem to figure it out.

Essentially I would like the block of text to be centered/aligned with no artist/album to exceed the limits of the text block, I think from reading around on here I need to pad the lines away from the edges but I have no idea if that is even correct or not. Please tell me if I'm not explaining it properly but I'm completely burnt out trying to figure this out (I have absolutely no scripting knowledge at all)

Many thanks in advance!


#2

How many characters for each line?
Is that number to be the same for every album or should it vary depending on the data?
If it is allowed to vary, what is the maximum # of characters?
In any case, what should happen if the data is too much for the specified # of characters?


#3

Like if they ever made the novel "And to My Nephew Albert I Leave the Island What I Won off Fatty Hagan in a Poker Game" into a movie....

Just my 10 pennies: what if the export were a plain text file with a tab character as separator between the label and the variable data and then format the text in a word processor where one can set the position and formatting of the tab stop depending on the actual data?


#4

I'm not familiar with that book but it sure has a long title.:slightly_smiling_face:

One day I might try and find this 1995 album by "Cap'n Jazz":
Burritos, Inspiration Point, Fork Balloon Sports, Cards In The Spokes, Automatic Biographies, Kites, Kung Fu, Trophies, Banana Peels We've Slipped On, And Egg Shells We've Tippy Toed Over

That will surely not be accommodated by this script, which seems to do what @giant wants.

Export NFO file (centered).mte (1.3 KB)


#5

Wow, thank you so much this is amazing! I've been reading through the script to learn from and I'm confident that I wouldn't have been able to do this myself so I really appreciate it. Thinking about it the longer album title thing will be an issue, how would I edit it to increase the maximum width of the text box? the width of the NFO is 80 so maybe have the text box 60 characters long with 10 empty on each side?

Many thanks again.


#6

You're welcome.
But I bet you could improve your skills by reading the docs, practise, and trial & error. :wink:

I tried to add comments in the script, but maybe they weren't clear.
The lines that start $puts(COMMENTS do nothing except provide information about the script.
The string "COMMENTS" could be anything (eg. "Info", "Notes", "QWERTY")

The width of the NFO is specified by the line $puts(Max_Char_Line,x), where x is the number of characters. So change x to whatever you want.
The max. width of the text box is specified by the line $puts(Max_Char,y), where y is the number of characters. So change y to whatever you want.

If the width of the NFO is hard-coded (like it is now), then there will always be trouble with long album (or artist) names.
It is probably possible to set the NFO and text box widths dynamically, but that means the NFO files for "long-title" albums would have a non-standard format.

My experience with projects like this is that there is always some oddball cases that "break" the intended format of the results.
You could filter the file list before exporting: for example, "$len(%album%)" LESS x, where x is whatever max length "works".
Or maybe use the suggestion by @ohrenkino. (above)


#7

Thank you for clearing things up! I'm a very slow learner with this stuff so I do appreciate your help in this (and explanations) I've edited the script slightly and it's nearly perfect however I've found that if I put anything above the script you provided there's a long gap between that and the text block. Is there anyway to correct that or am I missing something again?

Thank you again!


#8

In the script, I wrote this:

$puts(COMMENTS, All but the last 6 lines can be concatenated on 1 line here, so that there will be only one blank line at the top of the exported NFO file)

I'll try and explain:
Only the last 6 lines of my script actually write anything to the NFO file.
But the engine that executes these scripts writes 1 output line for every line in the script.
I suppose that is because a space is considered a character and a blank line may be desired in the export.
So even if a line causes no data to be written, or is blank in the script, a blank line is written to the output.

Luckily, you can often "join" lines together and write them all on 1 line: that is what concatenate means.

Instead of:
$Line 1
$Line 2
$Line 3
$etc.

This:
$Line 1$Line 2$Line 3$etc.

And I don't mean that another $ should be added: just copy the lines exactly as they are.

You may edit my original script by writing all but the last 6 lines on the 1st line, one after the other, and deleting any blank lines.
That makes it even harder to read and debug than usual, so do it only after everything works as intended.

I don't know what you added, so slow experimentation may be a good idea if you try and create concatenated commands.
I suspect it is the dollar sign ($) that is used to separate "commands".


#9

I have it all working like I want now, many thanks for being so patient and taking the time to explain everything. It's much appreciated!