Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 2.35 KB | None | 0 0
  1. { ABOUT:
  2.     Script to change title displayed in listener's streaming player.
  3.     This script will read a banner text source file to get a list of
  4.     messages to display, then switch between the normal song information
  5.     and the banner text on regular intervals.
  6.    
  7.     Not only does this make for a more interesting experience for listeners,
  8.     it also prevents stream rippers from being able to make copies of your
  9.     tracks.
  10.    
  11.   USAGE:
  12.     a) Create a normal plain text file and type your banner messages into this file.
  13.        Each new line should contain one new banner message.
  14.     b) Change the configuration settings below to point to your file and
  15.        specify the interval to wait between changes.
  16. }
  17.    
  18. { CONFIGURATION }
  19. {==================================================}
  20. const bannertext_file = 'C:\Program Files\SpacialAudio\SAMBC\PAL\BannerText.txt';
  21. const change_interval = '+00:00:15';
  22. {==================================================}
  23.  
  24.  
  25. { IMPLEMENTATION }
  26. {--------------------------------------------------}
  27. var CurSong : TSongInfo;
  28. var UpdSong : TSongInfo;
  29. var Banners : TStringList;
  30. var Toggle  : Boolean = True;
  31. var LinePos : Integer = 0;
  32.  
  33. {Set this script to restart itself}
  34. PAL.Loop := True;
  35.  
  36. { Create some objects that we will need}
  37. UpdSong := TSongInfo.Create;
  38. Banners := TStringList.Create;
  39.  
  40. { Load banner lines into stringlist object }
  41. if FileExists(bannertext_file) then
  42.  Banners.LoadFromFile(bannertext_file)
  43. else
  44.  WriteLn('Banner source file does not exist!');
  45.  
  46. LinePos := 0;
  47. while (LinePos<Banners.Count) do
  48. begin
  49.   {Wait for specified time}
  50.   PAL.WaitForTime(change_interval);
  51.  
  52.   {Retrieve the current banner line and assign it to song object}
  53.   UpdSong['title'] := Banners[LinePos];
  54.  
  55.   {Tell encoders to update song information:
  56.     When Toggle is True, we use the normal song information from
  57.     the active player - otherwise we use our banner song object
  58.   }
  59.   Toggle := not Toggle;
  60.   if Toggle then
  61.    begin
  62.     CurSong := ActivePlayer.GetSongInfo;
  63.      Encoders.SongChange(CurSong);
  64.     CurSong.Free;
  65.    end
  66.   else
  67.     Encoders.SongChange(UpdSong);
  68.  
  69.   {Move to the next line in the banner file before we continue}
  70.   LinePos := LinePos + 1;
  71. end;
  72.  
  73. {Destroy objects once we no longer need them}
  74. Banners.Free;
  75. UpdSong.Free;
  76. {--------------------------------------------------}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement