Jump to content

Read message request


djrobi

Recommended Posts

Hello I have a problem. Songs on request in PHP are working very well, but my question is how can I read the dedication of the song?

Looking everywhere but no information, once seen as a picture message body was visible in Sam Broadcaster

Link to comment
Share on other sites

I want to see text messages in Sam Broadcaster
It is possible to display the dedication within the PAL editor however that is not a very good solution, the best way is to develop a PHP script which there some posted in the Spacial forums to display upcoming requests and dedications prior to them playing.

http://5280jazz.com/nowplaying_image/5280jazz.png

Rob Oyler

5280 Jazz

Link to comment
Share on other sites

I found a script Pal works very well. shows the message in the editing pal "on the right side script

the script could be useful to someone

 

 

// Requests on Stream.pal// 2008-11-12 v1.1 Moonbase

// Originally based on Xgeek's "Inject Request Dedication.pal" v0.05, 2004-11-12

PAL.LockExecution;

PAL.Loop := True;

 

 

// Instantiate Song Info objects

var curSong: TSongInfo;

var updSong: TSongInfo;

var dedicationText: String = '';

 

 

curSong := TSongInfo.Create;

updSong := TSongInfo.Create;

 

 

// Save info about current song ActivePlayer might change while we work!

curSong := nil;

if (ActivePlayer nil) then

curSong := ActivePlayer.GetSongInfo;

 

 

if (curSong nil) then

begin

// Something is playing, see if it is a request

if (curSong['requestID'] > 0) then

begin

 

 

// we have a request, get requester's name and dedication text (if given)

var reqInfo: TDataSet = Query('SELECT name, msg FROM requestlist WHERE id = ' + curSong['requestID'], [], true); // r/o query

var requestBy: String = reqInfo['name'];

var dedicationMsg: String = reqInfo['msg'];

reqInfo.Free;

writeln(requestBy);

writeln(dedicationMsg);

var i: Integer;

var c: String;

var addStr, newTitle: String;

 

 

// clean up unwanted characters (i.e., line feeds, control characters; leave only ISO-8859-1)

i := 1;

while (i

begin

c := CharAt(dedicationMsg, i);

if (((CompareStr(c, ' ') >= 0) and (CompareStr(c, ' ') = 0) and (CompareStr(c, ' ')

dedicationText := dedicationText + c;

i := i + 1;

end;

 

 

// build addistional info string

addStr := ' ~PAGEIDAUTA -';

if (requestBy > '') then

begin

// we have requester's name

addStr := addStr + ' : ' + requestBy;

if (dedicationText > '') then

// we also have a dedication

addStr := addStr + '"' + dedicationText + '"';

addStr := addStr + '~';

end

else

// requester didn't give his name, we won't show anonymous dedications

addStr := addStr + '~';

 

 

 

 

 

 

writeln(addStr); // debug

updSong['artist'] := curSong['artist'];

newTitle := curSong['title'] + addStr;

// force maximum length of 150 characters

// (shoutCAST server bug: shows password since v1.9.2 if > 150 characters!)

if (Length(updSong['artist'] + '' + newTitle) > 150) then

newTitle := Copy(ActivePlayer.GetSongInfo['title'] + addStr, 1, 146 - Length(updSong['artist'])) + '...';

updSong['title'] := newTitle;

Encoders.SongChange(updSong);

writeln(updSong['artist'] + ' - ' + updSong['title']);

end;

PAL.UnlockExecution;

PAL.WaitForPlayCount(1); // wait until current finished

end

else

begin

// Nothing is playing, wait a while and see again

PAL.UnlockExecution;

PAL.WaitForTime('+00:00:15');

end;

 

 

// Release data structures

curSong.Free;

updSong.Free;

 

 

Link to comment
Share on other sites

That would be the least likely solution I would go with, Keeping the PAL IDE open would lend itself to possible issues, like locking up the broadcast machine if an inadvertent change was made to the running script because of a keystroke not intended etc.

http://5280jazz.com/nowplaying_image/5280jazz.png

Rob Oyler

5280 Jazz

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...