Aller au contenu

Problème de cpu avec mes script pal pour Sam3 :besoin d'aide


radiochris

Messages recommandés

Bonjour,

Je sais qu'il y a des centaines de personnes qui utilisent sam3, j'espere qu'il y en aura au moins qui aura la gentilesse de bien vouloir enfin m'aider a trouver une solution.

J'ai créé 9 script pal sous sam3, et bien en les lancant les 9 à la fois, sam3 bloque mon cpu au bout d'une heure, je vous fournis mes scripts ci-dessous en esperant qu'un génie puisse m'aider à corriger ma compilation.....

Merci d'avance a tous.

//PROGRAMMATION AUTOMATISE DU LUNDI

//

// Cree pour par Chris

PAL.Loop := True;

PAL.LockExecution;

{ DEBUT DE JOURNEE }

{--------------------------------------------------}

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

{ VERIFICATION DU JOUR EN COURS }

{--------------------------------------------------}

While (Now

begin

Queue.Clear;

{ PROTECTION POUR LE DEBUT DE JOURNEE }

{--------------------------------------------------}

While (Now

begin

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

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

{DEBUT DE JOURNEE}

{--------------------------------------------------}

While (Now=T['00:00:31']) and (DayOfWeek(Now) = Monday) do

Queue.Clear;

CAT['TOP40'].QueueTop(smLemmingLogic, EnforceRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

var Song : TSongInfo;

Song := TSongInfo.Create;

Song['artist'] := 'Generation';

Song['title'] := 'TOP 40';

Song['duration'] := 180*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ PREMIERE SESSION }

{ TOP40 de 00h00 à 03h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['TOP40'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['03:00:31']) and (DayOfWeek(Now) = Monday) do

Queue.Clear;

CAT['FRENCH'].QueueTop(smLemmingLogic, EnforceRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'La Journée';

Song['title'] := '100 % France';

Song['duration'] := 840*60*1000; {14 heures}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ DEUXIEME SESSION }

{ FRENCH de 03h00 à 17h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['FRENCH'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

//LANCE LE JOURNAL DE 7 ET 8 HEURES

While (Now>T['07:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%201.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['FRENCH'].QueueTop(smLemmingLogic, EnforceRules);

end;

While (Now>T['08:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%202.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['FRENCH'].QueueTop(smLemmingLogic, EnforceRules);

end;

//FIN DES JT

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['17:00:31']) and (DayOfWeek(Now) = Monday) do

Queue.Clear;

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'Le son';

Song['title'] := ' !';

Song['duration'] := 240*60*1000; {4 heures}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ TROISIEME SESSION }

{ Music (All) de 17h00 à 21h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

//LANCE LE JOURNAL DE 18 ET 20 HEURES

While (Now>T['18:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%203.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

While (Now>T['20:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%204.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

//FIN DES JT

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['21:00:31']) and (DayOfWeek(Now) = Monday) do

Queue.Clear;

CAT['INTRO'].QueueTop(smLemmingLogic, NoRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'Tekno6tem';

Song['title'] := ' GreG Le DJ !';

Song['duration'] := 180*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ emission type voice track }

{ TECHNOSYSTEM de 21h00 à 00h00 }

{--------------------------------------------------}

While (Now

begin

CAT['TECHNOSYSTEM'].QueueTop(smLemmingLogic, NoRules);

end;

While (Now

Queue.Clear;

While (Now

begin

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

CAT['TECHNO'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

end;

{FIN DU SCRIPT/ FIN DE VERIFICATION}

{--------------------------------------------------}

end;

PAL.UnlockExecution;

PAL.WaitForTime('23:59:59');

//PROGRAMMATION AUTOMATISE DU MARDI

//

// Cree pour par Chris

PAL.Loop := True;

PAL.LockExecution;

{ DEBUT DE JOURNEE }

{--------------------------------------------------}

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

{ VERIFICATION DU JOUR EN COURS }

{--------------------------------------------------}

While (Now

begin

Queue.Clear;

{ PROTECTION POUR LE DEBUT DE JOURNEE }

{--------------------------------------------------}

While (Now

begin

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

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

{DEBUT DE JOURNEE}

{--------------------------------------------------}

While (Now=T['00:00:31']) and (DayOfWeek(Now) = Tuesday) do

Queue.Clear;

CAT['TOP40'].QueueTop(smLemmingLogic, EnforceRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

var Song : TSongInfo;

Song := TSongInfo.Create;

Song['artist'] := 'Generation';

Song['title'] := 'TOP 40';

Song['duration'] := 180*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ PREMIERE SESSION }

{ TOP40 de 00h00 à 03h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['TOP40'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['03:00:31']) and (DayOfWeek(Now) = Tuesday) do

Queue.Clear;

CAT['DISCO80'].QueueTop(smLemmingLogic, EnforceRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'La Journée';

Song['title'] := 'Disco et 80s';

Song['duration'] := 840*60*1000; {14 heures}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ DEUXIEME SESSION }

{ DISCO80 de 03h00 à 17h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['DISCO80'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

//LANCE LE JOURNAL DE 7 ET 8 HEURES

While (Now>T['07:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%201.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['DISCO80'].QueueTop(smLemmingLogic, EnforceRules);

end;

While (Now>T['08:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%202.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['DISCO80'].QueueTop(smLemmingLogic, EnforceRules);

end;

//FIN DES JT

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['17:00:31']) and (DayOfWeek(Now) = Tuesday) do

Queue.Clear;

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'Le son';

Song['title'] := ' !';

Song['duration'] := 240*60*1000; {4 heures}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ TROISIEME SESSION }

{ Music (All) de 17h00 à 21h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

//LANCE LE JOURNAL DE 18 ET 20 HEURES

While (Now>T['18:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%203.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

While (Now>T['20:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%204.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

//FIN DES JT

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['21:00:31']) and (DayOfWeek(Now) = Tuesday) do

Queue.Clear;

CAT['INTRO'].QueueTop(smLemmingLogic, NoRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'GeT';

Song['title'] := 'de 21h00 à 23h00 ! ';

Song['duration'] := 120*60*1000; {2 heures}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ emission GeT de 21h00 à 23h00 }

{--------------------------------------------------}

While (Now

begin

var T : Integer;

Queue.AddURL('http://localhost:8000/',ipTop);

{Precautions - if there is a brief disconnect or server problem,

then we would want to retry a few times to get back to the show.

To do this we place the URL quite a few times in the queue, followed

by some normal programming. That way we will try and reconnect until

the end of the show}

T := 0;

while T < 5 do

begin

Queue.AddURL('http://localhost:8000/',ipBottom);

CAT['Music (All)'].QueueBottom(smLemmingLogic,EnforceRules);

T := T + 1;

end;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'GeT';

Song['title'] := 'de 21h00 à 23h00 ! ';

Song['duration'] := 120*60*1000; {2 heures}

Encoders.SongChange(Song);

Song.Free;

end;

{ FIN DE L'EMISSION }

{--------------------------------------------------}

While (Now

Queue.Clear;

{Modify stream title show}

CAT['TECHNO'].QueueTop(smLemmingLogic, NoRules);

ActivePlayer.FadeToNext;

Song := TSongInfo.Create;

Song['artist'] := 'Le son';

Song['title'] := 'Des DeeJayS ! ';

Song['duration'] := 120*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ QUATRIEME SESSION }

{ TECHNO de 23h00 à 00h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['TECHNO'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

end;

{FIN DU SCRIPT/ FIN DE VERIFICATION}

{--------------------------------------------------}

end;

PAL.UnlockExecution;

PAL.WaitForTime('23:59:59');

//PROGRAMMATION AUTOMATISE DU MERCREDI

//

// Cree pour par Chris

PAL.Loop := True;

PAL.LockExecution;

{ DEBUT DE JOURNEE }

{--------------------------------------------------}

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

{ VERIFICATION DU JOUR EN COURS }

{--------------------------------------------------}

While (Now

begin

Queue.Clear;

{ PROTECTION POUR LE DEBUT DE JOURNEE }

{--------------------------------------------------}

While (Now

begin

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

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

{DEBUT DE JOURNEE}

{--------------------------------------------------}

While (Now=T['00:00:31']) and (DayOfWeek(Now) = Wednesday) do

Queue.Clear;

CAT['TOP40'].QueueTop(smLemmingLogic, EnforceRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

var Song : TSongInfo;

Song := TSongInfo.Create;

Song['artist'] := 'Generation';

Song['title'] := 'TOP 40';

Song['duration'] := 180*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ PREMIERE SESSION }

{ TOP40 de 00h00 à 03h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['TOP40'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['03:00:31']) and (DayOfWeek(Now) = Wednesday) do

Queue.Clear;

CAT['POPROCK'].QueueTop(smLemmingLogic, NoRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'La Journée';

Song['title'] := '100 % POP ROCK';

Song['duration'] := 840*60*1000; {14 heures}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ DEUXIEME SESSION }

{ POPROCK de 03h00 à 17h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['POPROCK'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

//LANCE LE JOURNAL DE 7 ET 8 HEURES

While (Now>T['07:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%201.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['POPROCK'].QueueTop(smLemmingLogic, EnforceRules);

end;

While (Now>T['08:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%202.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['POPROCK'].QueueTop(smLemmingLogic, EnforceRules);

end;

//FIN DES JT

end;

{ FIN DE LA SESSION }

{--------------------------------------------------}

While (Now=T['17:00:31']) and (DayOfWeek(Now) = Wednesday) do

Queue.Clear;

CAT['INTRO'].QueueTop(smLemmingLogic, NoRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'Le son';

Song['title'] := 'Le By Lorenzo !';

Song['duration'] := 180*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ Emission Lorenzo de 17h00 à 19h00}

{--------------------------------------------------}

While (Now

begin

var T : Integer;

Queue.AddURL('http://localhost:8000/',ipTop);

{Precautions - if there is a brief disconnect or server problem,

then we would want to retry a few times to get back to the show.

To do this we place the URL quite a few times in the queue, followed

by some normal programming. That way we will try and reconnect until

the end of the show}

T := 0;

while T < 5 do

begin

Queue.AddURL('http://localhost:8000/',ipBottom);

CAT['Music (All)'].QueueBottom(smLemmingLogic,EnforceRules);

T := T + 1;

end;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'www..fr - Votre Generation !';

Song['title'] := 'Le By Lorenzo ! ';

Song['duration'] := 120*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

end;

{ FIN DE L'EMISSION }

{--------------------------------------------------}

While (Now

Queue.Clear;

{Modify stream title show}

CAT['Music (All)'].QueueTop(smLemmingLogic, NoRules);

ActivePlayer.FadeToNext;

Song := TSongInfo.Create;

Song['artist'] := 'Le son';

Song['title'] := ' ! ';

Song['duration'] := 120*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ TROISIEME SESSION }

{ Music (All) de 19h00 à 21h00 }

{--------------------------------------------------}

While (Now

begin

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

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

//LANCE LE JOURNAL 20 HEURES

While (Now>T['20:02:00']) and (Now

begin

Queue.clear;

Queue.AddURL('http://mastersound69.jexiste.fr/spip/sons/jgls%204.mp3',ipTop);

Activeplayer.FadeToNext;

CAT['Music (All)'].QueueTop(smLemmingLogic, EnforceRules);

end;

//FIN DES JT

end;

{ FIN DE L'EMISSION }

{--------------------------------------------------}

While (Now=T['21:00:31']) and (DayOfWeek(Now) = Wednesday) do

Queue.Clear;

CAT['INTRO'].QueueTop(smLemmingLogic, NoRules);

ActivePlayer.FadeToNext;

{Modify stream title show}

Song := TSongInfo.Create;

Song['artist'] := 'DJ';

Song['title'] := 'TASMY !';

Song['duration'] := 180*60*1000; {180 minutes}

Encoders.SongChange(Song);

Song.Free;

Queue.Clear;

{ emission voicetrack DJ TASMY de 21h00 à 00h00}

{--------------------------------------------------}

While (Now

begin

CAT['TASMY'].QueueTop(smLemmingLogic, NoRules);

end;

While (Now

Queue.Clear;

While (Now

begin

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

CAT['TECHNO'].QueueTop(smLemmingLogic, EnforceRules);

Queue.shuffle;

end;

{FIN DU SCRIPT/ FIN DE VERIFICATION}

{--------------------------------------------------}

end;

PAL.UnlockExecution;

PAL.WaitForTime('23:59:59');

{ Configuration du script }

{--------------------------------------------------}

var P1, P2 : TPlayer;

var i : integer;

var Song : TSongInfo;

//FONCTIONS DU SCRIPT

// Identifie le player actif

// Met un jingle tophoraire sur le deuxième player

// Reduit le volume du 1er player et joue le jingle tophoraire

// Une fois le tophoraire joué, il retabli le volume du 1er player

//

// Cree pour

PAL.loop := true;

PAL.LockExecution;

PAL.WaitForTime('NextHour');

P1 := ActivePlayer;

// Memorise le volume du player actif

i := ActivePlayer.GetVolume;

//Writeln ('Volume set to: '+IntToStr(i));

// detecte le player inactif et insere un jingle tophoraire

P2 := IdlePlayer;

IdlePlayer.Volume := i;

if P2 <> nil then

Song := CAT['TOPHORAIRE'].ChooseSong(smLRP,NoRules);

if Song <> nil then P2.QueueSong(Song);

// Reduis le volume du player de 50%

// Divisez par 3 pour 33%, etc.

//ActivePlayer.Volume := i / 2;

//Met le player active en pause de facon douce

ActivePlayer.FadeToPause;

P2.play;

//Attend que le jingle tophoraire soit finis

repeat

// writeln(inttostr(p2.status));

until P2.status = psReady;

// Retabli le niveau origine du player actif

ActivePlayer.Volume := i;

PAL.UnlockExecution;

//FONCTIONS DU SCRIPT

// Joue un jingle au hasard tous les 4 morceaux

//

// Cree pour

{ Configuration du script }

{--------------------------------------------------}

var P1, P2 : TPlayer;

var i : integer;

var Song : TSongInfo;

PAL.Loop := True;

PAL.LockExecution;

PAL.WaitForPlayCount(4);

// detecte le player inactif et insere un jingle tophoraire

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

P2 := IdlePlayer;

if P2 <> nil then

Song := CAT['JGLS'].ChooseSong(smLRP,NoRules);

if Song <> nil then P2.QueueSong(Song);

PAL.UnlockExecution;

Lien vers le commentaire
Partager sur d’autres sites

bonjour,

j'ai regardé vite ton code mais je m'apercois qu'il y a bcp de "While ... do" suivi dans la boucle "begin ... end" d'un "PAL.WaitforTime..".

Saches que la fonction "While ... do" crée une boucle et tant que la condition n'est pas atteinte, cette boucle utilise énormément de ressource CPU donc logique que ton CPU sature au bout d'une heure.

je te conseille de lancer tes scripts via l'event scheduler l'heure précédent le début de l'émission que tu gères via tes scripts. ton CPU en sera des plus reconnaissants!!!

Lien vers le commentaire
Partager sur d’autres sites

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

×
×
  • Créer...