Skip to Content
It is currently June 20th, 2018, 1:06 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
PostPosted: November 13th, 2008, 12:47 pm 
Offline
Junior User
Junior User

Joined: October 4th, 2008, 12:35 pm
Posts: 39
Location: Kaufbeuren, Germany
Yeah, sorry, I left the code »as-is« (i.e., German), in order not to introduce some typos. Lines #47 & 51 are the key (it's in the comment at the right even):

Change
Code:
    addStr := ' [Hörerwunsch'; // ' [Request'
and
Code:
      addStr := addStr + ' von ' + requestBy; // ' by '

to
Code:
    addStr := ' [Request'; // ' [Request'
and
Code:
      addStr := addStr + ' by ' + requestBy; // ' by '

and you’re all set :wink:

_________________
Moonbase: The Problem Solver
I will not give any support for unlicensed or pirated software.


Top
 Profile  
Reply with quote  
PostPosted: November 13th, 2008, 12:57 pm 
Offline
Senior User
Senior User

Joined: May 31st, 2007, 4:13 pm
Posts: 198
Yes, got it last night, thanks.



The pal has been working error free since then, no problems to report at all.




Many thanks

_________________
www.RockRadio1.Com


Top
 Profile  
Reply with quote  
PostPosted: November 13th, 2008, 1:25 pm 
Offline
Junior User
Junior User

Joined: October 4th, 2008, 12:35 pm
Posts: 39
Location: Kaufbeuren, Germany
You’re very welcome, thanks for the feedback!

I usually also try to test things under »stress conditions« but of course one can’t test for each and every kind of setup. So it’s always great to get some feedback.

_________________
Moonbase: The Problem Solver
I will not give any support for unlicensed or pirated software.


Top
 Profile  
Reply with quote  
PostPosted: November 13th, 2008, 1:31 pm 
Offline
Alumni
Alumni

Joined: March 11th, 2003, 1:34 pm
Posts: 9959
Location: Maui, HI
Moonbase wrote:
of course one can’t test for each and every kind of setup. So it’s always great to get some feedback.

Words of wisdom.

_________________
- Steve Kunitzer
- SVS (Spacial Volunteer Support) / Forum Administrator

Image
Image


Top
 Profile  
Reply with quote  
PostPosted: August 2nd, 2010, 10:45 am 
Offline
New User
New User

Joined: August 1st, 2010, 9:25 am
Posts: 4
hi there... how can i add to this script something like in php

Code:
while ($s = mysql_fetch_array( mysq_query("SELECT * FROM requestlist WHERE songID = ActivePlayer.GetSongInfo['ID'] LIMIT 10 ") ))

echo $s['name'].": ".$s['msg']."<br />";


output will be Name: Message x 10

to show multiple names/messages on requests in PAL window


Top
 Profile  
Reply with quote  
PostPosted: December 12th, 2011, 8:02 am 
Offline
Junior User
Junior User

Joined: January 17th, 2010, 8:41 am
Posts: 43
Location: Germany
Is it possible to play a jingle before every request?? I have running an extra Palscript for that, but to gether they will bite each other...request are queued 2 times. I think there's only on line used for that like
Code:
 CAT['hw'].QueueBottom(smLRP,NoRules);   //<----this is the jingle that gets inserted before each requested song
but all my tries fail :(

SKY

_________________
Image
http://www.discofox-aktiv.de


Top
 Profile  
Reply with quote  
PostPosted: December 14th, 2011, 6:24 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7547
Location: Aachen (Germany)
Please post both PALs here, might be an easy task to combine the two.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

We're offering custom PAL / PHP code and general SAM assistance at palscripts.com

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: December 14th, 2011, 6:48 pm 
Offline
Junior User
Junior User

Joined: January 17th, 2010, 8:41 am
Posts: 43
Location: Germany
This one is to Play a Jingle
Code:
PAL.Loop := True;
{PAL.MemoryLeakWarning := True;}
{-->Insert first songs into queue}



PAL.LockExecution;
{-->Insert next request + Jingle if request was found}
var AQuery : TDataSet;
var Song   : TSongInfo;

   AQuery := Query('SELECT songlist.*, requestlist.*, requestlist.ID as requestID '
     +' FROM songlist, requestlist '
     +' WHERE (requestlist.ETA<:now) AND (requestlist.status=''new'') AND (songlist.ID=requestlist.songID) '
     + 'ORDER BY requestlist.ETA ASC '
     +' LIMIT 1 ',[Now],True);

   if not(AQuery.BOF and AQuery.EOF) then
    begin
       {Also Set SAM to leave Requests in the queue}

      {A cool idea would be to insert a jingle here
       that says "The next song is by request" or something similar}
      {For example: Queue.AddFile('c:\.mp3',ipBottom);}


       CAT['hw'].QueueBottom(smLRP,NoRules);   //<----this is the jingle that gets inserted before each requested song


      {Copy the needed information from the dataset}
      Song := TSongInfo.Create();
      Song['ID']         := AQuery['ID'];
      Song['filename']  := AQuery['filename'];
      Song['artist']     := AQuery['artist'];
      Song['title']      := AQuery['title'];
      Song['duration']  := AQuery['duration'];
      Song['requestID'] := AQuery['requestID'];

      {Add request to queue}
      Queue.Add(Song,ipBottom);
      WriteLn('Request handled: '+Song['artist']+' - '+Song['title']);

      {Change status of request}
      ExecSQL('UPDATE requestlist SET status=:status WHERE (songID = :songID) AND ((status=''new'') OR (status=''pending'')) ',['pending',song['ID']]);

   end
   else
     WriteLn('No request found');
PAL.UnLockExecution;
{Wait for songs in queue to play}
AQuery.Free;
Song.Free;
while (Queue.Count > 1) do
PAL.WaitForPlayCount(1);


And this for the dedication:

Code:
// 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 <= Length(dedicationMsg)) do
    begin
      c := CharAt(dedicationMsg, i);
      if (((CompareStr(c, ' ') >= 0) and (CompareStr(c, '~') <= 0)) or ((CompareStr(c, ' ') >= 0) and (CompareStr(c, 'ÿ') <= 0))) then
        dedicationText := dedicationText + c;
      i := i + 1;
    end;

    // build additional request info string
    addStr := ' [Hoererwunsch'; // ' [Request'
    if (requestBy > '') then
    begin
      // we have requester's name
      addStr := addStr + ' von ' + requestBy; // ' by '
      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;

_________________
Image
http://www.discofox-aktiv.de


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group