PDA

View Full Version : TV Grid using Girder - Version 2



VaioUserChris
January 30th, 2006, 10:19 PM
Here's a new version of the TV Grid GML (earlier version is here) (http://www.promixis.com/forums/showthread.php?p=75949#post75949) with several improvements including:

1) Improved Navigation
You can now navigate the entire TV Grid using your keyboard.
- The Arrow keys move focus up, down, left and right
- The Enter key executes what ever cell or button that has focus
- The Page Up and Page Down keys allow you to jump up or down four stations on the grid
- The Home key moves focus back to the first cell in the grid
- And the End key moves focus from one section of the display to another in this order:
-> Cells on the TV Grid
-> The buttons to advance/decrease the time of the grid
-> The buttons for the Grid, Search, Favorites, or GoTo menus
-> The links in the menu on the right

I've also supplied remote control commands for most of primary grid functions in the "Remote" group in the GML.

2) Station Icons
The grid now includes station icons. To use these just copy the included "images" folder into your "Girder 4.0" folder.
You'll also have to customize some of the icons for your local stations. Just find the appropriate icon (such as the
NBC icon which is 'KVBC.png') and rename it to [Your Local NBC station Call Letters].png
(Thank you Curtis for supplying these with your NetRemote script) :)

3) More Customization
The grid also includes more settings for customization, including the ability to change the type sizes of the grid.

Other than that the function of this version is very similar to the earlier version...

All the user interface for the grid is handled in a single display (see below). When you roll over a program,
the description of that program is shown in the band at the top of the grid. If you click on a program a detailed
program description is displayed on the right including the creation date for the program, actors, guest stars,
writers, and categories.

You can also click on any actor, guest star, writer or category to search for additional programs in your XMLTV
file that contain that person or category. At the bottom of the detailed description is a link to watch the program,
record it, or search for other airings. If the program is a movie there is also a link for the Internet Movie Database,
which will bring up a search for that program on their website.

This display is also easy to personalize. You can change the colors and size of the display by going to the
setting script.

The heavy lifting of searching through the XMLTV file is handled by Curtis Wren’s XMLTV plugin. The display is handled
through the Lua Internet Explorer display that Mike C. demonstrated and uses java scripting by Nate for the buttons as
well as an HTML replace innerHTML command provided by Juri (a.k.a. father of monstermagnet). Thanks also to Juri for
demonstrating how to navigate an HTML document using a keyboard.

Requires:
1) An XMLTV file, (here's a post on that) (http://www.promixis.com/phpBB2/viewtopic.php?p=99505&highlight=#99505)
2) And Curtis Wren’s XMLTV Plugin for Girder 4 on the Girder 4 plug-in page

To configure it:
1) Go to the first script called “Load XML Data” and change “openfilename” to point to your XMLTV file
2) If you want it to change channels for you or set recordings for you you'll also need to configure
"Change channel - Script" and "Schedule Recording - Script" but the other features of the grid will work
even if you don't do this.

That's it.

Enjoy.
Chris

tcj2001
January 30th, 2006, 11:29 PM
Excellent..

Chris could you provide functionality for recording and scheduling using MyTheatre, MyTheare uses windows scheduling for recording. It should also allow to delete a scheduled recording.

VaioUserChris
January 31st, 2006, 12:23 AM
Hi tcj2001,
That's definitely possible but I don't have the windows task scheduler with my version of XP (Home) so I haven't played around with it.

If you can find a script for writing to the scheduler I can help you modify the "Schedule Recording - Script" to provide you with the data
you need. That half of it shouldn't be very difficult.

There's a Girder 3.3 user, Braxbraxbrax who seems to have done exactly this using the Girder 3 version of this script. Here's his post: http://www.promixis.com/phpBB2/viewtopic.php?p=136775&highlight=#136775

I'd bet he'd be willing to share his script if you ask him...

Chris

Promixis
January 31st, 2006, 07:20 AM
Chris,

This WMI example http://www.promixis.com/download.php?ID=883 shows how to add jobs to the task scheduler from lua.

VaioUserChris
January 31st, 2006, 09:22 AM
Thanks Mike. But oddly enough none of the downloads from the Girder4 download page work for me now...

When I click your link or go to the Girder4 downloads and click a link I get a text
<?xml version="1.0" encoding="UTF-8"?>
<Girder Version="400"><FileRoot Name="WMI v0.01.gml" Identifier="0" Enabled="TRUE" FileGUID="{8BBF14A5-10BF-4687-82AF-4D9CAA065443}" TimeStamp="0" Locked="FALSE" ErrorBreak="FALSE" ErrorJump="FALSE" ErrorEmail="FALSE" ErrorGirderLog="FALSE" ErrorSystemLog="FALSE"><Group Name="Windows Management and Instrumentation Example Luacom code" Identifier="14982" Enabled="TRUE" ErrorBreak="FALSE" ErrorJump="FALSE" ErrorEmail="FALSE" ErrorGirderLog="FALSE" ErrorSystemLog="FALSE"><Command Name="Object Declaration" Identifier="15425" Enabled="TRUE" ErrorBreak="FALSE" ErrorJump="FALSE" ErrorEmail="FALSE" ErrorGirderLog="FALSE" ErrorSystemLog="FALSE"><OSD>FALSE</OSD><Topmost>TRUE</Topmost><MatchNum>1</MatchNum><sValue1>--[[

Example Lua class for using Windows Managment and Instrumentation via LuaCom

--]]




WMIClass = {

New = function (self)
o = {}
setmetatable (o,self)
self.__index = self
return o
end,
...
Is something broken -- or is it just me?

Chris

Promixis
January 31st, 2006, 09:26 AM
Just do a save as.

tcj2001
January 31st, 2006, 10:28 AM
To change channel in Mytheatre we need the following in change channel script
os.execute("\"C:\\Program Files\\MyTheatre\\MTStart.exe\" /SET /CHNUM "..change_to)

To schedule a recording task for Mytheare this would be needed in recording script
os.execute(
local schstring = "\"C:\\Program Files\\MyTheatre\\MTStart.exe\" /RECORD /CHNUM "..channelnumber[rec_station]..
" /EVENT \""..program.title.."\" /DUR 30"..

os.execute(
"SCHTASKS /CREATE /SC ONCE "..
" /TN ".."\""..program.title.." "..rec_time.."\""..
" /TR "..schstring..
" /SD "..string.sub(rec_time,5,6).."/"..string.sub(rec_time,7,8).."/"..string.sub(rec_time,1,4)..
" /ST "..string.sub(rec_time,9,10)..":"..string.sub(rec_time,11,12)..":"..string.sub(rec_time,13,14)
)

Here I have hardcoded DUR as 30 this need to be the duration in minutes for the event, I dont know how to calculate this, could you help on this

Another thing the Event string should not contain < > : / | \, how can we replace space for this characters in LUA.

Requests:

I would like another few option where everever RECORD button is displayed on the gird, like record once, weekly, monthly or record on MON, TUE, WED, THU, FRI SAT, SUN

Facilitly to save the scheduled recording task and maintainance of these task as you have for favourites.

Option to postionl to a particular channel on the grid on display of the grid, like a channel parameter before the grid is displayed, so that when this guide is called from Mytheatre playing channel nnn, then gird should display that channel.

VaioUserChris
January 31st, 2006, 12:07 PM
I'll take a look at this. The change channel and schedule a recording tasks don't look like they would be very difficult
(in fact a lot of the functions are already there in a slightly different format) so I can definitely help with those in the
next few days.

The repeating events and the facility to maintain the scheduled recordings will take more time...
I'll have to look at what's involved...

Thanks, Chris

quixote
January 31st, 2006, 01:20 PM
I've said it before, and I'll say it again:
Chris, you're awesome, man. Thanks! I was wondering where you disappeared to.

VaioUserChris
January 31st, 2006, 03:16 PM
I was wondering where you disappeared to.
Yeah. I've been working on this for quite some time. It's been something of a javascript nightmare but I think the end result was worth the effort...

By the way I forgot to mention that I also improved the favorites in this version:
1) You can perform a 'find all favorites' or even 'favorites airing now' in less time.
2) When you roll over a favorite it shows you which favorite (or combination of favorites) applies to that program.
3) The favorites are now also shown in the description on the right and highlighted in all of the search menus.

Chris

quixote
January 31st, 2006, 05:45 PM
Well, there's nothing like a development like this to make me feel a bit refreshed and (I know it sounds kind of lame, but) excited. :D
That plus I'm getting a new HTPC that is going to be amazing. I'm going all out on this one. I know this is off topic, but check this case out:

http://www.kustompcs.co.uk/acatalog/1276.jpg
http://www.mcubed-tech.com/generell/heli-200.jpg

Designed for passive cooling with two massive heat sinks on either side. I'm trying to build a fanless system. I want to build a coffee table that has my LCD built into it so that I can have your grid right there on the table in front of me while watching TV.

I'll never have to leave the couch again! :wink:

Anyway, back to the grid. Sorry about that...

VaioUserChris
January 31st, 2006, 10:14 PM
tcj2001,

I didn't understand on your previous post that you already figured out the change channel script. That's great!

Regarding writing the task to the scheduler, based on your code I think the following would work however I haven't
tested it since I don't have the scheduler on my PC. Try it out and let me know...
-- This script demonstrates passing "Record Program" data to Windows Scheduler
-- for Mytheatre recordings.

--pld1 = "C300encore.zap2it.com^20050714230000" -- for testing
--pld1 = "C8klas.zap2it.com^20050714233500" -- for testing
--pld1 = "C5kvvu.zap2it.com^20050714233500" -- for testing

local t=nil
local t=&#123;&#125;
string.gsub&#40;pld1.."^","&#40;&#91;^^&#93;*&#41;^", function &#40;x&#41;
table.insert&#40;t,x&#41;
end&#41;

local rec_station = t&#91;1&#93;
local rec_time = t&#91;2&#93;
local channelname=&#123;&#125;
local channelnumber=&#123;&#125;

local stations= xmltv.numChannels&#40;&#41;

for i = 1, stations do
local row = i
local channel = xmltv.getChannel&#40;row-1&#41;

if&#40; channel == nil &#41; then
print&#40; "ERROR&#58; Can't find channel "..chIndex &#41;
else
if string.sub &#40;channel.name,-1,-1&#41; == "P" then
channel.name = string.sub &#40;channel.name,1,-2&#41;
end

channelname&#91;channel.id&#93; = channel.name
channelnumber&#91;channel.id&#93; = channel.number
end
end

local program = xmltv.get&#40; rec_station, rec_time &#41;

if program ~= nil then
local schstring = "\"C&#58;\\Program Files\\MyTheatre\\MTStart.exe\" /RECORD /CHNUM "..channelnumber&#91;rec_station&#93;..
" /EVENT \""..program.title.."\" /DUR "..xGridFunction.getlength &#40;program.start, program.stop&#41;..

