Loging next song - but without jingles

Fine! That is possible, I will post this evening (if I don’t forget). (I just took what you gave to me.)

Great! Thank you!!!
Ummm… is it maybe possible to refresh the + and ++ songs on log file when it’s changed on playlist? I just tested, if i change the next song it stays as it was.

I changed your script with help of ChatGPT… is this correct? :slight_smile:

function GatherData(Item: IPlaylistItem; k: integer): string;
begin
  if k = 1 then
    Result := Item.GetArtist + ' - ' + Item.GetTitle
  else
    Result := 'Slijedi ' + Item.GetArtist + ' s pjesmom ' + Item.GetTitle;
    // add another else block here
    if k > 2 then
      Result := 'Nakon toga ' + Item.GetArtist + ' s pjesmom ' + Item.GetTitle;
end;

procedure GetMusic(Index: integer);
var
  i, k: integer;
  Item: IPlaylistItem;
begin
  i := 0;
  k := 0;
  while k < 3 do
    try
      Item := CurrentPlaylist.GetItem(Index + i)
      if Item.GetItemType = pitMusic then
      begin
        SetRuntimeData('Data' + IntToStr(k + 1), GatherData(Item, k + 1));
        Inc(k);
        Inc(i);
      end
      else
        Inc(i);
    except
      exit;
  end;
end;


procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer;
  OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
  if NewState = psPlaying then
    if Item.GetItemType = pitMusic then
      GetMusic(CurrentPlaylist.IndexOf(Item));  
end;


begin
end.

I don’t know. If it is working, then it is obviously correct. I will not evaluate the efficiency of any AI chatbots.

Firstly, here is the script for different log messages:


Log3Times 1.1.mls (1,7 KB)


I can’t imagine why updates shouldn’t work, as the script gathers the metadata of the current and the following two music items every time once a title is started.

However, a scripted reaction of playlist updates is not possible because we don’t have a procedure OnPlaylistUpdate at hand so far. This is one of my major wishes at @Torben at the time being.

1 Like

I tried to write some Scripts with ChatGPT several weeks ago too. They all didn’t work.

So it would be interesting if it works now, @fpavic :thinking:

Nah… @Stefan_Hillen I haven’t tried. I belive more in scripting knowledge of @Tondose than ChatGPT

1 Like