Skip to Content
It is currently August 14th, 2018, 2:23 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: July 16th, 2006, 10:35 pm 
Offline
Senior User
Senior User

Joined: December 17th, 2005, 3:56 pm
Posts: 85
okay can someone post me the whole code there so manny i have no clue which ones i need or what

thanks alot for the sweet code

_________________
~Brian


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2006, 3:46 pm 
Offline
New User
New User

Joined: October 1st, 2005, 8:42 am
Posts: 12
Location: Canada
ya i have the same problem. I have no idea which one the rite code is. So could someone post the FULL edited and revised code here?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 31st, 2006, 5:48 pm 
Offline
Alumni
Alumni

Joined: March 11th, 2003, 1:34 pm
Posts: 9959
Location: Maui, HI
There is no right code.
What are you trying to do and which code post did you try?

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

Image
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 1:32 pm 
Offline
Junior User
Junior User

Joined: October 25th, 2004, 3:14 am
Posts: 74
First time I have been back here in 2 years. Glad to see some users are getting use from this Pal script :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 4:33 pm 
Offline
Senior User
Senior User

Joined: December 17th, 2005, 3:56 pm
Posts: 85
LOL R u the creator?

_________________
~Brian


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 4:52 pm 
Offline
Junior User
Junior User

Joined: October 25th, 2004, 3:14 am
Posts: 74
Yes with a lot of help from FesterHead :-)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2006, 4:54 pm 
Offline
Senior User
Senior User

Joined: December 17th, 2005, 3:56 pm
Posts: 85
LOL... well he didnt really point us in the right direction in this fourm
but hey we still love him lol

xgeek wrote:
Yes with a lot of help from FesterHead :-)

_________________
~Brian


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 6:58 am 
Offline
Senior User
Senior User

Joined: January 13th, 2008, 4:02 pm
Posts: 123
Location: Vancouver BC CANADA
ok I got the Requested By part to work... :) but as for the username part, how can I get that going????

I have this system where users can sign up for my site and when they register it adds to the users table in the mysql SAMDB which I am using with my Sam Broadcaster 4

I added the following to the mysql

Code:
#
#  Table structure for users table
#
DROP TABLE IF EXISTS users;

CREATE TABLE users (
 username varchar(30) primary key,
 password varchar(32),
 userid varchar(32),
 userlevel tinyint(1) unsigned not null,
 email varchar(50),
 timestamp int(11) unsigned not null
);


#
#  Table structure for active users table
#
DROP TABLE IF EXISTS active_users;

CREATE TABLE active_users (
 username varchar(30) primary key,
 timestamp int(11) unsigned not null
);


#
#  Table structure for active guests table
#
DROP TABLE IF EXISTS active_guests;

CREATE TABLE active_guests (
 ip varchar(15) primary key,
 timestamp int(11) unsigned not null
);


#
#  Table structure for banned users table
#
DROP TABLE IF EXISTS banned_users;

CREATE TABLE banned_users (
 username varchar(30) primary key,
 timestamp int(11) unsigned not null
);


now to use the info inside PHP it uses

$user $pass and $email

so I wanna take the $user and use it with this PAL[/code]

_________________
SAM BROADCASTER: 4.7.4 (Windows 7 64bit Ultimate)
MySQL: 5.0.81 (localhost)

A proud licensed SAM user since June 2008


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 1:07 pm 
Offline
Alumni
Alumni

Joined: March 11th, 2003, 1:34 pm
Posts: 9959
Location: Maui, HI
Are you storing the user attribute(s) along with the requestid in the requestlist or other table?

In other words; How does your system know that a user X has made a request?

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

Image
Image


Top
 Profile  
Reply with quote  
PostPosted: February 13th, 2008, 3:43 pm 
Offline
SVS Member
SVS Member

Joined: September 11th, 2004, 1:51 pm
Posts: 664
Location: PA
Quote:
Xgeek
It works great, but I still have one small problem. And that is with line feeds in the message. For every line feed Winamp displays a square box like a Wingdings font :? .
So I need to work on a parser for Dedication_Message.




Did you ever get this part fixed? Im not sure how to "parse" in order to fix that part... Other than that, its great code....

Just need to get rid of the "wingdings font"... after so many chars it switchs to the funny lookin stuff lol

_________________
Mark L. - SVS (Spacial Volunteer Support)
-------------------------------------------------
DJ Fire - CEO
http://www.crossfire-radio.com


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 10:56 pm 
Offline
Senior User
Senior User