os.execute&#40;
"SCHTASKS /CREATE /SC ONCE ".." /TN ".."\""..program.title.." "..rec_time.."\""..
" /TR "..schstring..
" /SD "..string.sub&#40;rec_time,5,6&#41;.."/"..string.sub&#40;rec_time,7,8&#41;.."/"..string.sub&#40;rec_time,1,4&#41;..
" /ST "..string.sub&#40;rec_time,9,10&#41;.."&#58;"..string.sub&#40;rec_time,11,12&#41;.."&#58;"..string.sub&#40;rec_time,13,14&#41;
&#41;
else
print &#40;"unable to schedule recording on",rec_station,"at",rec_time&#41;
end
Regarding the recurrance, are these the options you would use for the "/SC" command {ONCE, WEEKLY, MONTHLY, MON, TUE, WED, THU, FRI SAT, SUN}?

Chris

VaioUserChris
January 31st, 2006, 10:34 PM
...Option to postionl to a particular channel on the grid on display of the grid, like a channel parameter before the grid is displayed,
so that when this guide is called from Mytheatre playing channel nnn, then gird should display that channel.
This is actually an easy one. Create a new script with the following code and add an event like "MOVE_TO_CHANNEL".
Then call that event, sending the channel you want to go to as payload 1.
Note: You'll have to open the grid before sending this command...
-- this script will focus on a channel in the grid that you send in payload 1
local focus_channel_num = pld1 or 300

local channelrow=&#123;&#125;
local stations= xmltv.numChannels&#40;&#41;

for i = 1, stations do
local row = i
local channel = xmltv.getChannel&#40;row-1&#41;

if&#40; channel == nil &#41; then
print&#40; "ERROR&#58; Can't find channel "..chIndex &#41;
else
channelrow&#91;tonumber&#40;channel.number&#41;&#93; = i-1
end
end

focus_channel_num = tonumber&#40;focus_channel_num&#41;

local focus_cell = "0,0,"..channelrow&#91;focus_channel_num&#93;

if ie99.Document&#58;getElementById&#40;focus_cell&#41; then
ie99.Document&#58;getElementById&#40;focus_cell&#41;&#58;focus&#40;&#41;
end

Chris

tcj2001
January 31st, 2006, 11:03 PM
Thanks for the quick input

I also came with same thing

local dur = xGridFunction.getlength(program.start,program.stop )
local schstring = "\\\"C:\\Program Files\\MyTheatre\\MTStart.exe\\\" /RECORD /CHNUM "..channelnumber[rec_station]..
" /EVENT \\\""..program.title.."\\\" /DUR "..dur
local exestr = "SCHTASKS /CREATE /SC ONCE "..
" /TN ".."\""..program.title.." "..rec_time.."\""..
" /TR ".."\""..schstring.."\""..
" /SD "..string.sub(rec_time,5,6).."/"..string.sub(rec_time,7,8).."/"..string.sub(rec_time,1,4)..
" /ST "..string.sub(rec_time,9,10)..":"..string.sub(rec_time,11,12)..":"..string.sub(rec_time,13,14)..
" /RU \"USER\" /RP \"PASWORD\""
os.execute(exestr)


******************* It works great **********************



The following is the option in SCHEDULER

Main options
======================
SCHTASKS /parameter [arguments]

Description:
Enables an administrator to create, delete, query, change, run and
end scheduled tasks on a local or remote system. Replaces AT.exe.

Parameter List:
/Create Creates a new scheduled task.

/Delete Deletes the scheduled task(s).

/Query Displays all scheduled tasks.

/Change Changes the properties of scheduled task.

/Run Runs the scheduled task immediately.

/End Stops the currently running scheduled task.

/? Displays this help/usage.

Examples:
SCHTASKS
SCHTASKS /?
SCHTASKS /Run /?
SCHTASKS /End /?
SCHTASKS /Create /?
SCHTASKS /Delete /?
SCHTASKS /Query /?
SCHTASKS /Change /?


To create scheduled task
================================================== =
Microsoft Windows XP
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Thomson>schtasks /create /?

SCHTASKS /Create [/S system [/U username [/P password]]]
[/RU username [/RP password]] /SC schedule [/MO modifier] [/D day]
[/I idletime] /TN taskname /TR taskrun [/ST starttime] [/M months]
[/SD startdate] [/ED enddate]

Description:
Enables an administrator to create scheduled tasks on a local or
remote systems.

Parameter List:
/S system Specifies the remote system to
connect to. If omitted the system
parameter defaults to the local
system.

/U username Specifies the user context under
which the command should execute.

/P password Specifies the password for the given
user context.

/RU username Specifies the user account (user
context) under which the task runs.
For the system account, valid values
are "", "NT AUTHORITY\SYSTEM" or
"SYSTEM".

/RP password Specifies the password for the user.
To prompt for the password, the value
must be either "*" or none.
Password will not effect for the
system account.

/SC schedule Specifies the schedule frequency.
Valid schedule types: MINUTE, HOURLY,
DAILY, WEEKLY, MONTHLY, ONCE,
ONSTART, ONLOGON, ONIDLE.

/MO modifier Refines the schedule type to allow
finer control over schedule
recurrence. Valid values are listed
in the "Modifiers" section below.

/D days Specifies the day of the week to run
the task. Valid values: MON, TUE,
WED, THU, FRI, SAT, SUN and for
MONTHLY schedules 1 - 31 (days of the
month).

/M months Specifies month(s) of the year.
Defaults to the first day of the
month. Valid values: JAN, FEB, MAR,
APR, MAY, JUN, JUL, AUG, SEP, OCT,
NOV, DEC.

/I idletime Specifies the amount of idle time to
wait before running a scheduled
ONIDLE task.
Valid range: 1 - 999 minutes.

/TN taskname Specifies a name which uniquely
identifies this scheduled task.

/TR taskrun Specifies the path and file name of
the program to be run by this
scheduled task.
Example: C:\windows\system32\calc.exe

/ST starttime Specifies the time to run the task.
The time format is HH:MM:SS (24 hour
time) for example, 14:30:00 for
2:30 PM.

/SD startdate Specifies the first date on which the
task runs. The format is
"mm/dd/yyyy".

/ED enddate Specifies the last date when the task
should run. The format is
"mm/dd/yyyy".

/? Displays this help/usage.

Modifiers: Valid values for the /MO switch per schedule type:
MINUTE: 1 - 1439 minutes.
HOURLY: 1 - 23 hours.
DAILY: 1 - 365 days.
WEEKLY: weeks 1 - 52.
ONCE: No modifiers.
ONSTART: No modifiers.
ONLOGON: No modifiers.
ONIDLE: No modifiers.
MONTHLY: 1 - 12, or
FIRST, SECOND, THIRD, FOURTH, LAST, LASTDAY.

Examples:
SCHTASKS /Create /S system /U user /P password /RU runasuser
/RP runaspassword /SC HOURLY /TN rtest1 /TR notepad
SCHTASKS /Create /S system /U domain\user /P password /SC MINUTE
/MO 5 /TN rtest2 /TR calc.exe /ST 12:00:00
/SD 10/20/2001 /ED 10/20/2001 /RU runasuser /RP
SCHTASKS /Create /SC MONTHLY /MO first /D SUN /TN game
/TR c:\windows\system32\freecell
SCHTASKS /Create /S system /U user /P password /RU runasuser
/RP runaspassword /SC WEEKLY /TN test1 /TR notepad.exe
SCHTASKS /Create /S system /U domain\user /P password /SC MINUTE
/MO 5 /TN test2 /TR c:\windows\system32\notepad.exe
/ST 18:30:00 /RU runasuser /RP *
SCHTASKS /Create /SC MONTHLY /MO first /D SUN /TN cell
/TR c:\windows\system32\freecell /RU runasuser

To change a scheduled task
================================================== ==========
SCHTASKS /Change [/S system [/U username [/P password]]] {[/RU runasuser]
[/RP runaspassword] [/TR taskrun]} /TN taskname

Description:
Changes the program to run, or user account and password used
by a scheduled task.

Parameter List:
/S system Specifies the remote system to connect to.

/U username Specifies the user context under
which the command should execute.

/P password Specifies the password for the given
user context.

/RU username Changes the user name (user context) under
which the scheduled task has to run.
For the system account, valid values are
"", "NT AUTHORITY\SYSTEM" or "SYSTEM".

/RP password Specifies a new password for the existing
user context or the password for a new
user account. Password will not effect for
the system account.

/TR taskrun Specifies a new program that the scheduled
task runs. Type the path and file name of
the program.

/TN taskname Specifies which scheduled task to change.

/? Displays this help/usage.

Examples:
SCHTASKS /Change /RP password /TN "Backup and Restore"
SCHTASKS /Change /TR restore.exe /TN "Start Restore"
SCHTASKS /Change /S system /U user /P password /RU newuser
/TN "Start Backup"

To delete scheduled task
==================================================
SCHTASKS /Delete [/S system [/U username [/P password]]] /TN taskname
[/F]

Description:
Deletes one or more scheduled tasks.

Parameter List:
/S system Specifies the remote system to connect to.

/U username Specifies the user context under
which the command should execute.

/P password Specifies the password for the given
user context.

/TN taskname Specifies the name of the scheduled task to
delete. Wildcard "*" may be used to delete
all tasks.

/F (Force) Deletes the task and suppresses
warnings if the specified task is currently
running.

/? Displays this help/usage.

Examples:
SCHTASKS /Delete /TN * /F
SCHTASKS /Delete /TN "Backup and Restore"
SCHTASKS /Delete /S system /U user /P password /TN "Start Restore"
SCHTASKS /Delete /S system /U user /P password /TN "Start Backup" /F

To query scheduled task
==================================
SCHTASKS /Query [/S system [/U username [/P password]]] [/FO format]
[/NH] [/?]

Description:
Enables an administrator to display the scheduled tasks on the
local or remote system.

Parameter List:
/S system Specifies the remote system to connect to.

/U username Specifies the user context under
which the command should execute.

/P password Specifies the password for the given
user context.

/FO format Specifies the output format to be
displayed. Valid values: TABLE, LIST, CSV.

/NH Specifies that the column header should not
be displayed in the output.
Valid only for TABLE and CSV formats.

/V Specifies additional output to be
displayed.

/? Displays this help/usage.

Examples:
SCHTASKS /Query
SCHTASKS /Query /?
SCHTASKS /Query /S system /U user /P password
SCHTASKS /Query /FO LIST /V /S system /U user /P password
SCHTASKS /Query /FO TABLE /NH /V

VaioUserChris
February 1st, 2006, 10:48 AM
Cool. I'm thinking that the frequency option can be handled with an interim screen. The flow would be like this:
1) Click the current record button on the grid -- no changes to grid script
2) That triggers a pop-up that asks for the frequency you want to record with pull down options shown above
3) That selection and the original record parameters are passed to the task scheduler script

Regarding display of the scheduled recordings, I noticed above that you can produce a CSV file log of all scheduled tasks.
Can you generate one and post it here? Rather than construct an entirely new log for every scheduled event I'd like to try and
re-use the task scheduler's existing log if possible. This would still require a few changes to the TV Grid script but I think this will
be the easier way to go...

Chris

tcj2001
February 1st, 2006, 12:39 PM
Cool. I'm thinking that the frequency option can be handled with an interim screen. The flow would be like this:
1) Click the current record button on the grid -- no changes to grid script
2) That triggers a pop-up that asks for the frequency you want to record with pull down options shown above
3) That selection and the original record parameters are passed to the task scheduler script

