Skip to Content
It is currently February 26th, 2021, 9:59 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: June 9th, 2020, 3:43 pm 
Offline
New User
New User

Joined: June 3rd, 2020, 2:02 am
Posts: 16
Hi there,
Its working! the live DJ is added to the Que, and starts playing when the current song is finished.
so far so good. The scripts checks the relay number and if it's active it adds it to the que.

*Situation: We have sam running as AutoDJ, We have 8 DJs, every dj has his own mountpoint.
/me,/you, /etc.
So the first relaynumber is :
  1. url:port/me #0
  2. url:port/you #1
  3. url:port/etc #2
and so on.
Is it possible that the script checks what relay is active in one palscript? (0,1,2,3,4,5,6,7)
I have 8 palscripts running now doing the same thing. and that gives me some hickups.

This is the code im using at the moment.
Code:
// =================================================================================================================================
// - Geef de stream bij 'song info' als type : 'C'  ( = Unknown Content) - Add  the stream to the tracks and give in the type C
// - Zorg dat de stream die gecheckt moet worden bij "statistic relay" ingevuld staat! het ip nummer en poortnr - make sure that the stream is added in static relay.
// - De nummering van statistic relay begint bij 0 in dit script gaan we er van uit dat de  statistic relay als eerste staat. - the static relay counts starts at 0
// - als 2e statistic relay dan moet je in dit script bij "statistic relay nummer" de 0 veranderen in een 1 - So the 2nd relay should be changed into 1 instead of 0
// =================================================================================================================================


pal.Loop:=True;
var I : Integer;
var SongA : TsongInfo;
SongA := Activeplayer.GetSonginfo();
PAL.LockExecution;
I := 6; //  relaynumber! (#) 1 is 0  !!!!
begin;
    WriteStr('Relay number '); WriteLn(I);
    WriteStr('--Active: '); WriteLn(Relays[I].Active);
//    WriteStr('--Status: '); WriteLn(Relays[I].Status);
  end;
PAL.UnlockExecution;
If Relays[I].Active = False or (SongA['songtype'] = 'C') then
//do nothing

Else
Queue.Clear;
If Relays[I].Active = False or (SongA['songtype'] = 'C') then
//do nothing

Else
Queue.AddUrl('http://addurl:port/mountpoint',ipTop); // IP + poort van stream die gestart moet worden. -the url that needs to be added
PAL.WaitForTime(T['+00:00:05']);
 If Relays[I].Active = False or (SongA['songtype'] = 'C') then
//do nothing


Else
PAL.WaitForPlayCount(1);  // Stream is in de queue !!! Wacht 1 plaat - stream is added to que, wait 1 song.
If Relays[I].Active = False or (SongA['songtype'] = 'C') then


else
PAL.WaitForPlayCount(1);  // Stream is aan het spelen !!! Wacht tot stream stopt ... - stream is playing ! wait till stream stops


SongA.Free;
PAL.WaitForTime(T['XX:XX:30']);
Pal.LockExecution;

I hope there is someone that could help me out with this.
thanks in advance.

Robert


Top
 Profile  
Reply with quote  
PostPosted: June 9th, 2020, 8:03 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8152
Location: Cologne (Germany)
You could have each of your scripts save to a status file when they're active and delete the status file when they go inactive again.
If all scripts write to the same status file you can check if ANY of the other scripts is active at the moment and if you have each script write into their own status file you can check whether one specific other script is active at the moment.

Code:
IF NOT SetCurrentDir('C:\sam-song.info') THEN
  BEGIN
    CreateDir('C:\sam-song.info');
    SetCurrentDir('C:\sam-song.info');
  END;
...
IF FileExists('/**FB_TWEET**/-debug.log') THEN
      AppendStringToFile('/**FB_TWEET**/-debug.log', msg)
    ELSE
      SaveStringToFile('/**FB_TWEET**/-debug.log', msg);


This is an excerpt from one of my more complex scripts and it showcases two things:
#1 It sets a working directory so you don't have to put an absolute path into your scripts and have a clean folder structure guaranteed. In this case it checks if the C:\sam-song.info folder exists and if not creates it.
#2 It then checks if there is a file named /**FB_TWEET**/-debug.log in that folder. If there is already a file, it will append to that file (this is from a logging function, you'd probably want to stop your script or wait for another few minutes and try again in this situation). If there is no file it creates it using SaveStringToFile (in your case this is where your script would continue as described now)

I think Deleting Files is the DeleteFile command, but I'm not 100% sure. Please check with the PAL Reference which Delete command will delete a file and which one is for deleting characters from a string.

Again, this is only showcasing the functionality. You'd have to build your own logic from these functions.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 30 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:  
cron
Powered by phpBB® Forum Software © phpBB Group