IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> A little help please...., its regarding nfo template
vvikkass
post Nov 18 2016, 14:55
Post #1


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



I am using this code to put the comments between the border of my nfo.

CODE
$loop(%comment%,1)|$repeat( ,2)%comment%
$loopend()


its output is something like this,

CODE
|  FULL COMMENT


If say comment on mp3 is A-Z, its writing all of it on single line.

I want it to write 75 characters of comment between '|' and '|' and then change the line with again front and end border and remaining comment between these and so on.

Any help would be much appreciated.

This post has been edited by vvikkass: Nov 18 2016, 15:01
Go to the top of the page
 
+Quote Post
ohrenkino
post Nov 18 2016, 15:42
Post #2


Member


Group: Full Members
Posts: 9125
Joined: 9-December 09
From: Norddeutschland / Northern Germany
Member No.: 11458
Mp3tag Version: 2.84d



ZITAT(vvikkass @ Nov 18 2016, 14:55) *
I am using this code to put the comments between the border of my nfo.

QUELLTEXT
$loop(%comment%,1)|$repeat( ,2)%comment%
$loopend()


its output is something like this,

QUELLTEXT
|  FULL COMMENT


If say comment on mp3 is A-Z, its writing all of it on single line.

I want it to write 75 characters of comment between '|' and '|' and then change the line with again front and end border and remaining comment between these and so on.

Any help would be much appreciated.

