Title notations to hide info

edited version on author’s request, thank you. /mod


The following script skips every character from the beginning of a title string up to (and including) an arbitrary separator string, in this example ## . (Note the blankspace at the end of the separator. Not needed, but recommended.)

Logging can be underdone freely in mAirList, e. g. %b - %a.

Remember to set a delay for logging (and to switch to v7.1).


// To be used from mAirList v7.1 on

// Set logging delay greater than 0:00!

const
  SEPARATOR = '## ';     // <== Define separator string here
  
function Separate(Title: string): string;

begin
  if Pos(SEPARATOR, Title) <> 0 then
    Result := copy(Title, Pos(SEPARATOR, Title) + Length(SEPARATOR), 
      Length(Title) - Length(SEPARATOR))
  else
    Result := Title;
end;

procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer;
  OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
  if NewState = psPlaying then
    Item.SetTitle(Separate(Item.GetTitle));
end;


begin
end.

Thank you again, @Torben. The little tweak you made to the code makes custom logging so much easier.

2 Likes