TiVo Community Forum

TiVo Community Forum Archive 2
Covering threads with a last post date between
July 1, 2004 and December 31, 2005.
THIS IS A READ ONLY SITE
 


 

SEARCH  |  ARCHIVE 1 MAIN SITE

 
Forum Jump
 
Thread Tools Search this Thread Display Modes
Old 01-16-2005, 11:05 PM   #1 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Now Playing (more PHP code)

This will allow you to retrieve your Now Playing data from your TiVo(s) and display it as either HTML, XML or RSS.

Credits to gonzotek for the original class_tivo_xml.php file
http://www.tivocommunity.com/tivo-v...threadid=217329

Credits to yakko for the modified RSS code
http://www.tivocommunity.com/tivo-v...threadid=217329

All the rest, credits to me =)

1. Download and install PHP (i.e. C:\PHP)
2. Download and install WGET w/SSL (i.e. copy WGET.EXE, libeay32.dll and ssleay32.dll to your C:\PHP folder)
ftp://ftp.sunsite.dk/projects/wget/...1b-complete.zip (for Windows)
3. Create a tivo subfolder under the PHP folder, for example, C:\PHP\TIVO
4. Extract all the files in attached zip to your C:\PHP\TIVO folder (w/folders enabled)
5. Edit the settings in tivo_settings.php file

PHP Code:
 ini_set("max_execution_time""120");
ini_set("error_log""tivo_errors.txt");

define("wgetpath""c:\\php\\tivo\\wget.exe");
define("tivoport""80");

$tivos = array(
    
"t1" => array("ip" => "10.1.1.1""mak" => "1234567890""model" => "40""name" => "lr""nowplaying" => "Living Room - Now Playing""feedtitle" => "TiVo""feeddescription" => "Living Room - Now Playing""feedlink" => "http://www.yourdomain.com""css" => "tivo.css""js" => "tivo_now_playing.js"),
    
"t2" => array("ip" => "10.1.1.2""mak" => "1234567890""model" => "80""name" => "br""nowplaying" => "Bedroom - Now Playing""feedtitle" => "TiVo""feeddescription" => "Bedroom - Now Playing""feedlink" => "http://www.yourdomain.com""css" => "tivo.css""js" => "tivo_now_playing.js"),
    );

$dorss 1//0 or 1 : create rss files
$disabledownloadlinks 0//0 or 1 : show download links in html
$disablexmllinks 0//0 or 1 : hyperlink show title to xml data
$gfxicons 0//0 or 1 : use graphic icons (tivo logos) 

6. Use Task Scheduler to run the index.php every hour (or whenever you want).
Whenever the task runs, the older files will be overwritten. The script will create 3 files for each TiVo you have, for example, bedroom_nowplaying.htm, bedroom_nowplaying.xml and bedroom_rss_nowplaying.htm

7. Add a new Favorite to your browser, an example URL,

file://your-computer-unc/c$/php/tivo/bedroom_nowplaying.htm

I used Group Policy to push out the URLs to all my home machines.
If you want to access the URL all the time, make sure you put it on a machine that you don't turn off (duh).

8. If you want to display your RSS file, copy the bedroom_rss_nowplaying.xml file to your web server
or access it locally via FeedDemon (or whatever RSS app you use).

I think that about covers it, HUGE thanks again to gonzotek, yakko, morac and windracer.

NOTE Extract these file into a NEW folder (or remove your older ones first). The directory structure has been redone, and certain files are no longer needed.
NEW NOTE tivo_settings.php is back.
Attached Files
File Type: zip tivo_now_playing.zip (35.3 KB, 185 views)

Last edited by clam729 : 03-24-2005 at 04:23 PM.
clam729 is offline Report Bad Post Report Post
Old 01-17-2005, 11:02 AM   #2 (Print)
JiAvW
I Live Like A King.
 
JiAvW's Avatar
 
Join Date: Nov 2003
Location: Nashville, TN
Posts: 26
Keep up the great work. RSS 2.0?
JiAvW is offline Report Bad Post Report Post
Old 01-17-2005, 12:57 PM   #3 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Thanks - yes, the RSS feed is 2.0 (HUGE thanks go to yakko for the modified RSS code, found here http://www.tivocommunity.com/tivo-v...threadid=217329 )
clam729 is offline Report Bad Post Report Post
Old 01-17-2005, 01:18 PM   #4 (Print)
yakko
Registered User
 