Regarding display of the scheduled recordings, I noticed above that you can produce a CSV file log of all scheduled tasks.
Can you generate one and post it here? Rather than construct an entirely new log for every scheduled event I'd like to try and
re-use the task scheduler's existing log if possible. This would still require a few changes to the TV Grid script but I think this will
be the easier way to go...

Chris

I will get it to you tonight

tcj2001
February 1st, 2006, 12:41 PM
...Option to postionl to a particular channel on the grid on display of the grid, like a channel parameter before the grid is displayed,
so that when this guide is called from Mytheatre playing channel nnn, then gird should display that channel.
This is actually an easy one. Create a new script with the following code and add an event like "MOVE_TO_CHANNEL".
Then call that event, sending the channel you want to go to as payload 1.
Note: You'll have to open the grid before sending this command...
-- this script will focus on a channel in the grid that you send in payload 1
local focus_channel_num = pld1 or 300

local channelrow=&#123;&#125;
local stations= xmltv.numChannels&#40;&#41;

for i = 1, stations do
local row = i
local channel = xmltv.getChannel&#40;row-1&#41;

if&#40; channel == nil &#41; then
print&#40; "ERROR&#58; Can't find channel "..chIndex &#41;
else
channelrow&#91;tonumber&#40;channel.number&#41;&#93; = i-1
end
end

focus_channel_num = tonumber&#40;focus_channel_num&#41;

local focus_cell = "0,0,"..channelrow&#91;focus_channel_num&#93;

if ie99.Document&#58;getElementById&#40;focus_cell&#41; then
ie99.Document&#58;getElementById&#40;focus_cell&#41;&#58;focus&#40;&#41;
end

Chris

Could you also write a script to postion to channel based on its NAME, that will be of great help

tcj2001
February 1st, 2006, 12:51 PM
Here is the CSV output of some of the scheduled tasks

VaioUserChris
February 1st, 2006, 01:47 PM
Could you also write a script to postion to channel based on its NAME, that will be of great helpTo clarify, by name do you mean the name displayed in the grid (i.e. KVBC for Channel 3 in my screen shot)?

Thanks, Chris

tcj2001
February 1st, 2006, 05:16 PM
Could you also write a script to postion to channel based on its NAME, that will be of great helpTo clarify, by name do you mean the name displayed in the grid (i.e. KVBC for Channel 3 in my screen shot)?

Thanks, Chris

Exactly, that is what I was looking for.

VaioUserChris
February 1st, 2006, 08:11 PM
Could you also write a script to postion to channel based on its NAMEHere you go...
-- this script will focus on station name in the grid that you send in payload 1
local focus_channel_name = pld1 or "TBSP"

local channelrow=&#123;&#125;
local stations= xmltv.numChannels&#40;&#41;

for i = 1, stations do
local row = i
local channel = xmltv.getChannel&#40;row-1&#41;

if&#40; channel == nil &#41; then
print&#40; "ERROR&#58; Can't find channel "..chIndex &#41;
else
channelrow&#91;channel.name&#93; = i-1
end
end

local focus_cell = "0,0,"..channelrow&#91;focus_channel_name&#93;

if ie99.Document&#58;getElementById&#40;focus_cell&#41; then
ie99.Document&#58;getElementById&#40;focus_cell&#41;&#58;focus&#40;&#41;
end

tcj2001
February 2nd, 2006, 10:00 AM
Thanks, that was of good help.

I am planning to use Mytheatre (SendToGrider plugin) to send the channel name information to Girder and use that to roll to the correct channel in the GRID.

tcj2001
February 2nd, 2006, 10:26 PM
Can you generate a girder event when the grid is closed by the close button on the IE window

VaioUserChris
February 2nd, 2006, 10:36 PM
Yes.

When the grid closes the "GRID DISPLAY" script calls a function named "xGridFunction.GridQuit:OnQuit ()" which starts on line 824.
You can insert a "gir.TriggerEvent" on the following line to have your girder event triggered when the grid closes.

Let me know if you have any problems...
Chris

tcj2001
February 2nd, 2006, 11:05 PM
I have a event in XMLTV as

<programme start="20060203003000 -0500" stop="20060203013000 -0500" channel="C787zeetv.zap2it.com">
<title lang="en">Sa Re Ga Ma Pa</title>
<desc lang="en">(Hindi)</desc>
<category lang="en">Music</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">SH421371.0000</episode-num>
</programme>

but the grid show this event as

Sa Re Ga Ma Pa
Episode: SH421371.0000
(Hindi)

CH: 787 - ZEETV
Airs: 2/3/06 5:30am-6:30am

The timing is off by almost 5 hours, this was okay in the old version of TVGRID

tcj2001
February 2nd, 2006, 11:08 PM
Another problem when you scroll down to view a channel which is almost in the middle of the entire list and then when you press next hour, it displays the first channel onwards, can it remain in the same page which i was viewing.

VaioUserChris
February 2nd, 2006, 11:36 PM
Regarding the program, I have a few questions:

1) The time you printed was from the display on the right -- does it display at the correct time in the grid itself?

2) Do you have this problem for all the programs?

3) Can you try the old version of the grid and confirm how it displays this program?

I can't recreate this problem on my system so I'm really puzzled...

Chris

VaioUserChris
February 2nd, 2006, 11:49 PM
I really don't get this. I replaced a program in my schedule with yours and it works exactly as expected. I had to change the station to one of mine (VH1) but here is the output I get:
Sa Re Ga Ma Pa
Episode: SH421371.0000
(Hindi)

CH: 39 - VH1

Airs: 2/3/06 12:30am-1:30am
And here is the program info I used
<programme start="20060203003000 -0500" stop="20060203013000 -0500" channel="C39vh1p.zap2it.com">
<title lang="en">Sa Re Ga Ma Pa</title>
<desc lang="en">&#40;Hindi&#41;</desc>
<category lang="en">Music</category>
<category lang="en">Series</category>
<episode-num system="dd_progid">SH421371.0000</episode-num>
</programme>Chris

VaioUserChris
February 3rd, 2006, 12:30 AM
Another problem when you scroll down to view a channel which is almost in the middle of the entire list and then when you press next hour, it displays the first channel onwards, can it remain in the same page which i was viewing.

If you created the "MOVE_TO_CHANNEL" script I posted above and attached an event named "MOVE_TO_CHANNEL" you could use this script to advance
the grid one hour and return focus to the row in the grid that previously had focus
local table
local cell
local row

local channelNum=&#123;&#125;
local stations= xmltv.numChannels&#40;&#41;

for i = 1, stations do
local row = i
local channel = xmltv.getChannel&#40;row-1&#41;

if&#40; channel == nil &#41; then
print&#40; "ERROR&#58; Can't find channel "..chIndex &#41;
else
channelNum&#91;tonumber&#40;i-1&#41;&#93; = channel.number
end
end

if ie99.Document&#58;getElementById&#40;"NXHour"&#41; then
position = ie99.Document&#58;getElementById&#40;"T0"&#41;.innerHTML
_,_,table, cell, row = string.find&#40;position, "&#40;%d+&#41;,&#40;%d+&#41;,&#40;%d+&#41;"&#41;
ie99.Document&#58;getElementById&#40;"NXHour"&#41;&#58;click&#40;&#41;
end

position = channelNum&#91;tonumber&#40;row&#41;&#93;

-- next we'll set a timer for 3 seconds to give the grid time to re-draw, then move focus back to the
-- row that had focus
xmlTimer = &#123;&#125;
timer_round = 0

--XML_TimerKill is used to destroy the timer
function xmlTimer.XML_TimerKill &#40;&#41;
XML_Timer&#58;Cancel&#40;&#41;
XML_Timer = nil
end

-- TimerMonitor function checks the time against timers and repeats until finds match
function xmlTimer.XML_TimerMonitor &#40;interval&#41;
XML_Timer = gir.CreateTimer&#40;"","xmlTimer.XML_TimerHandler&#40;&#41;","",1&#41;
XML_Timer&#58;Arm &#40;interval&#41;
end

-- TimerHandler function is the second part of the TimerMonitor function
-- This does the actual time check versus timers. This will move focus after 3 seconds.
function xmlTimer.XML_TimerHandler &#40;&#41;
timer_round = timer_round + 1
if timer_round == 3 then
gir.TriggerEvent&#40;"MOVE_TO_CHANNEL",18,position&#41;
position = nil
timer_round = nil
xmlTimer.XML_TimerKill &#40;&#41;
end
end

xmlTimer.XML_TimerMonitor &#40;1000&#41;

tcj2001
February 3rd, 2006, 10:39 AM
Regarding the program, I have a few questions:

1) The time you printed was from the display on the right -- does it display at the correct time in the grid itself?

2) Do you have this problem for all the programs?

3) Can you try the old version of the grid and confirm how it displays this program?

I can't recreate this problem on my system so I'm really puzzled...

Chris

Its is the same on the grid.

I will try your earlier version of tvgrid and let you know

tcj2001
February 3rd, 2006, 12:51 PM
Regarding the program, I have a few questions:

1) The time you printed was from the display on the right -- does it display at the correct time in the grid itself?

2) Do you have this problem for all the programs?

3) Can you try the old version of the grid and confirm how it displays this program?

I can't recreate this problem on my system so I'm really puzzled...

Chris

I was wrong, The grid shows the exact time, what XMLTV contains. But the other problem I am having is XMLTV loads the data with PST timing and I am in CST timezone so the timing is off by 2hrs,
It does not make any difference if I build the XMLTV with TImezone set CST, UTC or PST, I am off by 2hrs in any case.

tcj2001
February 3rd, 2006, 12:55 PM
Yes.

When the grid closes the "GRID DISPLAY" script calls a function named "xGridFunction.GridQuit:OnQuit ()" which starts on line 824.
You can insert a "gir.TriggerEvent" on the following line to have your girder event triggered when the grid closes.

Let me know if you have any problems...
Chris

Thanks that worked fine.

Can it generated a girder event when GRID is minimized, i did not see a code for doing this in the above mentioned area

tcj2001
February 3rd, 2006, 03:13 PM
Another problem when you scroll down to view a channel which is almost in the middle of the entire list and then when you press next hour, it displays the first channel onwards, can it remain in the same page which i was viewing.



Chris,
I acheived the functionality in a very different way.

In the "Grid Setting" script, I added a global variable
xGrid.grid_channel = nil

In the "Detailed Program Info" script after line 65
xGrid.grid_channel = channelnumber[rec_station]

In the Grid Generator script at the very end I added
gir.TriggerEvent("MOVE_TO_CHANNEL",18,xGrid.grid_channel)

MOVE_TO_CHANNEL is the event attached to the Move script you had given me.

Advantage is that it remembers the last channel, whenever the grid is re created.

tcj2001
February 3rd, 2006, 03:40 PM
Chris,
The following are the functionality I was able to provide with your help to Integrate TVGRID with MyTheatre

In MyTheatre I have installed a pluggin SendToGrider which send the Current channel name info to Girder, I use this channel name info to be stored in a global variable in TVGRID. I use this to display the TVGRID to focus to the "channel name" value in this variable.

I have the Change channel Script modified to Call MyTheatre and set it to the channel to view.