To cut a comment at position 75, use $left(%comment%,75)
To continue with the rest: $mid(%comment%,76,$len(%comment%)

To write the | at the end, calculate the maximum length minus the length of the sub-string: $sub(75,$len($mid(%comment%,76,$len(%comment%))))


--------------------
42 - wie war die Frage / what was the question / quelle était la question
Go to the top of the page
 
+Quote Post
vvikkass
post Nov 18 2016, 15:49
Post #3


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



QUOTE (ohrenkino @ Nov 18 2016, 20:12) *
To cut a comment at position 75, use $left(%comment%,75)
To continue with the rest: $mid(%comment%,76,$len(%comment%)

To write the | at the end, calculate the maximum length minus the length of the sub-string: $sub(75,$len($mid(%comment%,76,$len(%comment%))))


Thanks for the help, but i didnt get that atall. When I am using only this:
$sub(75,$len($mid(%comment%,76,$len(%comment%))))

it gives strange output in numbers.

I want a | border in front and end. Max characters for comment I want to make it as 76 starting from 6th of any line.

best regards

EDIT: finally got it, it says -602 as its length.

Now what to do with it, also I dont want | in the end but want it after the every line ends, and making it as a border of nfo.

This post has been edited by vvikkass: Nov 18 2016, 17:35
Go to the top of the page
 
+Quote Post
DetlevD
post Nov 18 2016, 17:45
Post #4


Member


Group: Full Members
Posts: 6671
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.84d



QUOTE (vvikkass @ Nov 18 2016, 14:55) *
... I want it to write 75 characters of comment between '|' and '|' and then change the line with again front and end border and remaining comment between these and so on. ...

Read there for a starting point ...
https://forums.mp3tag.de/index.php?showtopic=18083

This is another example ...
$regexp($repeat('a large stream of text ',20),'(.{1,75})(?:\s+|$[\r\n]?)|(.{1,75})','$1$2\r\n')

The special task is to make each line the same width, for example by adding some space characters at end of each text line, then right cut the line to the wanted length.

If you want to put one pipe character at the beginning and at the end of each textline, ...
so you have to replace each CRLF sequence with a sequence of ...
'|'$char(13)$char(10)'|'
... to get one pipe character at end of a line and one pipe character in front of the next line.

At last add one pipe character at the very beginning of the text ...
(... and maybe one pipe character at the very end of the text).

DD.20161118.1745.CET

This post has been edited by DetlevD: Nov 18 2016, 22:10


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
vvikkass
post Nov 18 2016, 19:53
Post #5


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



QUOTE (DetlevD @ Nov 18 2016, 22:15) *
Read there for a starting point ...
https://forums.mp3tag.de/index.php?showtopic=18083

This is another example ...
$regexp($repeat('a large stream of text ',20),'(.{1,75})(?:\s+|$[\r\n]?)|(.{1,75})','$1$2\r\n')

The special task is to make each line the same width, for example by adding some space characters at end of each text line, then right cut the line to the wanted length.

If you want to put one pipe character at the beginning and at the end of each textline, ...
so you have to replace each CRLF sequence with a sequence of ...
'|'$char(13)$char(10)'|'
... to get one pipe character at end of a line and one pipe character in front of the next line.

At last add one pipe character at the very beginning of the text ...
and one pipe character at the very end of the text.

DD.20161118.1745.CET


Hi, Thanks a lot for helping me. It is exactly what I wanted.

One problem though, whats CRLF sequence and how to repalce it?

EDIT: Also need the lines to start from 7th charater point, I am already putting this code on 7th character so first line is not a problem but rest of the text starts from 1st point.



This post has been edited by vvikkass: Nov 18 2016, 22:01
Go to the top of the page
 
+Quote Post
DetlevD
post Nov 18 2016, 22:22
Post #6


Member


Group: Full Members
Posts: 6671
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.84d



QUOTE (vvikkass @ Nov 18 2016, 19:53) *
... One problem though, whats CRLF sequence and how to repalce it?
EDIT: Also need the lines to start from 7th charater point, I am already putting this code on 7th character so first line is not a problem but rest of the text starts from 1st point.

The end of a text line, in Windows environment, is mostly a sequence of two characters:
$char(13) ... CR ... Carriage Return
$char(10) ... LF ... Linefeed

Try to add 7 space characters just following the LF character, e. g. ...
$replace('the given text here',$char(10),$char(10)$repeat($char(32),7))

DD.20161118.2222.CET


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
vvikkass
post Nov 18 2016, 22:31
Post #7


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



ok found that CRLF means \r\n and replaced all with '|'$char(13)$char(10)'|' to make it look like,

$regexp($repeat('a large stream of text ',20),'(.{1,75})(?:\s+|$['|'$char(13)$char(10)'|']?)|(.{1,75})','$1$2'|'$char(13)$char(10)'|'')

but it returned error. A single lined text. Please help.
Go to the top of the page
 
+Quote Post
vvikkass
post Nov 18 2016, 22:40
Post #8


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



here is what I had put,



and this results in single long text,



Go to the top of the page
 
+Quote Post
DetlevD
post Nov 18 2016, 22:53
Post #9


Member


Group: Full Members
Posts: 6671
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.84d



QUOTE (vvikkass @ Nov 18 2016, 22:40) *
... and this results in single long text ...

Probably the given text has no CRLF sequences?
Well, it looks like as if you have opened a big problem for you, regarding text manipulation.
I tend to say, leave the given text as is, ... and do not to try to make cosmetic pastels.
You will get even more difficulties when you want to cut the line length for each line to the same length.

DD.20161118.2252.CET


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
vvikkass
post Nov 18 2016, 22:58
Post #10


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



So what should I do here? I am trying to import a text file within nfo and create boundaries for the lines, as long as it goes down . sad.gif




lets say I want only the front pipe and not the end pipe and want the alphabets to start from 7th character.

Please help, I will forever be grateful.

This post has been edited by vvikkass: Nov 18 2016, 23:03
Go to the top of the page
 
+Quote Post
DetlevD
post Nov 19 2016, 09:28
Post #11


Member


Group: Full Members
Posts: 6671
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.84d



QUOTE (vvikkass @ Nov 18 2016, 22:58) *
So what should I do here? I am trying to import a text file within nfo and create boundaries for the lines ...

While in a Google search there was shown a hint to a user created Mp3tag MTE script, which creates a HTML page, which in turn may display a floating text stream within a textbox, where the text has been framed by ASCII box characters, ready made for usage as NFO text file. Search for "fastnfo".

See also ...
https://forums.mp3tag.de/index.php?showtopic=5985
https://forums.mp3tag.de/index.php?showtopic=10033
https://forums.mp3tag.de/index.php?showtopic=16412
https://forums.mp3tag.de/index.php?showtopic=18078

Try to find your way to go.

DD.20161119.0947.CET

This post has been edited by DetlevD: Nov 19 2016, 09:47


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
vvikkass
post Nov 19 2016, 11:45
Post #12


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



Thanks, will read them. smile.gif

Can you help me with this:

Want to put the text in centre of 7th and 75th character, so it looks balanced from both the sides, also will use the $regex code in your previous post to truncate the words after 70th character and do the remaining from next line. Any idea how to edit your previous $regex code to do the centre text?

Always appreciate the help from you two guys.
Go to the top of the page
 
+Quote Post
DetlevD
post Nov 19 2016, 15:55
Post #13


Member


Group: Full Members
Posts: 6671
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.84d



QUOTE (vvikkass @ Nov 19 2016, 11:45) *
... Any idea how to edit your previous $regex code to do the centre text? ...

The following steps are just a proposal to be modified by yourself.

1. TEST <== $repeat('a large stream of text ',20)

2. TEST <== $regexp(%TEST%,'(.{1,75})(?:\s+|$[\r\n]?)|(.{1,75})','$1$2\r\n')

3. TEST <== $replace(%TEST%,$char(13),$repeat($char(32),75)$char(13))

4. TEST <== $regexp(%TEST%,'(.{1,75})(\s*)(\r\n)','$1$3')

5. TEST <== $trimRight('|'$regexp(%TEST%,'\r\n','|\r\n|'),'|')


|a large stream of text a large stream of text a large stream of text a     |
|large stream of text a large stream of text a large stream of text a large |
|stream of text a large stream of text a large stream of text a large stream|
|of text a large stream of text a large stream of text a large stream of    |
|text a large stream of text a large stream of text a large stream of text a|
|large stream of text a large stream of text a large stream of text a large |

DD.20161119.1603.CET

This post has been edited by DetlevD: Nov 19 2016, 16:03


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
vvikkass
post Nov 19 2016, 17:16
Post #14


Member


Group: Full Members
Posts: 40
Joined: 13-October 16
Member No.: 22612
Mp3tag Version: 2.78



Thanks a lot smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th October 2017 - 23:24