I use Http Post and Icecast.
This happens:
Error message in system log.
Output title %R{LogTitle} gives the title, but doesn’t remove the ##Hitintro.
So it’s not completely broken.
Mairlist 6.3.19 4476
I use Http Post and Icecast.
This happens:
Error message in system log.
Output title %R{LogTitle} gives the title, but doesn’t remove the ##Hitintro.
So it’s not completely broken.
Mairlist 6.3.19 4476
Can it interfere with other scripts?
Answer: No I dissabled them to test.
I am a bit busy at the moment, I will come back to this.
Please note the difference between ##hitintro
and ##Hitintro
. You can modify the script to that extent.
Thank you for helping me. No hurry.
#nicetohave
How about this one?
const
PREFIX = '##hitintro';
var
Title: string;
procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer;
OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
if NewState = psplaying then
begin
Title := Item.GetTitle;
if Copy(Title, 1, Length(PREFIX)) = PREFIX then
Title := Copy(Title, Length(PREFIX) + 2, Length(Title) - Length(PREFIX));
SetRuntimeData('LogTitle', Title);
end;
end;
begin
end.
Yes the error is gone… But.
It now shows the (correct) artist with the (wrong) title . Its the of the voicetrack that I placed over the intro of a track. I didn’t know that songtitle
So I guess the variables are global?
I guess I’ve made a difficult request.
Okay, then please tell me which info you would like to log alt all. Then I might build the retrieval around your needs.
The idea is that, in a music track, the title of (example) the Silverster song:
You make me feel ##hitintro
Will log at the website (httppost log) and the player as:
You make me feel
So the deejay knows he is starting a Hitintro version, but the listener just sees the title of the song.
I ve found out that the last script code was returning the title of a Voicetrack. This track that was overlapping with the song. So I guess that your script was fooled by an overlapping track, played in auto mode in the same player.
Because the previous track might still be the displayed title in the player. The script will pick the wrong title.
So it logged: Silverster - voicetrack404123
And that should have been: Silverster - You make me feel
Thank you, this is what I’d liked you to tell me. And I assume only „Music“ type audios are to be logged, right?
The issue is, if I recall correctly, that the tasks of „logging“ and „scripting“ are processed within mAirList independently in different so-called threads, which can be seen as a measure of safety: If you screw up with a script the programme itself will remain working.
However, this also means that you cannot predict which task, i. e. on starting an audio, will be executed first – scripting or logging. (This is why I took a rather tentative approach on the issue.) It may well be that we are experiencing something like that here. Nor are you able to access the logging process itself via scripting.
So what I should try to implement now is to emulate the whole logging process on scripting level (what in this case could well be achieved, as I see it at the moment), which on the other hand means that there won’t be a comfortable menu to select the variables – this is now to be implemented directly in the script.
Try this one here and make sure you are only logging %R{LogTitle}
:
const
PREFIX = '##hitintro';
var
Title, Artist: string;
pi: IPlaylistItem;
procedure OnLoad;
begin
Title := '';
Artist := '';
end;
procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer;
OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
if NewState = psPlaying then
begin
Sleep(2000);
pi := CurrentPlaylist.GetItem(CurrentPlaylist.IndexOf(Item) + 1);
if pi.GetItemType = pitMusic then
begin
Title := pi.GetTitle;
Artist := pi.GetArtist;
end;
if Copy(Title, 1, Length(PREFIX)) = PREFIX then
Title := Copy(Title, Length(PREFIX) + 2, Length(Title) - Length(PREFIX));
if (Title <> '') AND (Artist <> '') then
SetRuntimeData('LogTitle', Artist + ' - ' + Title);
end;
end;
begin
end.
Note that two seconds after starting an item the next item’s metadata will be cached and logged with the start of this next item. This is to sort out said timing issues. This will ignore the first item in playout. You might fix that by starting the playout with a jingle.
@Torben: Were it possible to implement a real delay in logging, not only the delayed send-out as it is now? This would sort out most of the problems involving data manipulation before logging.
Don’t really understand the question. There is a “Delay” setting in every single log interface. What’s the difference between a “real” delay and a “send-out” delay?
Not quite. In log-to-a-file there isn’t.
It seems that the metadata to be logged is gathered at the very start of the item, irrespective of any delay set in the configuration. So if logging takes place the script (which changes the title string in this case) is literally the hedgehog because the hare-like logger has done its task already, even if you had set a logging delay before.
I had experienced this very behaviour before in another application where a jukbox is to be emulated: The items (stored in a second playlist) are marked with a code, i. e. D4
, to be tracable by the script. Like such they appear in the main playlist, and this is totally intended – the host knows that this is the jukebox title. But on logging this code surely should be removed but that cannot be achieved by the software as yet.
Sorry, you are absolutely right, the delay has only been available for all HTTP-based methods until now, and the evaluation takes place before the delay counter starts.
Anyway, I have just uploaded build 5202 of v7.1 beta, and now the delay setting is available for all methods including files; and evaluation doesn’t take place until the delay has passed, so any last-minute changes done by scripts should now be reflected.
Sooo @xdjorik, as soon as you’re running v7.1 you may want to use this script here:
// To be used with mAirList v7.1 only!
// Set logging delay greater than 0 seconds
const
PREFIX = '##hitintro';
procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer;
OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
var
Title: string;
begin
if NewState = psPlaying then
begin
Title := Item.GetTitle;
if Copy(Title, 1, Length(PREFIX)) = PREFIX then
Title := Copy(Title, Length(PREFIX) + 2, Length(Title) - Length(PREFIX));
Item.SetTitle(Title);
end;
end;
begin
end.
Amazingly simple, Thank you @Torben!
Is it possible to specify different (more than one) prefixes?
That would open a lot of benefits for browsing (b/c you can’t see any comment or remix field in the browser).
*vocalstart
*extendedmix
*12inch
*live
Generally, it is. Would have to sort out an elegant way under the constraints given (i. e. Pascal Script).
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.
Edit: Skipped a superfluent line in the code. If you downloaded before 22-10-08, 08:20 GMT, please reload.