I have the Schedule Recording Script modified to schedule a windows task to record in MyTheatre for the selected program event.

My PC Screen size is set to 1280 X 720, so I have made the TVGRID also to the same size.

When I call TVGRID from MyTheatre using the Guide button on the remote. It open up the TVGRID and then it resize my MyTheatre screen to a small size and I display it at the Top-Left corner of the TVGRID, this helps me to preview the channel while I am on the Guide. When I Close the Grid, I maximize Mytheare back to it orginal size.

I was able to acheive this by a very small usefull utility I found on web called CMDOW available at http://www.commandline.co.uk/cmdow/, this help me substitute the XmoveWindow functionality which I would love to be present in the LUA or TVGRID.

Waiting for your work on managing the scheduled recording.

Keep the good work going on.........................................

tcj2001
February 8th, 2006, 01:17 PM
Chris

If you are planning to use SCHTASKS.EXE to schedule a task in windows, then it has two drawbacks, it cannot set the taks to "Run only if logged on" and "Wake up computer to run task" flags.

Instead if u can utilize a .net dll avaiable at http://www.codeproject.com/csharp/tsnewlib.asp in your LUA coding, it would allow to schedule and list window task much better.

If u cannot use the dll we can create a wrapper exe in VB.nert and use that.

Let me know how far u have gone in maintianing recording schedule

VaioUserChris
February 8th, 2006, 09:42 PM
Hi TCJ,

Unfortunately I don't use the task scheduler so that solution doesn't work for me. But I am working on two things to help you use the grid with the scheduler.

First is the ability to specify the recording frequency, which you mentioned in an earlier post. To do that you'll need two scripts. First give the following script an event string of "GRECORD2"
-- This script creates a pull-down option window for frequency of scheduled
-- recordings using the Task Scheduler

-- To use this script give it an event string named 'GRECORD2'
-- and use the Task Scheduler Record script with an event string named 'GRECORD2B'

-- When you click record this script will be activated and will present you with the
-- recording frequency options. Once you select your frequency it will pass that data
-- along with the recording data to your Task Scheduler Record script which will then
-- schedule the actual recording.

--local data = pld1 or "C300encore.zap2it.com^20060212230000"
local data = pld1

local day_converter = &#123;&#125;
day_converter.Sun = "Sunday"
day_converter.Mon = "Monday"
day_converter.Tue = "Tuesday"
day_converter.Wed = "Wednesday"
day_converter.Thu = "Thursday"
day_converter.Fri = "Friday"
day_converter.Sat = "Saturday"

local week_counter = &#123;&#125;
week_counter&#91;1&#93; = "First"
week_counter&#91;2&#93; = "Second"
week_counter&#91;3&#93; = "Third"
week_counter&#91;4&#93; = "Fourth"
week_counter&#91;5&#93; = "Last"

local week_counter2 = &#123;&#125;
week_counter2&#91;1&#93; = "1st"
week_counter2&#91;2&#93; = "2nd"
week_counter2&#91;3&#93; = "3rd"
week_counter2&#91;4&#93; = "4th"
week_counter2&#91;5&#93; = "Last"

local m=0
local d=0
local y=0
local t=nil
local t=&#123;&#125;
string.gsub&#40;data.."^","&#40;&#91;^^&#93;*&#41;^", function &#40;x&#41;
table.insert&#40;t,x&#41;
end&#41;

local rec_station = t&#91;1&#93;
local rec_time = xGridFunction.fixdate&#40;t&#91;2&#93;&#41;

_, _, m, d, y = string.find&#40;rec_time, "&#40;%d+&#41;/&#40;%d+&#41;/&#40;%d+&#41;"&#41;

rec_time = d.."."..m..".20"..y.." 00&#58;00&#58;00"



require 'date'
local d = date&#58;parse&#40; rec_time &#41;
print &#40;rec_time,"=",d&#41;


-- start recording frequency string with Once and Daily options
local frequency_string = &#91;&#91;
<OPTION value="/SC ONCE" SELECTED>Once
<OPTION value="/SC DAILY" >Daily&#93;&#93;

-- determine day of week and add to Weekly recording frequency
local day_of_week = d.WeekDay
frequency_string = frequency_string..&#91;&#91;
<OPTION value="/SC WEEKLY /D &#93;&#93;..string.upper&#40;day_of_week&#41;..&#91;&#91;" >Weekly&#93;&#93;



--produce monthly options
--============================
-- first need to determine which week of the month the program airs on &#40;i.e. Fourth Tuesday of the month&#41;

local num_day_of_week = d.DayOfWeek -- numeric day of week
--print &#40;'The numeric day of week is',num_day_of_week&#41;

--cycle through four weekly options to see which week this is
local test_day
for i = 1,4 do
test_day = d&#58;findndow &#40;i,num_day_of_week&#41;
--print &#40;test_day,d&#41;
if test_day == d then
frequency_string = frequency_string..&#91;&#91;
<OPTION value="/SC MONTHLY /MO &#93;&#93;..week_counter&#91;i&#93;.." /D "..string.upper&#40;day_of_week&#41;.." /M *\" >"..
week_counter2&#91;i&#93;.." "..day_of_week.." of every month"

break
end
end

-- next determine if program airs on the last &#91;Wednesday&#93; of the month
test_day = d&#58;findndow &#40;-1,num_day_of_week&#41;
if test_day == d then
frequency_string = frequency_string..&#91;&#91;
<OPTION value="/SC MONTHLY /MO LAST /D &#93;&#93;..string.upper&#40;day_of_week&#41;.." /M *\" >"..
"Last "..day_of_week.." of every month"

end

-- next produce the day of month option
local prog_day = d.Day
frequency_string = frequency_string..&#91;&#91;
<OPTION value="/SC MONTHLY /D &#93;&#93;..prog_day.."\" >".."Day "..prog_day.." of every month"

-- finally determine if program airs on the last day of the month
local last_day_of_month = d&#58;daysinmonth&#40;&#41;
if prog_day == last_day_of_month then
frequency_string = frequency_string..&#91;&#91;
<OPTION value="/SC MONTHLY /MO LASTDAY /M *">Last day of every month&#93;&#93;
end

xmltv_alert =&#91;&#91;
<CENTER>
<span style="font-size&#58;&#93;&#93;..xGrid.TextHeightLg..&#91;&#91;px;">Select Recording Freqency</span>



<form name=form5 onsubmit ="return false">
<TABLE>
<TD ALIGN = "right" id="F0,0,0" style="font-size&#58;&#93;&#93;..xGrid.TextHeight..&#91;&#91;px;"> Frequency&#58; </TD>
<TD class="0,1"> <SELECT class="Links" id="0,0,0" NAME="frequency" SIZE="1" onfocus="&#93;&#93;..xGrid.Soundevent..&#91;&#91; FocusArrow&#40;&#41;;" onblur="BlurArrow&#40;&#41;;" onmouseover="MoveFocus&#40;&#41;;">
&#93;&#93;..frequency_string..&#91;&#91;
</SELECT>
<INPUT TYPE="HIDDEN" NAME=payload VALUE="&#93;&#93;..data..&#91;&#91;"></TD>
<TR>
<TD colspan=2 ALIGN="center" class="0,1">
<input class="Links" id="0,1,0" type="button"
onclick="triggerEvent&#40; 'GRECORD2B' , 18, form5.payload.value+'^'+form5.frequency.value&#41;;" onmouseover="MoveFocus&#40;&#41;;" onfocus="&#93;&#93;..xGrid.Soundevent..&#91;&#91; Focus2&#40;&#41;;"
value="Select">


</TD>
</TABLE>
</form>
</CENTER>
&#93;&#93;

--print&#40;xmltv_alert&#41;

gir.TriggerEvent&#40;"XMLTV_ALERT",18&#41;

This script generates the menu with the possible recording frequency options that are available given the date that was passed to this script from the record button.

Next you'll need to give the following script an event string of "GRECORD2B"
- This script demonstrates passing "Record Program" data to Windows Scheduler
-- for Mytheatre recordings.

-- To use the frequency menu this script needs to have an event string named "GRECORD2B"

--pld1 = "C5kvvu.zap2it.com^20050714233500^/SC WEEKLY /D SUN" -- for testing
if ie then ie&#58;Quit &#40;&#41; end

local t=nil
local t=&#123;&#125;
string.gsub&#40;pld1.."^","&#40;&#91;^^&#93;*&#41;^", function &#40;x&#41;
table.insert&#40;t,x&#41;
end&#41;

local rec_station = t&#91;1&#93;
local rec_time = t&#91;2&#93;
local frequency = "/SC ONCE"
if t&#91;3&#93; then frequency = t&#91;3&#93; end
local channelname=&#123;&#125;
local channelnumber=&#123;&#125;

local stations= xmltv.numChannels&#40;&#41;

for i = 1, stations do
local row = i
local channel = xmltv.getChannel&#40;row-1&#41;

if&#40; channel == nil &#41; then
print&#40; "ERROR&#58; Can't find channel "..chIndex &#41;
else
if string.sub &#40;channel.name,-1,-1&#41; == "P" then
channel.name = string.sub &#40;channel.name,1,-2&#41;
end

channelname&#91;channel.id&#93; = channel.name
channelnumber&#91;channel.id&#93; = channel.number
end
end

local program = xmltv.get&#40; rec_station, rec_time &#41;

if program ~= nil then
local schstring = "\"C&#58;\\Program Files\\MyTheatre\\MTStart.exe\" /RECORD /CHNUM "..channelnumber&#91;rec_station&#93;..
" /EVENT \""..program.title.."\" /DUR "..xGridFunction.getlength &#40;program.start, program.stop&#41;..

os.execute&#40;
"SCHTASKS /CREATE "..frequency.."".." /TN ".."\""..program.title.." "..rec_time.."\""..
" /TR "..schstring..
" /SD "..string.sub&#40;rec_time,5,6&#41;.."/"..string.sub&#40;rec_time,7,8&#41;.."/"..string.sub&#40;rec_time,1,4&#41;..
" /ST "..string.sub&#40;rec_time,9,10&#41;.."&#58;"..string.sub&#40;rec_time,11,12&#41;.."&#58;"..string.sub&#40;rec_time,13,14&#41;
&#41;
else
print &#40;"unable to schedule recording on",rec_station,"at",rec_time&#41;
end This script then receives that frequency you selected and uses it to schedule the recording.

IMPORTANT NOTE -- In order to use the first script you also need to replace the "date.lua" file in your Promixis\Girder\luascript folder with a new version on this post: http://www.promixis.com/phpBB2/viewtopic.php?t=14025. The existing "data.lua" file has an error in one of the calculations which will cause the first script to return invalid dates.

The second thing I'm working on is an additon to the grid to allow you to show scheduled recordings. This will work by reading a table of scheduled recordings you provide in a CSV format -- then it will compare programs on the grid against that table. This will take a while for me to get to though...(i.e. several weeks)

Let me know how the new menu works for you...

Chris

VaioUserChris
February 8th, 2006, 09:50 PM
I was wrong, The grid shows the exact time, what XMLTV contains. But the other problem I am having is XMLTV loads the data with PST timing and I am in CST timezone so the timing is off by 2hrs,
It does not make any difference if I build the XMLTV with TImezone set CST, UTC or PST, I am off by 2hrs in any case.You'll need to go into your XMLTV config file which for me is in "\xmlty\.xmltv" and named "tv_grab_na_dd.conf"