Join Date: Jun 2003
Posts: 53
gonzotek deserves the credit, I just followed the RSS 2.0 spec and put the things in the right places.

This script is nice and useful if you have a multi-pc home network. Why'd you make the decision to cache the files rather than have them automaticly generated when someone views the page? You can include the IP, MAK, and Tivo model in the PHP file and possibly have more current information than scheduling the batch file.
yakko is offline Report Bad Post Report Post
Old 01-17-2005, 01:48 PM   #5 (Print)
edgardner
New Member
 
Join Date: Jan 2005
Posts: 10
Send a message via ICQ to edgardner Send a message via AIM to edgardner Send a message via Yahoo to edgardner
Does this require any modifications to the Tivo itself (pardon my ignorance)?
edgardner is offline Report Bad Post Report Post
Old 01-17-2005, 02:09 PM   #6 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Quote:
Originally posted by yakko
gonzotek deserves the credit, I just followed the RSS 2.0 spec and put the things in the right places.

This script is nice and useful if you have a multi-pc home network. Why'd you make the decision to cache the files rather than have them automaticly generated when someone views the page? You can include the IP, MAK, and Tivo model in the PHP file and possibly have more current information than scheduling the batch file.


The main reason is that I ran into a TON of permission problems when viewing it on my webserver, however, as a command line script, I didn't have any problems. I need to figure those issues out.

If I couldn't get my permission problems figured out, I know I couldn't answer any questions here about them

Depending on popularity of these scripts, maybe we could all collaborate on the project ?
clam729 is offline Report Bad Post Report Post
Old 01-17-2005, 02:11 PM   #7 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Quote:
Originally posted by edgardner
Does this require any modifications to the Tivo itself (pardon my ignorance)?


no problem. the answer is 'no', once you have the 7.1 update on your TiVo, you can run these scripts. you need only modify your computer/script files/etc.
clam729 is offline Report Bad Post Report Post
Old 01-17-2005, 04:23 PM   #8 (Print)
BP-isMe
Registered User
 
Join Date: Dec 2003
Location: Boston
Posts: 10
Question PHP ??

I don't run a web server at home. Do I need to or can I just run PHP.exe. Where do I get PHP.exe

Thanks...Brad
BP-isMe is offline Report Bad Post Report Post
Old 01-17-2005, 04:29 PM   #9 (Print)
JiAvW
I Live Like A King.
 
JiAvW's Avatar
 
Join Date: Nov 2003
Location: Nashville, TN
Posts: 26
Yes you need a webserver. I'm assuming you run windows, which has a built-in webserver (in IIS) that is uninstalled by default (you can go into add/remove programs to install it). I would recommend Apache, but my initial feeling is that you don't have much programming experience.

To install php, you must download the package, from www.php.net

I would highly recommend doing a great deal of research prior to installing a webserver. Running one can be an incredible security hazard.
JiAvW is offline Report Bad Post Report Post
Old 01-17-2005, 04:29 PM   #10 (Print)
yakko
Registered User
 
Join Date: Jun 2003
Posts: 53
you can get PHP from http://www.php.net. All this script does is generate a HTML file, and an XML file. You don't need a web server to view them, file/open in your browser would work just as well.
yakko is offline Report Bad Post Report Post
Old 01-17-2005, 04:40 PM   #11 (Print)
BP-isMe
Registered User
 
Join Date: Dec 2003
Location: Boston
Posts: 10
Thanks

I do run a Web Server at my office. I can send the files there if needed. Mostly just playing with this right now.

Thanks for the help...Brad
BP-isMe is offline Report Bad Post Report Post
Old 01-17-2005, 04:42 PM   #12 (Print)
OvrrDrive
Registered User
 
Join Date: Dec 2004
Posts: 157
Well, it looks good...

But why is this better than going to https://tivoIP/nowplaying/index.html?

Isn't it pretty much the same thing?
OvrrDrive is offline Report Bad Post Report Post
Old 01-17-2005, 06:44 PM   #13 (Print)
morac
Registered User
 
morac's Avatar
 
Join Date: Mar 2003
Location: Delran, NJ
Posts: 1,303
Send a message via AIM to morac Send a message via Yahoo to morac
Nice, but I'd like to mention that the code
PHP Code:
 if ($_REQUEST['model'] == "40")
{
    
$freespace 40960 toMB($totalsize);
}

if (
$_REQUEST['model'] == "80")
{
    
$freespace 81920 toMB($totalsize);


is only useful if the TiVo has the stock drives. Why not just use whatever the user inputs time 1024 as the total space?

Technically the code above won't give you the true free space value since there is space on the drive reserved for the OS, yellow stars and other various stuff. So since you can't use the whole drive for recording the formula is flawed.

__________________
Lifetime TCD240080 upgraded to 242 reported hours w/ 7.2.2
Moto DCT 2000 (fw: 07.93, sw: 72.06) - Serial.
USB200M <=> WET54Gv2.
morac is offline Report Bad Post Report Post
Old 01-17-2005, 06:59 PM   #14 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Quote:
Originally posted by morac
is only useful if the TiVo has the stock drives. Why not just use whatever the user inputs time 1024 as the total space?

Technically the code above won't give you the true free space value since there is space on the drive reserved for the OS, yellow stars and other various stuff. So since you can't use the whole drive for recording the formula is flawed. [/B]


good point, i will update the script. i originally started it thinking that i could come up w/some generic formula to figure out available "time" for each quality setting, and quickly scrapped that idea

i do like your *1024 method better.

thanks.

Last edited by clam729 : 01-17-2005 at 07:10 PM.
clam729 is offline Report Bad Post Report Post
Old 01-17-2005, 07:02 PM   #15 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Quote:
Originally posted by JiAvW
Yes you need a webserver. I'm assuming you run windows, which has a built-in webserver (in IIS) that is uninstalled by default (you can go into add/remove programs to install it). I would recommend Apache, but my initial feeling is that you don't have much programming experience.

To install php, you must download the package, from www.php.net

I would highly recommend doing a great deal of research prior to installing a webserver. Running one can be an incredible security hazard.


that's another reason why i chose to go w/the command line version of the script instead of the standard web version.

with this, you do NOT need any web server installed, PHP in this instance is just like any other application, not just for the web.
clam729 is offline Report Bad Post Report Post
Old 01-17-2005, 07:05 PM   #16 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Quote:
Originally posted by OvrrDrive
Well, it looks good...

But why is this better than going to https://tivoIP/nowplaying/index.html?

Isn't it pretty much the same thing?


the data is the same, however, the script is parsing the XML and returning it to your script as an array. from there, you can make it look like anything you'd like, via the CSS, HTM, etc.

data is data, however, i prefer to see it the way i want.

another option that i added today was making my Now Playing list WAP enabled. now the data even looks nice on my PPC =)
clam729 is offline Report Bad Post Report Post
Old 01-17-2005, 08:16 PM   #17 (Print)
morac
Registered User
 
morac's Avatar
 
Join Date: Mar 2003
Location: Delran, NJ
Posts: 1,303
Send a message via AIM to morac Send a message via Yahoo to morac
Is there some reason every show in your attached pictures lists as starting at X:59 or X:29 instead of X:00 or X:30 and has a duration of 29 minutes or 59 minutes instead of 30 minutes or 60 minutes? It looks like you need to add one minute to your times.

edit for explanation
I think I found a flaw. You're ignoring the seconds and just rounding off the minutes which could cause a problem if the TiVo isn't recording to exact minutes. For example if the TiVo reports a time of 29 minutes and 59 seconds, your code will just report 29 minutes.

If you are going to leave off the seconds, it would probably be a good idea to round by adding the following code before the if statement that adds a zero.

if ($secs > 30) $min = $min + 1;

forgive me if this code isn't valid as I'm not all that familiar with php, but you should get the ide.

__________________
Lifetime TCD240080 upgraded to 242 reported hours w/ 7.2.2
Moto DCT 2000 (fw: 07.93, sw: 72.06) - Serial.
USB200M <=> WET54Gv2.

Last edited by morac : 01-17-2005 at 08:32 PM.
morac is offline Report Bad Post Report Post
Old 01-18-2005, 01:01 AM   #18 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Quote:
Originally posted by morac
Nice, but I'd like to mention that the code
PHP Code:
 if ($_REQUEST['model'] == "40")
{
    
$freespace 40960 toMB($totalsize);
}

