NowPlaying Script

Finally decided to give 3.0.2 Build 555 a test.
I see that my NowPlaying script does not work anymore.

Torben, can you confirm this?

[code]procedure OnPlayerStart(PlayerControl: IPlayerControl; Item: IPlaylistItem);
var
sl: TStringList;
begin
if Instance.GetOnAir = True then begin
sl := TStringList.Create;
sl.Add(’"’ + Item.GetArtistsString + ‘"’ + ‘,’ + ‘"’ + Item.GetTitle + ‘",“NULL”’);
sl.SaveToFile(‘C:\RDS\RDS.txt’);
sl.Free;
end;
end;

begin
end.[/code]

regards:
-Serge-

Yes, the “Item” parameter is obsolete now. You need to remove it.

procedure OnPlayerStart(PlayerControl: IPlayerControl);

To access the item, use PlayerControl.GetItem now.

By the way, what this simple script does can also be achieved with a log file (in overwrite mode).

Thanks a lot !
That helped indeed… ;D

BTW, is there a way to get the cartwall loaded with a default set at program start? Can this be achieved with standard.mlt maybe?

regards:
-Serge-

standard.mlt did the trick !

regards:
-Serge-

Damned! I now realize that these notification scripts have changed again.

I have no clue on what is meant by your posting with those templates attached.
So Torben, could you please help me getting my script running again please.

regards:
-Serge-

Try this one:

procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer);
var
    Item: IPlaylistItem;
    sl: TStringList;
begin
    item := Playlist(PlaylistIndex).GetPlayer(PlayerIndex).GetItem;
    if Instance.GetOnAir = True then begin
        sl := TStringList.Create;
        sl.Add('"' + Item.GetArtistsString + '"' + ',' + '"' + Item.GetTitle + '","NULL"');
        sl.SaveToFile('C:\RDS\RDS.txt');
        sl.Free;
    end;
end;

begin
end.

Yep, thanks Torben.

Now I understand how it’s meant. I was already on the right track but did not realize that the “integer” was a type declaration.
Thought I had to specify a variable there that would hold the integer value.

One thing I noticed now is that this script only applies to the players and not the carts. Hmm, I’m not sure but could it be that in the early 3.0.0 release the script also applied to the carts? I’m not sure anymore…

Anyhow, no Problem, I’ll add a separate script for the carts.

Thanks for your support:
-Serge-

There’s another function, OnCartPlayerStart(PlayerIndex: integer), which is called when it’s a cart player which gets started. This has been this way ever since. If OnPlayerStart was called for cart players in earlier versions, that must have been a bug.

Oh, and may I please repeat myself:

By the way, what this simple script does can also be achieved with a log file (in overwrite mode).

In the config, on the “Logging” page, add a new log file:

  • File name: c:\RDS\RDS.txt
  • log format: “%a”, “%b”, “NULL”
  • overwrite: yes

Then you can get rid of your script :slight_smile:

No Torben, I can’t get rid of it.

Other software we use for automated control have to write to the same textfile in the same format. We cannot change those but rather have mAirList to output the current playing song in the same format than the other software does.
RDS-Coder, Shoutcast Interface, etc… scans this file continuously and tracks changes to it.

OK, again in trouble for the cartplayers. Could you please point me to the right syntax for the method for the

GetCartPlayer?(PlayerIndex).GetItem.GetArtistsString

GetCartPlayer does not seem to be correct. BTW, where can I find a Reference to these methods?

regards:
-Serge-

The above log file configuration does the EXACT SAME THING as your script. Writes a file named c:\rds\rds.txt, overwriting the existing file, and placing the artist and title info in the desired format into it.

There’s no sense in using a script here, because the functionality is contained in mAirList out of the box.

Regarding the cart players, you should be able to acess them by Cartwall.GetPlayer(PlayerNumber) if I’m not mistaken.

[quote=“radiorom, post:9, topic:5983”]Other software we use for automated control have to write to the same textfile in the same format. We cannot change those but rather have mAirList to output the current playing song in the same format than the other software does.
RDS-Coder, Shoutcast Interface, etc… scans this file continuously and tracks changes to it.[/quote]

What I forgot to mention is that the Instance.GetOnAir prevents mAirList from writing to this common textfile when the automated Program is on. So our speakers can use mAirList in OffAir mode whilst the other software is active without messing up stream and RDS data.
If you tell me that the logging relies on the On/OffAir Switch as interlock I will use it straight away ;D

On the other hand for the Cartplayer-Script. I’m getting to nowhere as I do not know what the exact syntax should be.
In my opinion it should be something like:

CartWall.GetPlayer(PlayerIndex).Getitem.GetArtistsString

but that does not fit ???

ragards:
-Serge-

Doohhhh,

I should have tried the logging earlier. It does exactly what is required. Only loggs with OnAir set.

just one Thing:

after saving the config, “%a”, “%b”, “NULL” gets saved as %a", “%b”, "NULL without the starting and ending quotes. That strips me the first Char ;D
Have to look for a workaround on that…

regards:
-Serge-

EDIT:
Workaround is to write “”%a", “%b”, “NULL”" manually to the logging.ini file.
Just have to be aware that it gets overwritten again when changing something with the config utility

Does V3 now allow multiple log files?

(Sorry, I have not had the time available to try v3 for a LONG time now: I need to concentrate on finding a job!)

BFN
CAD

Yes it does allow multiple logs.

regards:
-Serge-

This is probably because the ini file functions use the double quote as a delimiter in case you have (intended) blanks at the beginning or end of the string.

It should be fairly easy to fix this.

… It should be fairly easy to fix this.[/quote]
… meantime, one could probably type the log string within Config as:
“”%a", “%b”, “NULL”"

Yes or no? :smiley:

BFN
CAD

No, not in config but directly into the logging.ini
Config omits the leading and ending doublequotes when saving.

regards:
-Serge-