Joined: January 13th, 2008, 4:02 pm
Posts: 123
Location: Vancouver BC CANADA
FesterHead i'm new to PHP and PAL so I wouldn't have a clue what you just said :(

All I know is that I am using the samPHPweb and the pal script on page 1 of this thread, you can see my site at http://www.geeksonfraser.com/radio

I am still working out a bug in my register setup so that might not work for a few min

_________________
SAM BROADCASTER: 4.7.4 (Windows 7 64bit Ultimate)
MySQL: 5.0.81 (localhost)

A proud licensed SAM user since June 2008


Top
 Profile  
Reply with quote  
PostPosted: November 12th, 2008, 2:17 am 
Offline
Junior User
Junior User

Joined: October 4th, 2008, 12:35 pm
Posts: 39
Location: Kaufbeuren, Germany
I recently found it necessary to add dedication info to some client's stream, so I've come up with yet another version of Xgeek's script. This one also tries to address the »control character/linefeed« problem and the damn shoutCAST »password shown« bug that they didn't fix since shoutCAST v1.9.2 … :x

Here goes, just in case anyone might need it:
Code:
// Requests on Stream.pal
// 2008-11-12 v1.0 Moonbase
// based on Xgeek's "Inject Request Dedication.pal" v0.05, 2004-11-12
PAL.LockExecution;
PAL.Loop := True;

// Instantiate a Song Info object
var Song: TSongInfo = TSongInfo.Create;
var dedicationText: String = '';

// Check if current song is a request
if ((ActivePlayer.GetSongInfo['requestID']) > 0) then
begin
  var reqInfo: TDataSet = Query('SELECT name, msg FROM requestlist WHERE id = ' + ActivePlayer.GetSongInfo['requestID'], [], true);
  var requestBy: String = reqInfo['name'];
  var dedicationMsg : String = reqInfo['msg'];
  reqInfo.Free;
  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)
  for i := 1 to 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;
  end;

  // build addistional info string
  addStr := ' [Request';
  if (requestBy > '') then
  begin
    // we have requester's name
    addStr := addStr + ' von ' + 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);
  Song['artist'] := ActivePlayer.GetSongInfo['artist'];
  newTitle := ActivePlayer.GetSongInfo['title'] + addStr;
  // force maximum length of 150 characters
  // (shoutCAST server shows password since v1.9.2 if > 150 characters!)
  if (Length(Song['artist'] + ' - ' + newTitle) > 150) then
    newTitle := Copy(ActivePlayer.GetSongInfo['title'] + addStr, 1, 146 - Length(Song['artist'])) + '...]';
  Song['title'] := newTitle;
  Encoders.SongChange(Song);
  writeln(Song['artist'] + ' - ' + Song['title']);
end;
 
PAL.UnlockExecution;
// Release data structures
Song.Free;
// Wait for next song to come up
PAL.WaitForPlayCount(1);

Just in case anyone needs to type this: The second character that looks like a blank in
Code:
or ((CompareStr(c, ' ') >= 0)
above is not a blank but a typed-in ALT+0160! (ISO-8859-1 readable characters are #32..#127 and #160..#255.)

N.B.: The length calculation in the code is a) only needed on shoutCAST servers from v1.9.2 up (icecast seem to work correctly), and b) of course only valid if you have set title streaming in SAM to either $combine$ or $artist$ - $title$. Any adjustments should be a snap, though.

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


Top
 Profile  
Reply with quote  
PostPosted: November 12th, 2008, 9:15 am 
Offline
Senior User
Senior User

Joined: May 31st, 2007, 4:13 pm
Posts: 198
Thanks for this, that password bug was annoying me ;)

_________________
www.RockRadio1.Com


Top
 Profile  
Reply with quote  
PostPosted: November 12th, 2008, 7:41 pm 
Offline
Junior User
Junior User

Joined: October 4th, 2008, 12:35 pm
Posts: 39
Location: Kaufbeuren, Germany
I found some potential problems with my above code:
  • It draws info from »ActivePlayer.whatnot« and it can happen (though seldom) that the active player actually changes while we are in the routine. Boom!
  • The »character cleanup« routine had a bug when no dedication was made: A »for« loop in PAL is always executed at least once, even if it goes from 1 to 0! I simply forgot about that. Haven’t done Delphi stuff for quite a while, and PAL is quite a crippled Delphi ;-)
  • Also, some pointers needed checking, because apparently things like »ActivePlayer.GetSongInfo« don’t always return sensible results when for instance no player is active.
So here is the improved version which seems a LOT more stable: I ran it for about 24 hours now while at the same time running several other PALs, like artist liners, request liners, stream adverts, news at top-of-the-hour, event-driven playlist rebuilds and clockwheel changes … it looks quite robust now.

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 := ' [Hörerwunsch'; // ' [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;

Of course you can remove the miscellaneous »writeln()« statements after testing … ;-)

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


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

Joined: May 31st, 2007, 4:13 pm
Posts: 198
Ok, I was going to say that i was getting errors with the first code.


One thing, is it possible to change 'requested von' to 'Requested from' ?


Many thanks


Joe


*Edit: Nevermind, I figured it out. Thanks anyway ;)

_________________
www.RockRadio1.Com


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  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 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