if (
$_REQUEST['model'] == "80")
{
    
$freespace 81920 toMB($totalsize);


is only useful if the TiVo has the stock drives. Why not just use whatever the user inputs time 1024 as the total space?

Technically the code above won't give you the true free space value since there is space on the drive reserved for the OS, yellow stars and other various stuff. So since you can't use the whole drive for recording the formula is flawed.


the above code can be replaced with this:
PHP Code:
 $freespace = ((intval(trim($_REQUEST['model']))) * 1024) - toMB($totalsize); 
clam729 is offline Report Bad Post Report Post
Old 01-18-2005, 01:21 AM   #19 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
Quote:
Originally posted by morac
Is there some reason every show in your attached pictures lists as starting at X:59 or X:29 instead of X:00 or X:30 and has a duration of 29 minutes or 59 minutes instead of 30 minutes or 60 minutes? It looks like you need to add one minute to your times.


The data retrieved from the TiVo is this 0x41ECA5DE, which would then get processed like this:
PHP Code:
 echo date("g:i a - F j, Y"hexdec("0x41ECA5DE")); 

and would display:
8:59 pm - January 17, 2005, even though the show did in fact start at 9:00. I checked it against all my other shows and they are all that way. Now, the 'i' parameter of PHPs' DATE is from 00-59, so, I'm not sure if TiVo is saving the data this way, or it is PHPs' conversion.

It would be simple enough to pad a minute, however, if you set your recording to record 1 minute earlier, I wonder how it would process.

I'll set up a test recording to check it out...
clam729 is offline Report Bad Post Report Post
Old 01-18-2005, 02:42 AM   #20 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
alot of progress tonight. finally, the code for the icons, channels and ALL the urls is completed. i'm happy. plus i started on my own "transfer/download" scheduling script, it's coming along nicely.

see, tivo has always said "tv your way", well, with these scripts, it's now "data my way".

i like the builtin now playing screen, but i'd rather have it use my stylesheet, tooltips, etc.

now if we could only get access to the todo list, suggestions, etc.

tivobill, do you know of any other web pages inside the tivo?
clam729 is offline Report Bad Post Report Post
Old 01-18-2005, 06:56 AM   #21 (Print)
gonzotek
tivo_xml developer
 
gonzotek's Avatar
 
Join Date: Sep 2004
Location: Outside Phildadelphia
Posts: 1,042
Quote:
Originally posted by clam729
alot of progress tonight. finally, the code for the icons, channels and ALL the urls is completed. i'm happy. plus i started on my own "transfer/download" scheduling script, it's coming along nicely.

see, tivo has always said "tv your way", well, with these scripts, it's now "data my way".

i like the builtin now playing screen, but i'd rather have it use my stylesheet, tooltips, etc.

now if we could only get access to the todo list, suggestions, etc.

tivobill, do you know of any other web pages inside the tivo?

Regarding the rounding errors: I'm aware of them and I think I know what's wrong.

Regarding other available data: I've been studying the developer docs for the music and photo's calypso protocol(HMOMusicPhotosSpecv1.1.pdf, from tivo.com/developer), and if I'm reading it right, what we have in the TiVo webserver is an implementation of a calypso server and the only available info is NowPlaying and the TiVoVideoDetails pages. If I'm reading it right, sending this command:
http://{machine}/TiVoConnect?Command=QueryContainer
should get a reply from the TiVo about what containers it is currently aware of. Unfortunately, the only container returned is NowPlaying. Maybe more will be in future updates?

EDIT: SEE MY CORRECTION IN MY NEXT POST

Last edited by gonzotek : 01-18-2005 at 01:11 PM.
gonzotek is offline Report Bad Post Report Post
Old 01-18-2005, 09:54 AM   #22 (Print)
toddman
The Word of Todd
 
toddman's Avatar
 
Join Date: Mar 2004
Location: Atlanta
Posts: 73
I haven't implemented your work yet, but this is great stuff! Thanks a bunch.

I'm looking forward to seeing your updated files. Thanks again!

__________________
-Todd

Now Playing
toddman is offline Report Bad Post Report Post
Old 01-18-2005, 12:52 PM   #23 (Print)
chrisirmo
Registered User
 
chrisirmo's Avatar
 
Join Date: Feb 2004
Location: Cincinnati, OH
Posts: 597
Can anyone tell me how to keep the wget download from timing out? On my 282 hour TiVo I get a timeout error while the file is downloading. I've tried adding "--timeout=90" into the wget call in the class_tivo_xml file but I still continue to get the error.

EDIT:
I get this error: "Fatal Error: Maximum execution time of 30 seconds exceeded"

__________________
Dumped all but one TiVo in favor of the SA8300HD:
HDTV, Two Tuners, Wishlists, the kitchen sink.
Now: One 282 Hour Series 2 SA

Last edited by chrisirmo : 01-18-2005 at 01:00 PM.
chrisirmo is offline Report Bad Post Report Post
Old 01-18-2005, 01:07 PM   #24 (Print)
gonzotek
tivo_xml developer
 
gonzotek's Avatar
 
Join Date: Sep 2004
Location: Outside Phildadelphia
Posts: 1,042
Quote:
Originally posted by chrisirmo
Can anyone tell me how to keep the wget download from timing out? On my 282 hour TiVo I get a timeout error while the file is downloading. I've tried adding "--timeout=90" into the wget call in the class_tivo_xml file but I still continue to get the error.

EDIT:
I get this error: "Fatal Error: Maximum execution time of 30 seconds exceeded"
That would be the PHP "max execution time" feature. PHP, by default, kills any script that take longer than 30 seconds to return any output. You can override this with set_time_limit, or changing php.ini.
see http://us2.php.net/set_time_limit for more info.


Also, a correction to my last post:
https://{machine}/TiVoConnect?Command=QueryServer
should be:
https://{machine}/TiVoConnect?Command=QueryContainer

QueryServer only returns the server version. QueryContainer, with no other parameters, shows the available containers.
gonzotek is offline Report Bad Post Report Post
Old 01-18-2005, 01:10 PM   #25 (Print)
chrisirmo
Registered User
 
chrisirmo's Avatar
 
Join Date: Feb 2004
Location: Cincinnati, OH
Posts: 597
Quote:
Originally posted by gonzotek
[B]That would be the PHP "max execution time" feature. PHP, by default, kills any script that take longer than 30 seconds to return any output. You can override this with set_time_limit, or changing php.ini.
see http://us2.php.net/set_time_limit for more info.


Thanks, I edited php.ini and all is well now.

__________________
Dumped all but one TiVo in favor of the SA8300HD:
HDTV, Two Tuners, Wishlists, the kitchen sink.
Now: One 282 Hour Series 2 SA
chrisirmo is offline Report Bad Post Report Post
Old 01-18-2005, 02:12 PM   #26 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
even better, i'll update the script and make a call to
PHP Code:
 ini_set("max_execution_time""xx"); 

http://us2.php.net/ini_set

that way, only this script will need the extended time, and would not affect any other scripts running on your machine.

good catch chrisirmo
clam729 is offline Report Bad Post Report Post
Old 01-18-2005, 11:15 PM   #27 (Print)
clam729
Registered User
 
Join Date: Nov 2004
Posts: 158
just an update - still working on updating the original code. i have received several wonderful tips and code snippets from morac and i am busy integrating them now =)

