![]() |
![]() |
|
|
Compare Products, Prices & Stores For: COMPUTERS, COMPONENTS, COMPUTER ACCESSORIES, COMPUTER MEMORY, HARDWARE, INPUT DEVICES, NETWORKING, PDAs & MOBILE ELECTRONICS, SOFTWARE, STORAGE & MEDIA, DIGITAL CAMERAS, HOME AUDIO, TV& VIDEO |
|
|
|
|
#1
|
||||
|
||||
|
Simple Tivo mail sender
added 'stdin' feature so it will work with pipes like this: Code:
ls -la /var/hack | mailfile stdin "These files are in /var/hack" joe@blow.com smartctl -H -i /dev/hda | mailfile stdin "smartctl status of /dev/hda " joe@blow.com Note: This was modified from TivoMaster's version below so his changes are there as well. -------------------------- This script is a stripped down version of Stuart Anderton's dailymail script. This script merely sends a specified text file as the body of the message to specificed recipient and with a specified subject. It's a very simple SMTP client with a little error checking. It could be improved to do more error checking. The usage is like this: mailfile.tcl /etc/rc.sysinit.author "Dude, check out all the noise my Tivo makes" joe@blow.com A script like this might be handy: #!/bin/sh ( echo "--[ SMARTCTL ]--------------------" smartctl -H -i /dev/hda echo "--[ EXT2 FileSystem usage ]--------" df -vh echo "--[ /var/log/tverr ]------------------" cat /var/log/tverr ) > /tmp/message.out mailfile.tcl /tmp/message.out "Tivo Critical Info" joe@blow.com Props to Stuart for showing us how. Last edited by cojonesdetoro; 05-19-2004 at 02:37 PM. |
|
#2
|
||||
|
||||
|
Cool, This will work GREAT with the smartd daemon which I am trying to get scripted. With this I can have it monitor the drives and email me if it is failing. I already have it generating tivo messages....
__________________
Four Hacked HDVR2's, One Still slightly confused Hacker, 4 dogs, 8 cats, and 1 wife that is happy as long as I don't screw up her TiVo ...... Oh yeah two grandchildren that are the light of my life!
|
|
#3
|
||||
|
||||
|
I've already started stripping down the dailymail app so I can print conflicts, todos, uptime, phone status and smartctl to stdout or a file.
I run a little bash script to populate the txt file in the order I wish and then mail it off. I also stripped out all the HTML so I can place the file as a Tivo message and have it be more readable. I find it handy to be able to get the information in dailymail as separate modules that I can choose ala carte in any order I wish. Stuart did all the brain work but I'm having fun hacking up his code to suit my needs. BTW: I won't post the other stuff because it's ugly and may not work on other Tivos besides a HDR312SA1 in the Eastern Time Zone. If anyone asks I'll send it as a mail attachment but It should be easy enough for anyone to hack dailymail themselves once they take a look at it. It's a pretty easy read even though there's not a lot of comments. Last edited by cojonesdetoro; 01-28-2004 at 09:26 AM. |
|
#4
|
||||
|
||||
|
There's been WAY more interest in DailyMail than I expected - the original was a very Q&D hack for my own use I just posted for the hell of it.
Over on TC folks have now got it with in-line graphics, checking their HD health, drawing space free graphs, making the tea etc. But the whole thing is balanced on some horribly rough code. I've been considering re-writing it TivoWeb style; ie a core program to send mail with drop-in modules for the info that people might want to send, using some kind of standardised interface. So many hacks, so little time... BTW: You're just dumping the file contents to the mail server; 9 times out of 10 that will work, but most mail servers will only cope with a fairly limited number of characters per line, so you'll need to be sure that the file you send does not have any long paras. The descriptions of some shows were too long to send as one line, for example. That's why DailyMail has a silly-looking bit of code to cut up the text into words and send them one at a time!
__________________
Stuart Newbies - see if your questions are answered here Experts - can you add to the knowledge stored here? Developers - are your hacks listed here? Last edited by sanderton; 01-28-2004 at 12:21 PM. |
|
#5
|
||||
|
||||
|
Quote:
Ahh.. I was wondering why all the nested foreach statements where there. I'll look into it.... how about the 'fmt' binary? Tivo1# fmt --help Usage: fmt [-DIGITS] [OPTION]... [FILE]... Reformat each paragraph in the FILE(s), writing to standard output. If no FILE or if FILE is `-', read standard input. Mandatory arguments to long options are mandatory for short options too. -c, --crown-margin preserve indentation of first two lines -p, --prefix=STRING combine only lines having STRING as prefix -s, --split-only split long lines, but do not refill -t, --tagged-paragraph indentation of first line different from second -u, --uniform-spacing one space between words, two after sentences -w, --width=NUMBER maximum line width (default of 75 columns) --help display this help and exit --version output version information and exit In -wNUMBER, the letter `w' may be omitted. Report bugs to textutils-bugs@gnu.ai.mit.edu I could change this line: puts $chan [exec cat $file ] to this: puts $chan [exec cat $file | fmt ] It seems to work. I can rewrite it to use the fmt tivo hack binary and include the binary in the zip file. I can then include parameters supported by fmt as settings at the top of the script. I guess I should write tcl code that will do it but I'm not very good with tcl. EDIT: Now that I think of it, I'll leave it up to the user to properly format the file. It's better to leave it as a small widget that does what it does, that is, send a file. Anyone who needs it can use the fmt binary on their own. Last edited by cojonesdetoro; 01-28-2004 at 02:43 PM. |
|
#6
|
||||
|
||||
|
CojonesDeToro,
I updated mailfile a little. You can now specify to send to either an email addy, the TiVo message que or the Pre-TiVo messag que. I also made it so that if you wanted just to send a string you could without having to copy it to a file and send the file. This is good for quick warning etc messages. Here are the new options/runstring. ---------------- mailfile.tcl A simple TCL script for Tivo that will mail a file or text as the body of the message to a specified recipient or the Tivo message center usage: mailfile.tcl <file path/text-to-send> <subject> <recpient> where: <file path> is the text file that would be the body of the message <text-to-send> is the text to send (use quotes for more than one word) <subject> is the mail subject (use quotes for more than one word) <recipeint> is a single mail recipient like joe@blow.com or tivo to send to TiVo message que or pretivo to send to PreTiVo message que sample usage: mailfile.tcl /etc/rc.d/rc.sysinit "rc.sysinit file from tivo" joe@blow.com mailfile.tcl "text to send" "text message from tivo" joe@blow.com mailfile.tcl "text to send" "text message from tivo" tivo mailfile.tcl "text to send" "text message from tivo" pretivo Note: be sure to edit the script for setting mail server and domain
__________________
Four Hacked HDVR2's, One Still slightly confused Hacker, 4 dogs, 8 cats, and 1 wife that is happy as long as I don't screw up her TiVo ...... Oh yeah two grandchildren that are the light of my life!
|
|
#7
|
||||
|
||||
|
Quote:
|
|
#8
|
||||
|
||||
|
Quote:
Didn't think about that... Oh well, this will at least let you put a little more detailed description the the body as text...
__________________
Four Hacked HDVR2's, One Still slightly confused Hacker, 4 dogs, 8 cats, and 1 wife that is happy as long as I don't screw up her TiVo ...... Oh yeah two grandchildren that are the light of my life!
|
|
#9
|
||||
|
||||
|
Added feature to accept stdin as file
added 'stdin' feature so it will work with pipes.
see top post.
__________________
perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";' Last edited by cojonesdetoro; 05-19-2004 at 02:38 PM. |
|
#10
|
|||
|
|||
|
I submited a message to pretivo and now it comes up after the system has been in stanby. How long does it take for these to go away and is there any way to manually remove that message?
__________________
DSR-708/80GB/4.0.1b DSR-704/80GB/6.2 |
|
#11
|
||||
|
||||
|
pretivo messages wil pop up in your face when you press the Tivo key but that should only happen once. After that the message will expire in two weeks and go away.
Also look here: http://www.dealdatabase.com/forum/sh...tcl#post190546 This script only deletes regular tivo messages bu you can modify this string: "/MessageItem/MessageBoard" To delete Pretivo messages. I don't know the exact string but you can find it by looking at the source code of this script.
__________________
perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";' |
|
#12
|
||||
|
||||
|
mailfile.tcl error message when sending to tivo
I was trying out the mailfile.tcl on my series 2 - version 6.2 and I am having problems with the following line:
# event send $TmkEvent::EVT_DATA_CHANGED 12 0 As you can see I commented it out and it works fine when sending a message to the tivo unit. Is this line important? What would be the equivalent line for a series 2 ver 6.2? |
|
#13
|
||||
|
||||
|
Quote:
I have seen this in other code that redraws the on screen menus to reflect changed information so it probably instructs the Tivo to refresh the list of mail messages. Without it your new mail message may not show up immediately.
__________________
perl -e 'print unpack("u","\@2\&\%V92\!Y;W4\@:&\%C:V5D(\%E/55\(\@5\&EV\;R\!T;V1A>3\\-\`"),"\n";' |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|