Change "timezone: -0800" to the appropriate time adjustment for your time zone (I believe this is versus GMT but you'll have to check the xmltv site to make sure)

Hope that helps...
Chris

tcj2001
February 9th, 2006, 05:52 PM
Hi TCJ,

Let me know how the new menu works for you...

Chris

Thanks for the excellent code.

I used your code to modify the Detail program info script and added the recording frequency option just above the record button. It works greats

I am attaching the modified TVGRID2.GML for you.

It contain the functionality to schedule recording for MyTheatre, Get the Channel name from Mytheatre and position the guide to the selected channel in Mytheatre, also when the TVGRID is displayed it resize the mytheatre appplication and shows it on the top left corner of the guide. when the guide is closed it restores the mytheatre to full screen mode.
....Lets Keep the good work going on....this is going to be a best EPG GUIDE.....

The new and the modified script are now kept in a new Group

VaioUserChris
February 9th, 2006, 09:13 PM
Neat.

By the way, you can actually do the resizing from within Lua/Girder.

Here's a script to resize my Firefox window for this post to 20 x 20 pix on the first trigger - then restore it on the second trigger.
local handle

handle = win.FindWindow&#40;nil,"Promixis &#58;&#58; View topic - TV Grid using Girder - Version 2 - Mozilla Firefox"&#41;

print &#40;handle&#41;

local top,left,bottom,right

top, left, bottom, right = win.GetWindowRect&#40;handle&#41;
print &#40;top, left, bottom, right&#41;

if old_width then
local width = old_width
local height = old_height
local repaint = true

win.MoveWindow&#40;handle, left, top, width, height, repaint&#41;
old_width = nil
old_height = nil
else
old_width = &#40;right - left&#41;
old_height = &#40;bottom - top&#41;

local width = 20
local height = 20
local repaint = true

win.MoveWindow&#40;handle, left, top, width, height, repaint&#41;
end


You can try it out by changing the title from "Promixis :: View topic - TV Grid using Girder - Version 2 - Mozilla Firefox" to what ever window you want to resize...

Chris

tcj2001
February 10th, 2006, 06:21 PM
Neat.

By the way, you can actually do the resizing from within Lua/Girder.


Chris

Super, I now use your code to do resizing.

I also added a two new text fields on the TVGRID along with the recording frequency, one for Start Cushion in Minutes and another for End Cushion in Minutes, this option will allow to start recording x minutes before the start time and end recording y minutes after the end time.

Mogulbasher
February 12th, 2006, 01:24 PM
Ok I need a little help here.

I downloaded the xmltv, signed up and downloaded a guide which I have called TVData.sml I have opened it up and it contains 12meg of channel listing data.

I have installed the XMLTV plugin for Girder4 and put it in the plugin dir

I have turned the plugin on in girder

I have copied the GML file and images to the GML folder

I have edited the GML file to point to e:\\program files\\xmltv\\ since all my stuff is on E

Display grid function displays an empty grid.

I tried to execute Load Data event but nothing happens. Cannot get any data into grid.

What am I doing wrong...Thanks

This muight help from scripting endgine
[string "XMLTV Grid 012806.gml:\TV Grid\GRID DISPLAY..."]:882: attempt to index a nil value
stack traceback:
[string "XMLTV Grid 012806.gml:\TV Grid\GRID DISPLAY..."]:882: in main chunk
loaded xmltv - channels = 0
Error, Finding File: E:\Documents and Settings\Andrew\SavedSearches.xml
Error: XML Config File does not Exist

quixote
February 12th, 2006, 03:45 PM
Try shutting down Girder and restarting it. It looks like you've done everything correctly, assuming your file is called TVData.xml rather than TVData.sml like you typed it above.

Mogulbasher
February 12th, 2006, 04:04 PM
Nope does not work again here is the lua log

loaded xmltv - channels = 0
loaded xmltv - channels = 0
Error, Finding File: E:\Documents and Settings\Andrew\SavedSearches.xml
Error: XML Config File does not Exist
Error, Finding File: E:\Documents and Settings\Andrew\SavedSearches.xml
Error: XML Config File does not Exist
Error, Finding File: E:\Documents and Settings\Andrew\SavedSearches.xml
Error: XML Config File does not Exist
unable to read saved search file

I have no idea why it is trying to load savedsearches. Maybe I am doing the worng thing or tyring to load the wrong thing.

When I execute the action GRID DISPLAY should the grid come up fully populated or empty...IT is empty....
Extract of TVData.xml



<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tv &#40;View Source for full doctype...&#41;>
- <tv source-info-url="http&#58;//labs.zap2it.com/" source-info-name="TMS Data Direct Service" generator-info-name="XMLTV" generator-info-url="http&#58;//www.xmltv.org/">
- <channel id="I10021.labs.zap2it.com">
<display-name>67 AMC</display-name>
<display-name>67 AMC MD53200&#58;X</display-name>
<display-name>67</display-name>
<display-name>AMC</display-name>
<display-name>AMC</display-name>
<display-name>Satellite</display-name>
</channel>
- <channel id="I10035.labs.zap2it.com">
<display-name>50 AETV</display-name>
<display-name>50 AETV MD53200&#58;X</display-name>
<display-name>50</display-name>
<display-name>AETV</display-name>
<display-name>A & E Network</display-name>
<display-name>Satellite</display-name>
</channel>
- <channel id="I10051.labs.zap2it.com">
<display-name>71 BET</display-name>
<display-name>71 BET MD53200&#58;X</display-name>
<display-name>71</display-name>
<display-name>BET</display-name>
<display-name>Black Entertainment Television</display-name>
<display-name>Satellite</display-name>
</channel>
- <channel id="I10057.labs.zap2it.com">
<display-name>68 BRAVO</display-name>
<display-name>68 BRAVO MD53200&#58;X</display-name>
<display-name>68</display-name>
<display-name>BRAVO</display-name>
<display-name>Bravo</display-name>
<display-name>Satellite</display-name>
</channel>
- <channel id="I10093.labs.zap2it.com">
<display-name>57 FAM</display-name>
<display-name>57 FAM MD53200&#58;X</display-name>
<display-name>57</display-name>
<display-name>FAM</display-name>
<display-name>ABC Family</display-name>
<display-name>Satellite</display-name>
</channel>


Extract of GML


local openfilename1 = "E&#58;\\Program Files\\xmltv\\" -- directory where data resides
local openfilename2 = "TVData.xml"
local openfilename = openfilename1..openfilename2

quixote
February 12th, 2006, 04:34 PM
The grid should be full of show listings when you start it up. There is definately something wrong with your XML file. Maybe it wasn't sorted properly? Here is my .bat file that I use to update my file:


@echo on
set tz=pdt
~ "xmltv.exe" tv_grab_na_dd --configure
"xmltv.exe" tv_grab_na_dd --days 7 --output "TVDatapre.xml" --offset -1 --old-chan-id
"xmltv.exe" tv_sort --output "TVData.xml" "TVDatapre.xml"
if errorlevel 1 goto end
&#58;end

I live in Canada, so yours may look different if you live outside of North America. It downloads 7 days of data.

Mogulbasher
February 12th, 2006, 05:34 PM
Nope still the same thing...

It is definately the XML file because I have no program data in it just channel data.

Mogulbasher
February 12th, 2006, 05:51 PM
Onlt other thing is error message when downloading guide which says

MESSAGE: The endtimeyou specified was invalid and has been corrected to 2006-02014T05:00:00z

I also wonder if I need to change my activeX control settings in IE

quixote
February 12th, 2006, 09:09 PM
I'm not sure what the problem is. Maybe Chris knows; he's pretty knowledgeable when it comes to this sort of thing.

Sorry I couldn't be of more help.

VaioUserChris
February 12th, 2006, 10:38 PM
Mogulbasher,

Hmmm. I see you're not getting any program data - which is indeed the problem.

Can you post the text of your bat file here? It sounds like an issue with xmltv but perhaps we can sort it out...

Chris

Mogulbasher
February 14th, 2006, 07:30 AM
I was not using a bat file, I just individually typed the commands into dos prompt based on the commands posted here.

Mogulbasher
February 14th, 2006, 07:38 AM
It appears that I have a list of channels followed by a list of programmes...



<channel id="C204wjladt2.zap2it.com">
<display-name>204 WJLADT2</display-name>
<display-name>204 WJLADT2 MD53200&#58;X</display-name>
<display-name>204</display-name>
<display-name>39 WJLADT2 fcc</display-name>
<display-name>WJLADT2</display-name>
<display-name>WJLADT2 &#40;WJLA-DT2&#41;</display-name>
<display-name>Independent</display-name>
</channel>
<channel id="C128sprout.zap2it.com">
<display-name>128 SPROUT</display-name>
<display-name>128 SPROUT MD53200&#58;X</display-name>
<display-name>128</display-name>
<display-name>SPROUT</display-name>
<display-name>PBS Kids Sprout</display-name>
<display-name>Satellite</display-name>
</channel>
<programme start="20060210231500 -0500" stop="20060211004000 -0500" channel="C3295max.zap2it.com">
<title lang="en">Around the Bend</title>
<desc lang="en">A man &#40;Christopher Walken&#41; takes a road trip with his son &#40;Josh Lucas&#41; and grandson to fulfill his father's &#40;Michael Caine&#41; wishes.</desc>
<credits>
<director>Jordan Roberts</director>
<actor>Christopher Walken</actor>
<actor>Josh Lucas</actor>
<actor>Michael Caine</actor>
<actor>Glenne Headly</actor>
<actor>Jonah Bobo</actor>
<actor>Kathryn Hahn</actor>
<actor>Norbert Weisser</actor>
<actor>Laurie O'Brien</actor>
<actor>David Eigenberg</actor>
<actor>Michael O'Neill</actor>
<actor>Lily Knight</actor>
<actor>Gerry Bamman</actor>
<actor>Robert Douglas</actor>
<actor>Carlos Cabarcas</actor>
<actor>Jean Effron</actor>
<actor>Rick Negron</actor>
<actor>David Marciano</actor>
<writer>Jordan Roberts</writer>
<producer>Julie Kirkham</producer>
<producer>Elliott Lewitt</producer>
</credits>
<date>2004</date>
<category lang="en">Drama</category>
<length units="minutes">83</length>
<episode-num system="dd_progid">MV150915.0000</episode-num>
<audio>
<stereo>dolby</stereo>
</audio>
<subtitles type="teletext" />
<rating system="advisory">
<value>Adult Situations</value>
</rating>
<rating system="advisory">
<value>Language</value>
</rating>
<rating system="MPAA">
<value>R</value>
</rating>
<star-rating>
<value>2/4</value>
</star-rating>
</programme>
<programme start="20060211004000 -0500" stop="20060211022000 -0500" channel="C3295max.zap2it.com">
<title lang="en">Hard to Kill</title>
<desc lang="en">Pronounced dead but not, a policeman &#40;Steven Seagal&#41; with a gorgeous nurse &#40;Kelly LeBrock&#41; eventually recovers and years later seeks revenge.</desc>
<credits>
<director>Bruce Malmuth</director>
<actor>Steven Seagal</actor>
<actor>Kelly LeBrock</actor>
<actor>Bill Sadler</actor>
<actor>Frederick Coffin</actor>
<actor>Bonnie Burroughs</actor>
<actor>Zachary Rosencrantz</actor>
<actor>Branscombe Richmond</actor>
<producer>Gary Adelson</producer>
<producer>Joel Simon</producer>
<producer>Bill Todman Jr.</producer>
</credits>
<date>1990</date>
<category lang="en">Action</category>
<length units="minutes">96</length>
<episode-num system="dd_progid">MV028557.0000</episode-num>
<audio>
<stereo>dolby</stereo>
</audio>
<subtitles type="teletext" />
<rating system="advisory">
<value>Adult Situations</value>
</rating>
<rating system="advisory">
<value>Language</value>
</rating>
<rating system="advisory">
<value>Brief Nudity</value>
</rating>
<rating system="advisory">
<value>Graphic Violence</value>
</rating>
<rating system="MPAA">
<value>R</value>
</rating>
<star-rating>
<value>2/4</value>
</star-rating>
</programme>


This is the transistion point in the TVData file where it switches to programmes. Hope this helps us get it fixed. To create this I just used the commands quizote posted. Andrew

VaioUserChris
February 14th, 2006, 08:56 PM
This data looks like it's correct. Do you still get this line in your log?
loaded xmltv - channels = 0

Chris

Mogulbasher
February 15th, 2006, 07:20 AM
yes

VaioUserChris
February 15th, 2006, 10:33 PM
Ok. Go to the script named "Load XMLTV Data" and double-check that the path/file name in "openfilename" points to your xmltv data file.

If it doesn't point to the correct path change that and "Apply and Test" the script. This should result in a log message where "loaded xmltv - channels" is greater than zero.

Let me know how that goes.

Chris

Mogulbasher
February 16th, 2006, 08:06 AM
I will give that a go when I get home tonight but I have checked and double checked both the path and the file name several times. If it still does not work I will take a bunch of screenshots that show the path and filename and also show thos ein windows explorer. It is baffling me...A

VaioUserChris
February 16th, 2006, 09:37 AM
I know some of these things can be frustrating...

Do me a favor - also change your "Load XMLTV Data" script to the following -- which will also show us if Girder can correctly see the file path:
if not xmltv.numChannels&#40;&#41; or xmltv.numChannels&#40;&#41; == 0 then
local openfilename1 = "C&#58;\\Program Files\\xmltv\\" -- directory where data resides
local openfilename2 = "TVData.xml"
local openfilename = openfilename1..openfilename2

print&#40;"Path/File Exists?&#40;1=Yes&#41;&#40;2 or nil = No&#41;",win.FileExists&#40;openfilename&#41;&#41;

xmltv.load&#40; openfilename &#41;

print&#40; "loaded xmltv - channels = ",xmltv.numChannels&#40;&#41; &#41;
end

-- load settings and functions
if not xGrid then gir.TriggerEvent&#40;"LOAD_SETTINGS",18&#41; end

if not xGridFunction then gir.TriggerEvent&#40;"LOAD_FUNCTIONS",18&#41; end

quixote
February 16th, 2006, 10:37 AM
Chris obviously knows what he's doing, but just out of curiosity--
what happens when you open notepad and paste this code in, save the file as a .txt file, then rename it with a .bat extension, and run it from your XMLTV folder?


@echo on
set tz=pdt
~ "xmltv.exe" tv_grab_na_dd --configure
"xmltv.exe" tv_grab_na_dd --days 7 --output "TVDatapre.xml" --offset -1 --old-chan-id
"xmltv.exe" tv_sort --output "TVData.xml" "TVDatapre.xml"
if errorlevel 1 goto end
&#58;end

Mogulbasher
February 17th, 2006, 06:39 PM
loaded xmltv - channels = 300
Path/File Exists?(1=Yes)(2 or nil = No) 1

Is returned by Girder...

Grid in ie now has all the channels listed but has no data available in every box

Thanks for bearing with me

VaioUserChris
February 17th, 2006, 08:19 PM
We're making progress.

Have you updated your data since you posted the samples above? Those programs were from 2/10 and 2/11 so you may not have current data in your file.

I'd also recommend updating XMLTV from a bat file as quixote suggested. It would make it a lot easier for you and reduce the chance of an error.

FYI -- I'll be traveling over the next week or so. Post if you're still having problems and I'll respond when I'm back.

Chris

Mogulbasher
February 17th, 2006, 09:07 PM
Ok I reran the download using the bat file Quixote provided and did what you said Chris and now everything is working. Thanks all

Just a quick final question. Can I display this grid inside NetRemote...A

VaioUserChris
February 17th, 2006, 10:23 PM
Curtis Wren has written a different schedule for Netremote. Check the Netremote forum for that.

The good news is that both this version and his Netremote version use the same data -- so all you're troubleshooting will pay off one way or another.

Chris

Mogulbasher
February 18th, 2006, 08:46 AM
I understand that but since the Grid is just an ie page I was hoping that I could just find an easy way to display the grid inside of ie in a netremote page.

VaioUserChris
February 28th, 2006, 07:19 PM
You're right, it is just html code so it could be saved as an HTML file and then served up via Girder's webserver -- unfortunately I believe it would have to be re-written almost entirely to do that. The reason is I extensively use an HTML replace command for Girder to send new html content to various cells on the grid as you click. But I doubt the html replace would work the same way via the webserver as it does via the Girder/IE interface.

This is something I'd like to play with at some point but I doubt I'll be able to experiment with it any time soon. Is there some key feature that the grid offers that Curtis' NetRemote option doesn't? If so perhaps you could ask Curtis to incorporate that feature into his version...

Chris

quixote
March 1st, 2006, 08:43 PM
I'm really impressed with this latest grid version. I haven't had one single crash with it so far. Was that you or Ron that fixed that, Chris?
Either way, I'm very grateful!

VaioUserChris
March 2nd, 2006, 08:43 AM
I made minor changes to the scripts but I'd bet it has more to do with changes Ron made to Girder. In any case I'm glad that has improved.

Chris

tcj2001
March 3rd, 2006, 11:04 PM
Hi Chris,
Hope you are getting time to make some progress in adding scheduling to the TVGRID, The only change I did on my side is I am using JT.EXE instead od SCHTASKS, as JT.EXE allows to set lot of flags (such s wake up flag, run only when logged ) which SCHTASKS does not allow

Snapshot of the current schedule recording task code
--frequency = "WEEKLY 1,MT"
type=string.sub(frequency,1,i)
typearguments=string.sub(frequency,i+1)

local event = string.gsub(program.title,"[%W]","_")
local startin = "\"C:\\Program Files\\MyTheatre\\\""
local application = "\"C:\\Program Files\\MyTheatre\\MTStart.exe\""
local parameters = "\" /RECORD /CHNUM "..channelnumber[rec_station].." /EVENT "..event.." /DUR "..xGridFunction.getlength (new_time, program.stop)+EndCushion.."\""
local taskname = "MyTheatre Task \- "..channelname[rec_station].." "..event.." (TAG "..rec_time..")"
local startdate = string.sub(new_time,5,6).."/"..string.sub(new_time,7,8).."/"..string.sub(new_time,1,4)
local starttime = string.sub(new_time,9,10)..":"..string.sub(new_time,11,12)
local exestring =
"JT "..
" /SVJ \"C:\\WINDOWS\\TASKS\\"..taskname..".job\""..
" /SC THOMSON NULL"..
" /CTJ "..
" Startdate="..startdate..
" Starttime="..starttime..
" Type="..type..
" TypeArguments="..typearguments..
" Disabled=0"..
" /SJ "..
" WorkingDirectory="..startin..
" Applicationname="..application..
" parameters="..parameters..
" RunOnlyIfLoggedOn=1"..
" SystemRequired=1"
print(frequency)
print(taskname)
print(startdate)
print(starttime)
print(exestring)
os.execute(exestring)


Let me know how far u reached.

VaioUserChris
March 4th, 2006, 04:23 PM
Hi tcj,

This last piece of displaying scheduled recordings on the grid is just not working out. I've worked on it but it's ending up to be really complex and since my version of XP lacks the task scheduler I'm unable to experiment with it and work out the bugs.

Unfortunately, I'm just not able to tackle this last piece. :-?

However, since you're pretty adept at lua scripting I could give you some general direction so you could complete this last piece yourself. If you're interested just let me know...

Chris

quixote
March 4th, 2006, 06:44 PM
Hi Chris.
Just a quick question, if you don't mind. None of the pics for the channel ids match my channel lineup, so I will be creating my own from screen captures by cropping the logos. I'd like to know the specs for the images. I realize that they need to be PNGs, but what resolution, dimensions, file size and number of colours can be used? Thanks!

Rob H
March 4th, 2006, 06:46 PM
Before you do that you might want to take a look at http://www.lyngsat-logo.com/

tcj2001
March 4th, 2006, 07:33 PM
Hi tcj,

This last piece of displaying scheduled recordings on the grid is just not working out. I've worked on it but it's ending up to be really complex and since my version of XP lacks the task scheduler I'm unable to experiment with it and work out the bugs.

Unfortunately, I'm just not able to tackle this last piece. :-?

However, since you're pretty adept at lua scripting I could give you some general direction so you could complete this last piece yourself. If you're interested just let me know...

Chris

If you post your latest TVGRID.GML, I will work on it, with your directions

quixote
March 4th, 2006, 10:24 PM
Before you do that you might want to take a look at http://www.lyngsat-logo.com/

Thanks Rob.

VaioUserChris
March 5th, 2006, 01:34 AM
Hi Chris.
I'd like to know the specs for the images. I realize that they need to be PNGs, but what resolution, dimensions, file size and number of colours can be used? Thanks! The images are 30x26, 72 dpi. I don't know that file size or color depth matter though.

By the way thanks for that great resource, Rob.

Chris

VaioUserChris
March 5th, 2006, 03:27 PM
If you post your latest TVGRID.GML, I will work on it, with your directionsHere's an updated version of the grid for MyTheatre.

In order to get the scheduled recordings to show up in the grid you need to get them into a table containing the name of the scheduled event, the date/time of the event, and the channel. Assuming you can produce a CSV file like the one you posted earlier, there is a script in this gml that can produce that table -- go to the group named "New Scripts" and the script named "Script to read csv file".

The table containing the task name is: xGrid.Sch_TaskName
The table containing the date/time is: xGrid.Sch_NextRun
The table containing the channel is: xGrid.Sch_Channel
Finally, xGrid.Sch_Task contains the number of scheduled tasks.

If you can get all of those populated correctly then the grid will recongize scheduled events and display them highlighted like a favorite. When you click on one of those programs, it will also display that the program is scheduled to record and offer to delete the scheduled recording.

You will then need to write a script to handle the delete request -- which is already started for you under Grid Scripts / Delete Scheduled Recording

So I think this is a good start for you. Let me know how that goes...

Chris

tcj2001
March 8th, 2006, 10:17 PM
Thanks,

I will work on it

tcj2001
March 10th, 2006, 05:37 PM
I incorporated your changes to my version, it works fine as you have designed, I would like to change the color of the cell show scheduled recording, I tried adding a new color class in the grid display code, but it does not compile.

I want it to be shown as RED instead of GREEN

VaioUserChris
March 10th, 2006, 08:28 PM
Yeah, I hit the same problem when I created this version but I just found a solution. Try this version.

Chris

tcj2001
March 13th, 2006, 08:26 PM
I have completed the delete functionality for scheduled recording. The other modifications that i have done is when you schedule a recording it will refresh the grid immediately and show the cell in red color, same thing i did for favorite also.

now the refresh i do is by loading the grid again and moving to the channel name which i stored in the memory. I need a fucntionalitiy to go the exact location on the grid where i was by cheking the scroll location of the scroll bar. let me know if this is possible.

Another thing i would like to add is the add a tab for recording and provide the functionality of managing the recording the way we have for favorites.

attached is my GML

VaioUserChris
March 13th, 2006, 09:20 PM
I need a fucntionalitiy to go the exact location on the grid where i was by cheking the scroll location of the scroll bar. let me know if this is possible.
You can see the exact cell that has focus in the grid by using the following code
-- this gets the current position in the grid and stores it as "focus_cell"
focus_cell = ie99.Document&#58;getElementById&#40;"T0"&#41;.innerHTML

-- in your second script &#40;after saving the recording&#41; you'll then re-focus on the "focus_cell"
if ie99.Document&#58;getElementById&#40;focus_cell&#41; then
ie99.Document&#58;getElementById&#40;focus_cell&#41;&#58;focus&#40;&#41;
focus_cell = nil
end

Another thing i would like to add is the add a tab for recording and provide the functionality of managing the recording the way we have for favorites. This one is more complicated, because the grid doesn't have much space for another button. I'd suggest replacing the "GoTo" menu with your record menu. To do that, do a search for "GoTo" in each of these scripts and re-title "GoTo" as "Rec" or whatever you want:
"Grid Generator - Script"
"Detailed Program info script"
"Search Menu"
"Favorites Menu"

Then you'll need to modify the following script to include the new menu features you want:
"Goto Menu"

Chris

quixote
April 7th, 2006, 08:39 AM
Can this be placed in the download section of G4?

Personally, I find this to be indispensable.

VaioUserChris
April 7th, 2006, 01:02 PM
Sure. I'll post it this weekend.

Thanks for the reminder.

Chris

quixote
April 7th, 2006, 01:49 PM
Sure. I'll post it this weekend.

Thanks for the reminder.

Chris

No, thank you, my dear sir.

VaioUserChris
April 8th, 2006, 01:06 AM
Cool. It's now on the download section.

Chris

quixote
April 13th, 2006, 05:51 PM
Chris, daylight savings time has screwed up my listings and given me a 1 hour offset. Everything is listed 1 hour in advance. I think we covered this before but I can't find it and I don't remember the solution. Could you tell me how to fix it again? Sorry for wasting your time. :oops:

VaioUserChris
April 13th, 2006, 06:19 PM
You need to change your "tv_grab_na_dd.conf" config file in the xmltv\.xmltv folder.

Assuming you're in the Pacific timezone, you'll want to change "timezone: -0800" to "timezone: -0700"

Chris

quixote
April 14th, 2006, 11:32 AM
Fixed it. I forgot that I had to lie about my timezone. :)
Thanks for the help again.