i hope to have an interim release very soon.
thanks again to everyone for their suggestions/corrections/etc.
clam729 is offline Report Bad Post Report Post
Old 01-19-2005, 07:27 AM   #28 (Print)
morac
Registered User
 
morac's Avatar
 
Join Date: Mar 2003
Location: Delran, NJ
Posts: 1,303
Send a message via AIM to morac Send a message via Yahoo to morac
In case you missed, I'd like to point you to a thread started by KRKeegan who came up with a way to download from the TiVo without using wget using perl. I don't know if this can be used with php or not, but it's worth looking into. All I found was this:

http://www.php-faq.com/httprequest.php

__________________
Lifetime TCD240080 upgraded to 242 reported hours w/ 7.2.2
Moto DCT 2000 (fw: 07.93, sw: 72.06) - Serial.
USB200M <=> WET54Gv2.

Last edited by morac : 01-19-2005 at 10:49 AM.
morac is offline Report Bad Post Report Post
Old 01-19-2005, 07:41 AM   #29 (Print)
yakko
Registered User
 
Join Date: Jun 2003
Posts: 53
What about using PHP's Include feature? could you include the tivo data and write that off to disk using only PHP? I might try it when I get to work...
yakko is offline Report Bad Post Report Post
Old 01-19-2005, 07:58 AM   #30 (Print)
gonzotek
tivo_xml developer
 
gonzotek's Avatar
 
Join Date: Sep 2004
Location: Outside Phildadelphia
Posts: 1,042
I'm looking into a direct download via php as well. There was more to digest auth than I thought, but it's doable.
gonzotek is offline Report Bad Post Report Post
 
Forum Jump
Thread Tools

Go Back  TiVo Community Archive2 > Main TiVo Forums > TiVo Home Media Features & TiVoToGo

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 06:12 PM.


Powered by: vBulletin Version 3.0.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
(C)opyright - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not affiliated with TiVo Inc.


Spider History Index