AmericaTV Script v.95b
by norxh
- Grab, parse, and store customized data for any channels anywhere in America and Canada.
- Uses minimal bandwith since you only download the channels you want.
- Display cached data until it necessary to access the net again, which is
by default only once every few hours.
- Display the current and next program for as many channels as you want.
- Easy to setup, no script editing. Configuration GUI.
- Easy to use output. The Activescript return displays status and error messages. Channel, time, show title, episode information and show progress is put into text files for easy use in your config.
Everything in this script is my own work. If you decide to use
some code snippets from this script or modify it to suit another project, that
is fine with me. Just let me know about it and give me credit where it is due.
If you are upgrading from .906b or earlier: Delete every AmericaTV file in yours Samurize\scripts directory. Follow the instructions below.
If you are upgrading from .920b: Run the new config app and click uninstall. Then follow the instructions below.
- Prepare: Time Zone
First you should verify that you timezone settings are correct. Goto the Control
Panel then open the Date and Time properties. Select the Time
Zone tab, make sure your proper time zone is selected and that the box
next to Automatically adjust clock for daylight saving changes is
checked. Go back to the Date & Time tab. Make sure your time
and date are still correct.
- Prepare: AntiScript
Make sure you are not using any script blocking/antivirus software that will
interfere with the scripts operation. Some people actually have this software
and don't know it. Note, if you have Norton Antivirus, you may have script
blocking. Double click the Antivirus icon in the system tray and disable script
blocking if it is not already.
If you have firewall software make sure Samurize's client.exe and config.exe
get internet access.
- Zap2it Data Direct: Signup
Click here. Click Sign Up. Accept the agreement and fill in your info and Submit. Use a real email address! They will ask you to login once every few months to validate your subscription. For the certificate code use ZIYN-DQZO-SBUT. Click Add a lineup. Go through the process. On the last page you can select the channels you will want on your desktop and click finish. You should only select the channels you want, it will save bandwidth, time and memory.
- Script: Settings
Run the configuration application "ConfigureAmericaTV.hta".
- Zap2It Data Direct user/pass
Put in your Zap2it Data Direct user and password for the account you just setup. Wierd things can happen if these are wrong.
- Maximum future data fetch
This is how far forward (in hours) the script will look for the next show. The default value should be fine. If you have a channel with very long shows, you may see next show reported as Unknown; then you should increase this number.
- Data to get per fetch
This is how much data (in hours) the script will grab in each request when more data is needed.
- Truncate length of current/next show
The number of characters at which the current title and next title are truncated respectively. Titles that
are truncated will have ellipsis appended.
- Show channel number on the current show lines
The channel number will be prepended to each line in the current show file.
- Show episode info
This allows you to display the episode specific information if it is available. If you choose "on current show line", it will
be appended to each line in the current show file, seperated from the title by a colon. If you choose "in another file", each episode title
will be placed on a line in another file, "AmericaTV.meter-episode.txt".
- Trap unhandled errors
This setting is on by default and should be left on unless you need exceptions to trickle out of the script; this is useful for debugging.
- Samurize: Setup
Move the script in to your Samurize scripts folder and add an Activescript meter and set the type to text. Select "AmericanTV.js" as the script, and "samurizeMain" as the function, then click test script. If all goes properly you should see some status messages, and in the end... "CreateMeters completed successfully." I recommend setting this Activescript to run about every one or two minutes. Note that this is not the interval that the script updates from the internet, just how often Samurize requests the script updates its text files.
You should end up with four or five files in your AmericaTV folder:
- AmericaTV.data
- AmericaTV.meter-current.txt
- AmericaTV.meter-next.txt
- AmericaTV.meter-progress.txt
- AmericaTV.meter-episode.txt (optional)
Your AmericaTV folder is located at:
- Windows 2000/XP: [System Drive]:\Documents and Settings\[Your user name]\Application Data\AmericaTV *
- Windows 98/ME: [System Drive]:\WINDOWS\Application Data\AmericaTV\
or [System Drive]:\WINDOWS\Profiles\[Your user name]\Application Data\AmericaTV\
* A very easy way to access the "Application Data" folder from a My Computer window or a file open dialog is to just type "%APPDATA%" without the quotes in to the address bar or file name text box respectively and hit enter.
* If you want to navigate to it the old fashioned way and can't see the "Application Data" folder in your user folder it is because it is hidden. You can either type it directly into the address bar in My Computer or enable viewing of hidden folders by clicking Tools > Folder Options > View and then checking "Show hidden files and folders".
There are a million way you could set up your config to display tv data. To get started...
- Create text file meters for the -current and -next txt files.
- Set each of the two meters' 'number of lines' property to the number of channels you want to display.
- Create a text file meter for each channel and point them all to the -progress txt file.
- Set all the progress meters to progressbar or pie type and set their 'min' and 'max' values to 0 and 100 respectively.
- For each progress meter, set the 'number of lines' property to 1 and set the 'read line' property to number of one of your channels as they appear in your -current and -next txt files. I.e. The 3rd channel listed in current.txt will be line number 3 in the progress txt file.
- You: Enjoy!
- I get an error/I'm not getting any data.
- Are you sure about Steps 1 and 2? Is there any helpful messages in the Activescript output?
- I don't understand the last step/I need help configuring Samurize.
- You'll need to understand Samurize basics of creating meters and configs. There is plenty of information in Samurize Visual Tutorial, Samurize 1.0.1 Visual Tutorial, and the forums.
- I get an error about MSXML.
- I dont think anyone will have this problem; MSDN says that MSXML3.0 comes with all current versions of Windows. But just in case, try to download and run the MSXML 3.0 SP4 .msi file from Microsoft.
- This isn't helping.
- Send me an email (see the contact section). Make sure to put "Regarding AmericaTV" in the subject or the mail may be discarded; I get a lot of spam at this address and I don't go through it. Also, don't use words like penis, viagra, or anal. :)
If you want to customize the output any further you will have
to edit some basic JScript. It is not very difficult and you can find lots of
information here.
I have commented the section you will need to edit. It starts like this...
*createMeters function
You can find more information in the comments in the script. I tried to keep the createMeters function very easy understand (or at least more so than the rest of the script :).
- Where can I get a good set of channel logos?
- The most complete icon set with consistent quality that I have found is the one from GUIFX.
- How can I create the ring around the logo effect like in the screenshot?
- You'll need to edit the logos in your favorite image editor so they are a nice circle shape and export them to 32bit PNGs. Then add the logos to your config with the Add 32bit PNG command on the Edit Graphics tab.
To turn your progress meters in to rings, set them to pie type and increase their Inner Radius properties to something around 80%. Then position them on top of the logos. Finally set the Start Angle property to 90 and the Sweep property to -360.
I hate programs that leave registry keys and other garbage around my system. AmericaTV is 100% uninstallable. Just click Uninstall in the config applet, then delete the applet itself, this readme, and the script.
If you have suggestions or questions, contact me at norxh@binnews.com. Please make sure that your question are about AmericaTV and not Samurize! I'm sorry I don't have time to answer all the emails asking how to make configs for Samurize.
- 0.95b 2005-09-13
- Many documentation updates.
- Fixed a big problem with channels showing as "Unknown" when they shouldn't. I tested many different lineups, they are all completely accurate for me now.
- Changed the sorting (or added any sorting at all rather :) so that channels are listed in proper numerical order.
- Added option to not trap unhandled runtime exceptions.
- Added parsing of SOAP faults. If the data source returns a SOAP fault, its helpful description will be show in the Activescript output.
- Added uninstall to the config app.
- 0.920b 2004-09-20
- *Major Update* Backend completely converted to Zap2It Data Direct. No more web page scraping. The XML data is working
quite well.
- Removed prefetch setting. No longer needed; the XML will show the current program even if it started out of the requested range.
- Added show channel number option.
- Added show episode info option. Can be shown on current show line or in another file.
- Changed data storage location to user's application data folder per Microsoft guidelines.
- Moved all variables to registry. No more editing the script.
- Added a configuration GUI.
- 0.906b 2004-05-13
- Updated the regex that finds the rows to handle the new junk rows in the data.
- Made link to screenshot on the site in the readme and removed the big image from the zip.
- 0.905b 2004-04-27
- Added Internet Explorer user-agent which Zap2It might want.
- 0.904b 2004-03-04
- Fixed bug: Script halted with "Unhandled Error: (10/5007)" if you had more than about twenty channels.
- Added FAQ section to readme.
- 0.903b 2004-02-20
- Fixed bug: If the data file was deleted the script would not reset even if the reset variable was set to true.
- Upated docs with a little more detail on setting up the meters in Samurize.
- 0.902b 2004-02-07
- 0.901b 2004-02-07
- Added option to truncate titles to specified # of characters.
- Fixed a bug: if you had no nothing new in one pull, it could potentially keep pulling the same time over and over.
- Fixed bug in channelQueue's getLowestCurrentLine that prevented old data from being deleted.
- Updated readme for new variables and upgrade information.
- 0.90b 2004-02-06
- *Complete rewrite* This is pretty much a completely new script.
- Name changed from "TV America" to "AmericaTV" which fits the more common tv script nomenclature found in the Samurize download section.
- Script now uses WinHTTP. Does not require you to be logged in with Internet Explorer unlike the 0.8* versions.
- Updated screenshots and documentation.
- Does not crash with show titles with high ascii characters unlike the 0.8* versions.
- Now catches most common errors and directs them to the Activescript output.
- This script has a homepage now at http://norxh.us/AmericaTV/.
- 0.83b 2003-04-24
- Changed documentation, completely rewritten.
- Changed documentation, now in html form.
- Added more comments to script.
- Added 12 hour time option.
- Added extra info option.
- 0.82b 2003-04-08
- Fixed Daylight Savings Time bug, again.
- Added a config var called "timeOffset".
- 0.81b 2003-04-07
- Fixed Daylight Savings Time bug.
- Changed getCurrentData func to only attempt to get a session
on the first request. If any other requests are necessary it will use
the same session.
- Changed script name in configs to tv.js.
- 0.80b 2003-04-06