Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: [Skinning] title formatting help (Read 431 times) previous topic - next topic
WhistleChips and 1 Guest are viewing this topic.

[Skinning] title formatting help

I have a request for any code warriors on the forum. I've been racking my brain to implement a set of labels that will split a tag that is longer than a set number of characters, printing the second part in a new label (and potentially a third label). My main reason for doing this is for easy viewing in a car. I don't need album art, just the basic info easily read.

As it stands I've got code that will split a tag and print it mostly successfully (details below), but is fraught with problems. I borrowed some code from the desktop forum and adapted it, but the logic is beyond me at this point.

The code I borrowed is here:,43044.msg914190.html#msg914190
and is nicely commented within. I only used the first part, re: the %title%. The main concept is to set a desired length (76 in the original code; 25 for now in mine), find the last occurrence of " " (space char) within the first block of the tag, and split from there. It works great with the OSD component for the desktop version, and sorta kinda works within a [label].

The nested logic of the second [label] is killing me. I've tried separating it into what seem like component parts, then writing out the logic in English, but I get lost.

Here is my code from the subskin, and a few photos to illustrate what works and what doesn't:
Code: [Select]
[font-artist][$ifgreater($len(%artist%),25,$puts(tae,$strrchr($substr(%artist%,1,25), ))$substr(%artist%,1,$get(tae)),%artist%)]

[font-artist][$ifgreater($len(%artist%),25,$puts(tae,$strrchr($substr(%artist%,1,25), ))$puts(tbs,$add($get(tae),1))$ifgreater($sub($len(%artist%),$get(tae)),25,$puts(tbe,$add($get(tbs),$strrchr($substr(%artist%,$get(tbs),$add($get(tbs),25)), )))$substr(%artist%,$get(tbs),$get(tbe)),$substr(%artist%,$get(tbs),$add($get(tbs),25))),%artist%)]

[font-title][$ifgreater($len(%title%),25,$puts(tae,$strrchr($substr(%title%,1,25), ))$substr(%title%,1,$get(tae)),%title%)]

[font-title][$ifgreater($len(%title%),25,$puts(tae,$strrchr($substr(%title%,1,25), ))$puts(tbs,$add($get(tae),1))$ifgreater($sub($len(%title%),$get(tae)),25,$puts(tbe,$add($get(tbs),$strrchr($substr(%title%,$get(tbs),$add($get(tbs),25)), )))$substr(%title%,$get(tbs),$get(tbe)),$substr(%title%,$get(tbs),$add($get(tbs),25))),%title%)]

[font-album][$ifgreater($len(%album%),25,$puts(tae,$strrchr($substr(%album%,1,25), ))$substr(%album%,1,$get(tae)),'('%date%')' %album%)]

[font-album][$ifgreater($len(%album%),25,$puts(tae,$strrchr($substr(%album%,1,25), ))$puts(tbs,$add($get(tae),1))$ifgreater($sub($len(%album%),$get(tae)),25,$puts(tbe,$add($get(tbs),$strrchr($substr(%album%,$get(tbs),$add($get(tbs),25)), )))$substr(%album%,$get(tbs),$get(tbe)),$substr(%album%,$get(tbs),$add($get(tbs),25))),%album%)]

This photo shows successful wrapping of the Artist and Title, and the Album with %date% prepended, but with Album tag duplicated in the second [label]; preferred outcome is to print nothing rather than duplicate the field
Spoiler (click to show/hide)

This photo shows duplicates of the Artist and Title tags, with partial successful splitting of the Album tag; NB: the %date% is not prepended even though the code calls for it to be
Spoiler (click to show/hide)

This photo shows all three tags duplicated, but with %date% prepended, given no splitting of the Album name is required
Spoiler (click to show/hide)

I've tried things like ending the second label with, e.g.,
and while this eliminates duplicates, it also stops the second part of any split tag from printing, so obviously not a solution. I know the else is part of the $ifgreater, but using
results in the same problem: i.e., the second [label] for a given tag is not printed.

The other problem is %date% getting stripped from the first Album [label] if it gets split. As I don't want %date% in the second [label], it's only referenced in the first [label], but this may be the problem of it not showing up when the Album tag is split.

Any insights would be much appreciated.  In the meantime I'll keep torturing my brain.