Hi,
How is everyone? My name is Chris, I'm 29/m, and I just joined here. I saw Tin's simulated Prevue Guide, and I have a question about the curday.dat file and the other files that he put up. I'm trying to set it up and to put in my own local listings. How would I do that, and how would I set up the files? I know that this is an HTML5 simulator, so I can view it in Safari or other web sites, but how would I use the files to implement my own listings? I'm just curious. Thanks.
Curday.dat file
-
- Posts: 93
- Joined: Tue Sep 06, 2011 3:36 pm
Re: Curday.dat file
I am not quite sure... I couldn't figure it out when I gave it a shot but I do recall reading something about scraping listings from a MythTV install (which I never figured out either). The way it is set up, however, is probably going to vary from person to person, depending on your location.
Re: Curday.dat file
if you search in the HTML code for the remark "FUNCTIONS THAT IMPORT DATA" you will see immediately after, a funnction that is called getcluinfo(). This sets up a CLU database - akin to the CLU information in Prevue Guide. It requests 4 files from the webserver (location of which is changable by changing the variable cgiprefix earlier in the code)
these are just perl scripts on the webserver that return plain text. You can call them directly in your webbrowser if you like to see what they produce.
the main javascript requests the following:-
/cgi-bin/pgweb/list.pl?mode=channel&selectcode=GA24005
this returns a list of channel numbers, one per line
/cgi-bin/pgweb/list.pl?mode=source&selectcode=GA24005
this returns a list of source IDs to identify a channel uniquely (akin to the SOURCE in Prevue Guide) I
/cgi-bin/pgweb/list.pl?mode=callltrs&selectcode=GA24005
the same, but returns the callltrs for the channel - these are what's displayed - again just like Prevue Guide
and finally
/cgi-bin/pgweb/list.pl?mode=type&selectcode=GA24005
this lists the type of data in each row. at the moment I think only ch is supported - for channel..
these files are served by a single peice of perl code that imports a single text file that looks like this....
ch|1|BBC1NW|BBC 1
ch|2|BBC2NW|BBC 2
ch|3|ITVGRN|ITV 1
ch|4|CH4___|Ch 4
ch|5|FIVE__|Five
ch|6|ITV2__|ITV 2
ch|7|BBC3__|BBC 3
...
etc
--
then there is a function called getprogrammeinfo() this does a similar thing.
It requests /pgweb/curday.txt from the webserver. Again the location of this can be changed as you see fit, and also generated on the webserver how you see fit. This is again just a text file with the SOURCE letters as the first 6 chars, then a 3 char timeslot which is similar but definitely yet not the same as Prevue guide. There are 3x 48 timeslots 001 to 144. 1-48 are for yesterday, 49-96 for today and 97-144 for tomorrow. This lets PGweb figure out where and when to put << and >> arrows for programmes that push over the day boundary (I can't figure out how Prevue Guide did it - perhaps it didn't!)
--
SO
To set up the simulator with your own files, create a text file for list.pl like the one above with the channels you want, and then a curday.dat with the programme information, and have your webserver serve them out. I did post all the code in a thread in this forum, should be quite easy to get up and working. There is a lot more notes in a couple of text files in the archive which tell you how the code works. However you can totally replace all the code that generates the text files with your own better code if you want. As long as the text files end up in that format, PGweb will read them.
...or use the other scripts I provided too...
To get the information from a standard mythtv install, first ensure you can serve straightforward perl CGI pages from the box. Then install get_info.pl onto the webserver of the myth box. Change the password in the script to your mythtv SQL database password. Again the NOTES.txt file in the archive covers what to do.
Then install the scripts folder on the webserver, it will fetch the full channels and programmes databases from the myth box, parse the contents and save a curday.txt. change bits of the script to do the web request from your myth box and to save the resulting curday.txt in your webserver directory. Put the script in as a cron or scheduled task to run every few hours if you like.
I'd be really interested if you get it working!! I'd love to spend more time on this soon, maybe I'll get chance!!
these are just perl scripts on the webserver that return plain text. You can call them directly in your webbrowser if you like to see what they produce.
the main javascript requests the following:-
/cgi-bin/pgweb/list.pl?mode=channel&selectcode=GA24005
this returns a list of channel numbers, one per line
/cgi-bin/pgweb/list.pl?mode=source&selectcode=GA24005
this returns a list of source IDs to identify a channel uniquely (akin to the SOURCE in Prevue Guide) I
/cgi-bin/pgweb/list.pl?mode=callltrs&selectcode=GA24005
the same, but returns the callltrs for the channel - these are what's displayed - again just like Prevue Guide
and finally
/cgi-bin/pgweb/list.pl?mode=type&selectcode=GA24005
this lists the type of data in each row. at the moment I think only ch is supported - for channel..
these files are served by a single peice of perl code that imports a single text file that looks like this....
ch|1|BBC1NW|BBC 1
ch|2|BBC2NW|BBC 2
ch|3|ITVGRN|ITV 1
ch|4|CH4___|Ch 4
ch|5|FIVE__|Five
ch|6|ITV2__|ITV 2
ch|7|BBC3__|BBC 3
...
etc
--
then there is a function called getprogrammeinfo() this does a similar thing.
It requests /pgweb/curday.txt from the webserver. Again the location of this can be changed as you see fit, and also generated on the webserver how you see fit. This is again just a text file with the SOURCE letters as the first 6 chars, then a 3 char timeslot which is similar but definitely yet not the same as Prevue guide. There are 3x 48 timeslots 001 to 144. 1-48 are for yesterday, 49-96 for today and 97-144 for tomorrow. This lets PGweb figure out where and when to put << and >> arrows for programmes that push over the day boundary (I can't figure out how Prevue Guide did it - perhaps it didn't!)
--
SO
To set up the simulator with your own files, create a text file for list.pl like the one above with the channels you want, and then a curday.dat with the programme information, and have your webserver serve them out. I did post all the code in a thread in this forum, should be quite easy to get up and working. There is a lot more notes in a couple of text files in the archive which tell you how the code works. However you can totally replace all the code that generates the text files with your own better code if you want. As long as the text files end up in that format, PGweb will read them.
...or use the other scripts I provided too...
To get the information from a standard mythtv install, first ensure you can serve straightforward perl CGI pages from the box. Then install get_info.pl onto the webserver of the myth box. Change the password in the script to your mythtv SQL database password. Again the NOTES.txt file in the archive covers what to do.
Then install the scripts folder on the webserver, it will fetch the full channels and programmes databases from the myth box, parse the contents and save a curday.txt. change bits of the script to do the web request from your myth box and to save the resulting curday.txt in your webserver directory. Put the script in as a cron or scheduled task to run every few hours if you like.
I'd be really interested if you get it working!! I'd love to spend more time on this soon, maybe I'll get chance!!
Re: Curday.dat file
I have never tried doing something like this at all. Just by the looks of it, it seems VERY complicated. I've never even tried creating these files. Thanks, Tin for the info. I will need some extra help here if I can get this done. I should mention that I have a Mac, so I wouldn't know how to use Javascript on it. Thanks everyone.
Re: Curday.dat file
tin, thanks for posting all that! Interesting to see how you implemented it... I'll take a more in-depth look some time. We should really work on getting my sender to work with your simulator like you suggested before... Unfortunately the sender seems to have broken for some reason, it no longer sends channel blocks that the Prevue software recognizes as valid. I have to get to the bottom of it...
Chris, I'm really sorry we don't have any easy-to-use tools for this, but you'd have to be a programmer in order to do this yourself . Hopefully sometime we will make it possible for anyone to do it.
Chris, I'm really sorry we don't have any easy-to-use tools for this, but you'd have to be a programmer in order to do this yourself . Hopefully sometime we will make it possible for anyone to do it.