VaioUserChris
April 14th, 2006, 11:56 AM
No problem. Glad to help.

Chris

quixote
April 17th, 2006, 08:30 AM
Hey Chris, I just had a cool idea.
Would it be possible to run a timer that goes off every half hour that checks the listings for favorites and then announces them with text to speech? I could activate the timer between certain times so that I don't need to check the listings every half hour in case I miss a show.

VaioUserChris
April 17th, 2006, 11:56 PM
Derek, this code should work for you:

--THIS SCRIPT SEARCHES FOR ALL FAVORITES AIRING IN THE NEXT HOUR
local now = os.date&#40;"%Y%m%d%H%M%S"&#41;
local now2 = now
-- set maxtime to 1 hour from now
local maxtime = now
for i = 1,2 do
local newtime = xGridFunction.plustime&#40;maxtime,30&#41;
maxtime = newtime
end


local stations= xmltv.numChannels&#40;&#41;
local channelname = &#123;&#125;
local channelnumber = &#123;&#125;
local channelid = &#123;&#125;
local found = 0
local foundoldprograms = 0


local prgm_start = &#123;&#125;
local prgm_stop = &#123;&#125;
local prgm_title = &#123;&#125;
local prgm_subtitle = &#123;&#125;
local prgm_desc = &#123;&#125;
local prgm_category = &#123;&#125;
local prgm_station = &#123;&#125;
local prgm_channel = &#123;&#125;
local prgm_airingnow = &#123;&#125;
local fav_title2 = &#123;&#125;

