Sorry to quote and reply to myself but it could be useful for somebody else.
I tried to use $if(%isplaying%, show info, show nothing)
but it seems it doesn't work correctly. When I stop or pause the playing,
the info are still showed with the last values, even for the playing time.
I can only see the "show nothing" for a second or two when I start
the playing of a track.
The same expression works correctly in a track info panel.
Do I have to use some different syntax than the one I found on the
reference page linked by Daeron? If yes, which one?
I removed the %isplaying% strings and I set the OSD to
"Automatically pop up at play... and hide at stop"
so I will never have info shown with no tracks playing.
I also set up a couple of vbs files to activate/deactivate
the screensaver so that when nothing is playing the screensaver
kicks in and when the play starts the screensaver is deactivated
leaving space for FB OSD.
This is the full configuration string of my OSD, with smart auto wrapping
of title and performer. If the text is longer than the max amount
of characters I can show in a line (76 in my case) it gets truncated
at a space position and the length of the remaining string is checked again
against 76, and so on. I set up a different number of splittings asI have
different maximum lengths for different genres.
I used variables with $puts() and $get() to simplify a little the calculation
of the beginning and the end of each line of text after the truncation.
Here is a couple of screenshots of a jazz track and a classical one.
Hope some snippet can be useful for somebody else.
Thank you.
$crlf()
$crlf()
$crlf()
//Start of title
$rgb(255,255,60)
//If title length is greater than 76 than start to cut it in two lines
//otherwise show it on a single line
$ifgreater($len(%title%),76,
//First line of title, truncated at the last space before the 76th character
$puts(tae,$strrchr($substr(%title%,1,76), ))
$substr(%title%,1,$get(tae))
$crlf()
//Second line of title, from the first character after the last of the first line
//to the last space inside the next 76 chars or to the end of title if shorter.
$puts(tbs,$add($get(tae),1))
$ifgreater($sub($len(%title%),$get(tae)),76,
$puts(tbe,$add($get(tbs),$strrchr($substr(%title%,$get(tbs),$add($get(tbs),76)), )))
$rgb(255,255,60)$substr(%title%,$get(tbs),$get(tbe))
,$rgb(255,255,60)$substr(%title%,$get(tbs),$add($get(tbs),76)))
,%title%)
//End of title
$crlf()
$crlf()
$crlf()
//Start of artist or composer
$if($stricmp(%genre%,classica),$rgb(255,204,153)'Composer: '$rgb(255,255,255)%composer%,
$rgb(255,255,255)%artist%)
//End of artist or composer and date
$crlf()
//Start of conductor, orchestra, performer, artist, album and date
[$crlf()$rgb(255,255,255)
//Replaces existing groups of three spaces with a single one into performer field
$puts(pf,$replace(%performer%, , ))
//If genre is classica shows conductor, orchestra and performer
$if($stricmp(%genre%,classica),
[%conductor%][ - %orchestra%]
$crlf()
//Start of performer
//If genre is classica there will be at maximum two lines
[
//First line of performer, truncated at the last space before the 76th character
//or to the end of performer if shorter.
$puts(lae,$strrchr($substr($get(pf),1,76),')'))
$substr($get(pf),1,$get(lae))
$crlf()
//Second line of performer, from the first character after the last of the first line
//to the last space inside the next 76 chars or to the end of performer if shorter.
$puts(lbs,$add($get(lae),2))
$puts(lbe,$add(-1,$get(lbs),$strrchr($substr($get(pf),$get(lbs),$add($get(lbs),76)),')')))
$substr($get(pf),$get(lbs),$get(lbe))
$crlf()
//Third line of performer, from the first character after the last of the second line
//to the last space inside the next 76 chars or to the end of performer if shorter. (disabled)
//$puts(lcs,$add($get(lbe),2))
//$puts(lce,$add(-1,$get(lcs),$strrchr($substr($get(pf),$get(lcs),$add($get(lcs),76)),')')))
//$substr($get(pf),$get(lcs),$get(lce))
$crlf()
//Fourth line of peformer, from the first character after the last of the third line
//to the last space inside the next 76 chars or to the end of performer if shorter. (disabled)
//$puts(lds,$add($get(lce),2))
//$puts(lde,$add(-1,$get(lds),$strrchr($substr($get(pf),$get(lds),$add($get(lds),76)),')')))
//$substr($get(pf),$get(lds),$get(lde))
//$crlf()
//Fifth line of peformer, from the first character after the last of the fourth line
//to the last space inside the next 76 chars or to the end of performer if shorter. (disabled)
//Disabled
//$puts(les,$add($get(lde),2))
//$puts(lee,$add(-1,$get(les),$strrchr($substr($get(pf),$get(les),$add($get(les),76)),')')))
//$substr($get(pf),$get(les),$get(lee))
//$crlf()
]
,$if($stricmp(%genre%,jazz),
//If genre is jazz there will be at maximum six lines
//First line of performer, truncated at the last space before the 76th character
//or to the end of performer if shorter.
$puts(lae,$strrchr($substr($get(pf),1,76),')'))
$substr($get(pf),1,$get(lae))
$crlf()
//Second line of performer, from the first character after the last of the first line
//to the last space inside the next 76 chars or to the end of performer if shorter.
$puts(lbs,$add($get(lae),2))
$puts(lbe,$add(-1,$get(lbs),$strrchr($substr($get(pf),$get(lbs),$add($get(lbs),76)),')')))
$substr($get(pf),$get(lbs),$get(lbe))
$crlf()
//Third line of performer, from the first character after the last of the second line
//to the last space inside the next 76 chars or to the end of performer if shorter.
$puts(lcs,$add($get(lbe),2))
$puts(lce,$add(-1,$get(lcs),$strrchr($substr($get(pf),$get(lcs),$add($get(lcs),76)),')')))
$substr($get(pf),$get(lcs),$get(lce))
$crlf()
//Fourth line of peformer, from the first character after the last of the third line
//to the last space inside the next 76 chars or to the end of performer if shorter.
$puts(lds,$add($get(lce),2))
$puts(lde,$add(-1,$get(lds),$strrchr($substr($get(pf),$get(lds),$add($get(lds),76)),')')))
$substr($get(pf),$get(lds),$get(lde))
$crlf()
//Fifth line of peformer, from the first character after the last of the fourth line
//to the last space inside the next 76 chars or to the end of performer if shorter.
$puts(les,$add($get(lde),2))
$puts(lee,$add(-1,$get(les),$strrchr($substr($get(pf),$get(les),$add($get(les),76)),')')))
$substr($get(pf),$get(les),$get(lee))
$crlf()
//Sixth line of peformer, from the first character after the last of the fifth line
//to the last space inside the next 76 chars or to the end of performer if shorter.
$puts(lfs,$add($get(lee),2))
$puts(lfe,$add(-1,$get(lfs),$strrchr($substr($get(pf),$get(lfs),$add($get(lfs),76)),')')))
$substr($get(pf),$get(lfs),$get(lfe))
//$crlf()
,
//%artist% -
%album% - %date%
$crlf()
//If genre is different than classica and jazz there will be at maximum two lines
//First line of performer, truncated at the last space before the 76th character
//or to the end of performer if shorter.
$puts(lae,$strrchr($substr($get(pf),1,76),')'))
$substr($get(pf),1,$get(lae))
$crlf()
//Second line of performer, from the first character after the last of the first line
//to the last space inside the next 76 chars or to the end of performer if shorter.
$puts(lbs,$add($get(lae),2))
$puts(lbe,$add(-1,$get(lbs),$strrchr($substr($get(pf),$get(lbs),$add($get(lbs),76)),')')))
$substr($get(pf),$get(lbs),$get(lbe))
$crlf()
)
)
]
//Line to separate performer from the rest
//'Azzurro'
//$rgb(143,200,231)
//______________________________________________________
$crlf()
$crlf()
//Rating
//$rgb(255,204,153)'Rating: '
$rgb(0,255,255)%rating%
//Tempo
//$rgb(255,204,153)'Tempo: '
$rgb(255,255,255)%tempo%
//Genre and subgenre (style)
//$rgb(255,204,153)'Genre: '
$rgb(255,255,255)%genre%
//$rgb(255,204,153)'Style: '
$rgb(255,255,255)%subgenre%
$crlf()
//Line to separate between rating, tempo, genre, style and situation
//'Azzurro'
//$rgb(143,200,231)
//______________________________________________________
$crlf()
//Situation
//$rgb(255,204,153)'Situation: '
$rgb(255,255,255)%situation%
//$crlf()
//Line to separate between situation and playback time
//'Azzurro'
//$rgb(143,200,231)
//______________________________________________________
//$crlf()
//Length + playback time + playback time remaining
$rgb(255,255,255)%length% '-' %playback_time% '-' %playback_time_remaining%
$crlf()
//Fancy progress bar (taken from the forum)
//$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 130,$rgb(143,58,191,0,0,0)'?',$rgb(108,18,64,0,0,0)'?')
$crlf()
$crlf()
//Line to keep the width of the window fixed
'______________________________________________________________________________'
//Some colours codes
//$rgb(255,255,60)'Giallo titolo'
//$rgb(136,204,150)'Verduzzo'
//$rgb(255,204,153)'Rosa'
//$rgb(143,200,231)'Azzurro'
//$rgb(255,0,255)'Magenta'
//$rgb(0,255,255)'Ciano'
//$rgb(255,0,0)'Rosso'
//$rgb(0,0,255)'Blu'
//$rgb(0,255,0)'Verde'
//$rgb(255,255,255)'Bianco'