Tuesday, October 19, 2010

Using WindowsTask Manager to schedule starting / ending a live stream

If you are like me, you listen to online streaming on a regular basis.  Maybe there is a certain live program you want to listen to but always forget about it until it's over.  Or maybe you want the live stream to start playing before you get home.  Here is a quick and easy way to set it up on your PC.  I'll also include instructions on how to stop the stream if you desire to end it after a certain amount of time.

You will need to create a start batch (.bat) file.  It is very simple to create and is only two lines long.  Open Notepad  and include the following: 


@echo off
 
 start   realplay.exe   http://kbaq.org:8080/livestream/connect_high.ram

Replace the URL with the URL of the stream you want to play.  Substitute realplay.exe with whatever player you are using (IE: winamp.exe)  You can use the example URL for testing purposes if you are using real audio as your player (it is a classical station real audio stream)  You will need another URL for testing with another player.  Save the file as .bat in a permanent location.  Name it something like start including the call letters of the radio station if you wish (IE:  KBAQ start.bat
Double clicking on the file will open real player and start playing the stream. 

I'll first give you the code for the .bat file to close down the player before I show you how to schedule the playing and the stopping of the stream.

To stop / end the player, place the following two lines in Notepad:

 @echo off

taskkill /im      realplay.exe



Save the file in a permanent location (best to keep it in the same folder as your start .bat file but not necessary)  You can name it something like real audio kill.bat.  Make sure if you use another player that it is in the stop file instead of realplay.exe.

 Next we will want to schedule the starting / stopping of the live stream.

Open Task Scheduler by clicking  Windows Start button, select All Programs, then AccessoriesSystem Tools and then Task Scheduler

I suggest you create a new folder for your streaming tasks.  It makes them easier to find for editing or disabling.

When the new folder is open (if you choose to use it) then click on Create Basic Task (this is for windows Vista.  May be slightly different in other versions) Give the task a new name.  I use a descriptive name such as KBAQ start.  Go through the steps making sure you change the time to when you want the stream to start and the days you want it to run.  If it is weekdays, choose weekly and then click on the days you want it to run (M-F)   You will want to select Start A Program for the action.  Browse to where the start .bat file is.  Click through to finish.  Simple as that!  Do the same thing to close the player if you desire to stop it at a certain time.  Make sure you select the stop file.

You can create test start and end tasks and make sure everything is working properly which you can delete or disable after testing.  if your computer stays on all the time, this is a handy substitute for an alarm clock.

Microsoft Windows Command-Line Administrator's Pocket Consultant (Pro - Administrator's PC)
Microsoft Windows Command-Line Administrator's Pocket Consultant (Pro - Administrator's PC)

.

No comments:

Post a Comment