for i = 1, stations do
local row = i
local channel = xmltv.getChannel&#40;row-1&#41;

if&#40; channel == nil &#41; then
print&#40; "ERROR&#58; Can't find channel "..chIndex &#41;
else
if string.sub &#40;channel.name,-1,-1&#41; == "P" then
channel.name = string.sub &#40;channel.name,1,-2&#41;
end

channelid&#91;channel.number&#93; = channel.id
channelname&#91;channel.id&#93; = channel.name
channelnumber&#91;channel.id&#93; = channel.number

end
end

local search_string = ""

for i = 1, table.getn&#40;xGrid.Favorites.start&#41; do
local Fav_channel = xGrid.Favorites.channel&#91;i&#93;
local Fav_channel_ID = channelid&#91;Fav_channel&#93;
local Fav_time = xGrid.Favorites.start&#91;i&#93;

local pgm = xmltv.get&#40; Fav_channel_ID, Fav_time &#41;
includeprogram = 1

if pgm.start<=maxtime and pgm.stop>=now then

found = found + 1

if pgm.start<now then
prgm_airingnow&#91;found&#93; = "Airing Now"
else
prgm_airingnow&#91;found&#93; = ""
end

local displayname = channelname&#91;Fav_channel_ID&#93;
local displaynumber = channelnumber&#91;Fav_channel_ID&#93;
if string.sub &#40;displayname,-1,-1&#41; == "P" then
displayname = string.sub &#40;displayname,1,-2&#41;
end

prgm_station&#91;found&#93; = displayname
prgm_channel&#91;found&#93; = displaynumber
pgmcategory = nil -- combine program.category table into a variable
if type&#40;pgm.category&#41;== "table" then
for i,v in ipairs&#40;pgm.category&#41; do
if pgmcategory then
pgmcategory = pgmcategory..", "..v
else
pgmcategory = v
end
end
else
pgmcategory = pgm.category
end
prgm_category&#91;found&#93; = pgmcategory

if &#40;string.find&#40;xGrid.Favorites.title&#91;i&#93;,"%^"&#41;&#41; then
local temp7=&#123;&#125;

string.gsub&#40;xGrid.Favorites.title&#91;i&#93;.."^","&#40;&#91;^^&#93;*&#41;^", function &#40;u&#41;
table.insert&#40;temp7, u&#41;
end&#41;

fav_title = ""
for q = 1,table.getn&#40;temp7&#41; do
fav_title = fav_title .. "\'"..temp7&#91;q&#93; .. "\', and "
end
fav_title = string.sub&#40;fav_title,1,-7&#41;
else
fav_title = xGrid.Favorites.title&#91;i&#93;
end

fav_title2&#91;found&#93; = fav_title
prgm_start&#91;found&#93; = pgm.start
prgm_stop&#91;found&#93; = pgm.stop
prgm_title&#91;found&#93; = pgm.title
prgm_desc&#91;found&#93; = pgm.description
if pgm&#91;"sub-title"&#93; then
prgm_subtitle&#91;found&#93; = " - "..pgm&#91;"sub-title"&#93;
else
prgm_subtitle&#91;found&#93; = ""
end
pgm = xmltv.next&#40;&#41;
end
end

-- HERE ARE THE OUTPUTS
-- found = total number of favorite progams found in next hour
-- fav_title2&#91;x&#93; = favorite name of program x
-- prgm_station&#91;x&#93; = station call letters of program x
-- prgm_channel&#91;x&#93; = channel number of program x
-- prgm_start&#91;x&#93; = start time of program x
-- prgm_stop&#91;x&#93; = stop time of program x
-- prgm_title&#91;x&#93; = title x of program x
-- prgm_desc&#91;x&#93; = description of program x
-- prgm_subtitle&#91;x&#93; = subtitle of program x
-- prgm_airingnow&#91;x&#93; = if program is airing now, this will be "Airing now", if not it will be blank

-- print examples
if found > 0 then
print &#40;"Upcoming Favorites"&#41;
for x = 1, found do
print &#40;prgm_title&#91;x&#93;, "on channel", prgm_channel&#91;x&#93;, prgm_station&#91;x&#93;, "at", xGridFunction.fixtime&#40;prgm_start&#91;x&#93;&#41;, prgm_airingnow&#91;x&#93; &#41;
end
end

quixote
April 18th, 2006, 07:51 AM
WOW that was fast! Thanks! I'll try it out when I get home. This should be a very nice feature. I'll set it up to be enabled with a remote press so that I can turn it on and off as I choose.

You're the man. :D

tcj2001
April 18th, 2006, 11:16 PM
Here's my version of TVGRID supporting schedule recording for MyTheatre, it allows to add, delete, change scheduled recording. It is available in the FAV tab now renamed to EDIT. Thanks a lot Chris for your hlelp, Hope you will improve it further.

VaioUserChris
April 19th, 2006, 10:53 PM
Nice work TCJ!

Derek, I made a small correction to the earlier "airing now" script and added an example. Please make sure you run the above code instead of the earlier post.

Chris

quixote
April 20th, 2006, 10:09 AM
Thanks Chris. I'm currently having a computer crisis, so I'm going to try that out once I have everything sorted out. It seems like everytime I order something online something goes wrong. :x

quixote
May 14th, 2006, 07:06 PM
BTW, the favorites search is exactly what I requested. It's super convenient! I'm going to implement the speech over the next week or so and I'll probably post the GML. THANKS!

VaioUserChris
May 14th, 2006, 07:37 PM
Glad it works for you. Let me know how that goes...

Chris

quixote
May 15th, 2006, 08:38 PM
Chris - can you tell me how to remove an entry from my favorites? I accidently added a show. Thanks.

VaioUserChris
May 15th, 2006, 09:03 PM
Sure Derek.

Just go to the Favorites menu and then select "Manage Favorites".

Then find the title of the favorite you want to delete and click the "Delete" button.

Chris

quixote
May 15th, 2006, 09:13 PM
wow! that's cool! There's features I don't even know about. Nice.
Thought of everything, haven't you!

milenko
June 1st, 2006, 12:43 PM
What is the best way to download XMLTV file? (software, link)

Thank's in advance!

quixote
June 1st, 2006, 01:14 PM
http://sourceforge.net/projects/xmltv

You'll need to create an account with zap2it labs.

http://www.zap2it.com/

milenko
June 1st, 2006, 01:30 PM
Thanks for quick reply. I will try it out.

quixote
June 1st, 2006, 02:01 PM
let me know if you need any more help, but Chris covered pretty much everything earlier in the thread. Check the batch file that we discussed if you run into problems.

milenko
June 1st, 2006, 03:15 PM
I downloaded this 2 files but don't now how to start it and where to register?
xmltv-0.5.43.tar.bz2
xmltv-0.5.43-win32.zip

Do I need to register on ZAP2 forum?

VaioUserChris
June 1st, 2006, 04:18 PM
I downloaded this 2 files but don't now how to start it and where to register?
xmltv-0.5.43.tar.bz2
xmltv-0.5.43-win32.zip

Do I need to register on ZAP2 forum?
Setting up XMLTV always seems difficult -- I sympathize. I'd assume you're in North America -- if so here's what you need to do:

First you need to register (free) with Zap2It by going to http://labs.zap2it.com and using this registration code: 'ZYZM-TE5O-SBUT' (Letter O)

Then, as I recall, you'll need to uncompress the"xmltv-0.5.43-win32.zip" file and run the installer. You should end up with a folder in your program files called "xmltv".

When you uncompress that file, if you find a folder named "xmltv" then I was wrong and there is no installer. In that case just move that folder to your program files folder and you're done with installing.


Next you'll need to create a bat file in the 'xmltv' folder to configure xmltv. Here's what I used to do that



set tz=pdt
%1 tv_grab_na_dd --configure
%1 tv_grab_na_dd --output xmltv\TVDatapre.xml --days %2 --old-chan-id
%1 tv_sort --output xmltv\TVData.xml xmltv\TVDatapre.xml
exit


Running that script will open a DOS window prompting you to set up the xmltv program and download your first set of data.


Following that first configure run, when you want to update your xmltv data you can run another bat script without that configure line:




set tz=pdt
%1 tv_grab_na_dd --output xmltv\TVDatapre.xml --days %2 --old-chan-id
%1 tv_sort --output xmltv\TVData.xml xmltv\TVDatapre.xml

exit



And that should be it. If you live in a different area other than north america, you'll need to configure xmltv differently, but you can get those instructions on the sourceforge link.

Hope that helps,



Chris

milenko
June 1st, 2006, 04:45 PM
Thanks for help. I'll get on to it.

By the way I am from Europe, to be exact from Serbia.

quixote
June 1st, 2006, 06:12 PM
They have TV in Serbia?

(just kidding)
I live in Canada. Here we live in igloos and use dog-sleds to get everywhere. ;)

milenko
June 2nd, 2006, 06:15 AM
Do I need to download file xmltv_prereq-7.tar.bz2 ?

quixote
June 2nd, 2006, 07:36 AM
bz2 is just another type of file extension. I think that everything you need is in the zip file.

quixote
July 18th, 2006, 09:03 PM
Chris - I'm having a tricky time using the remote navigation keys when the IE grid is not in focus. I want to be able to use the grid on my TV while I play games, and browse the web, and the navigational functions do not work when the window is targeted on my TV display. Can you give me any pointers? Thx.

Also, I was thinking of a new layout that would be a lot more easy to read on a TV screen. I'll post a rough draft and if you have the time, maybe you could consider it and let me know if there would be any problems implementing it?


Thanks for your time!

VaioUserChris
July 20th, 2006, 12:30 AM
Chris - I'm having a tricky time using the remote navigation keys when the IE grid is not in focus. I want to be able to use the grid on my TV while I play games, and browse the web, and the navigational functions do not work when the window is targeted on my TV display. Can you give me any pointers? Thx.
Yeah. I'd agree that's a bit of a limitation. You might be able to use the commands in the Remote folder, but you'd also have to specifically target those commands to the grid window. Then the challenge becomes if it works it would send focus to the grid, which isn't what you seem to want.

Another approach might be to set up a keyboard combination that Girder watches for. When you hit that keyboard combo Girder would:
1) store the handle of window that currently has focus - using something like 'oldhandle = win.GetForegroundWindow()' and
2) then send focus to the grid so you can navigate - using 'win.ForceForegroundWindow(GridHandle)'.

Then when you hit that keyboard combo again, Girder could return focus to whatever window had focus before - 'win.ForceForegroundWindow(oldhandle)'.

A bit complicated but I think that would work.

quixote
July 20th, 2006, 08:31 AM
I'll try it out. Thanks!

By the way, I love the search favorites script. I've slightly modified it, added speech and assigned a remote button to it. Now I just have to hit a button to hear what's on! I open the grid once in a while to add favorites and browse for new shows. It's great. I'll post the modified script later for other LUA newbs.

quixote
July 21st, 2006, 04:44 PM
Here is Chris' script that I modified. Make a macro event and assign a remote button to the macro. In the macro there are two actions: the script and a voice action. The voice action is Speak, with simply [FavoritesSpeech] entered in the speech field. (make sure you type it in exactly the way it appears here, including capitals.
The script should be the first action to occur:



--THIS SCRIPT SEARCHES FOR ALL FAVORITES AIRING IN THE NEXT HOUR
local now = os.date("%Y%m%d%H%M%S")
local now2 = now
-- set maxtime to 1 hour from now
local maxtime = now
for i = 1,2 do
local newtime = xGridFunction.plustime(maxtime,30)
maxtime = newtime
end


local stations= xmltv.numChannels()
local channelname = {}
local channelnumber = {}
local channelid = {}
local found = 0
local foundoldprograms = 0


local prgm_start = {}
local prgm_stop = {}
local prgm_title = {}
local prgm_subtitle = {}
local prgm_desc = {}
local prgm_category = {}
local prgm_station = {}
local prgm_channel = {}
local prgm_airingnow = {}
local fav_title2 = {}

for i = 1, stations do
local row = i
local channel = xmltv.getChannel(row-1)

if( channel == nil ) then
print( "ERROR: Can't find channel "..chIndex )
else
if string.sub (channel.name,-1,-1) == "P" then
channel.name = string.sub (channel.name,1,-2)
end

channelid[channel.number] = channel.id
channelname[channel.id] = channel.name
channelnumber[channel.id] = channel.number

end
end

local search_string = ""

for i = 1, table.getn(xGrid.Favorites.start) do
local Fav_channel = xGrid.Favorites.channel[i]
local Fav_channel_ID = channelid[Fav_channel]
local Fav_time = xGrid.Favorites.start[i]

local pgm = xmltv.get( Fav_channel_ID, Fav_time )
includeprogram = 1

if pgm.start<=maxtime and pgm.stop>=now then

found = found + 1

if pgm.start<now then
prgm_airingnow[found] = "Airing Now"
else
prgm_airingnow[found] = ""
end

local displayname = channelname[Fav_channel_ID]
local displaynumber = channelnumber[Fav_channel_ID]
if string.sub (displayname,-1,-1) == "P" then
displayname = string.sub (displayname,1,-2)
end

prgm_station[found] = displayname
prgm_channel[found] = displaynumber
pgmcategory = nil -- combine program.category table into a variable
if type(pgm.category)== "table" then
for i,v in ipairs(pgm.category) do
if pgmcategory then
pgmcategory = pgmcategory..", "..v
else
pgmcategory = v
end
end
else
pgmcategory = pgm.category
end
prgm_category[found] = pgmcategory

if (string.find(xGrid.Favorites.title[i],"%^")) then
local temp7={}

string.gsub(xGrid.Favorites.title[i].."^","([^^]*)^", function (u)
table.insert(temp7, u)
end)

fav_title = ""
for q = 1,table.getn(temp7) do
fav_title = fav_title .. "\'"..temp7[q] .. "\', and "
end
fav_title = string.sub(fav_title,1,-7)
else
fav_title = xGrid.Favorites.title[i]
end

fav_title2[found] = fav_title
prgm_start[found] = pgm.start
prgm_stop[found] = pgm.stop
prgm_title[found] = pgm.title
prgm_desc[found] = pgm.description
if pgm["sub-title"] then
prgm_subtitle[found] = " - "..pgm["sub-title"]
else
prgm_subtitle[found] = ""
end
pgm = xmltv.next()
end
end

-- HERE ARE THE OUTPUTS
-- found = total number of favorite progams found in next hour
-- fav_title2[x] = favorite name of program x
-- prgm_station[x] = station call letters of program x
-- prgm_channel[x] = channel number of program x
-- prgm_start[x] = start time of program x
-- prgm_stop[x] = stop time of program x
-- prgm_title[x] = title x of program x
-- prgm_desc[x] = description of program x
-- prgm_subtitle[x] = subtitle of program x
-- prgm_airingnow[x] = if program is airing now, this will be "Airing now", if not it will be blank

-- print examples
if found == 0 then FavoritesSpeech = "None of your favorite shows are airing within the next hour."

elseif found == 1 then FavoritesSpeech = "One of your favorite shows, "
for x = 1, found do
FavoritesSpeech1 = prgm_title[x].. " is on channel ".. prgm_channel[x].. " at ".. xGridFunction.fixtime(prgm_start[x]).. " ".. prgm_airingnow[x]
FavoritesSpeech = (FavoritesSpeech..FavoritesSpeech1)
end

elseif found >= 2 then FavoritesSpeech = "Upcoming Favorite shows include "
found = (found) - (1)
print (found)
for x = 1, found do
FavoritesSpeech1 = prgm_title[x].. " on channel ".. prgm_channel[x].. " at ".. xGridFunction.fixtime(prgm_start[x]).. " ".. prgm_airingnow[x].. ", "
FavoritesSpeech = (FavoritesSpeech..FavoritesSpeech1)
end
found = (found) + (1)
for x = found, found do
FavoritesSpeech1 = "and ".. prgm_title[x].. " on channel ".. prgm_channel[x].. " at ".. xGridFunction.fixtime(prgm_start[x]).. " ".. prgm_airingnow[x]
FavoritesSpeech = (FavoritesSpeech..FavoritesSpeech1)
end

end

print (FavoritesSpeech)


All credit goes to Chris and Curtis Wren. Enjoy!

quixote
October 13th, 2006, 11:28 PM
For some reason my '"watch" action is not working fro the remote group.
It's this script:

if ie99.Document:getElementById("3,0,1") then
if ie99.Document:getElementById("3,0,1").className == "Present" then
ie99.Document:getElementById("3,0,1"):click()
end
end


Do you have any idea why this is not working? I have the grid displayed on my TV (second monitor). Thanks.

A Hamilto
December 11th, 2007, 03:52 PM
...Thanks also to Juri for demonstrating how to navigate an HTML document using a keyboard.

VaioUserChris,

I have been searching the web for months trying to find a sample of how to navigate an HTML document using a keyboard the way you describe in the description accompanying this post.

I don't have Girder 4, so I can't use this version of your GML, and the version for 3.3 did not include the keyboard navigation as described here.

Can you show me what Juri demonstrated to you, please? I would really like to see the HTML code of the TV Grid when it contains data.

Thanks.

A

beags
October 30th, 2008, 09:50 PM
Hi all,

This may be a stupid question
But when I push watch in the grid display I get a pop up box that says
'Change channel - Script'
received command to go to channel:
2

What I want is to send the event 2 or whatever channel I push to girder.

Any help would be appreciated

Kind regards
Beags