Click here to go to the forum index Click here for the home page
 
Author Message

<  TAP and patch development  ~  Email Viewer

Page 1 of 2
Goto page 1, 2  Next
EMJB
Posted: Thu Mar 04, 2010 10:53 am Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3639 Location: Maldon Essex
Thanks to help provided in another thread, I have now got a useable facility working to display incoming emails thus:



and if the user wishes he/she can view it as follows:



The alert is also shown on the 5800 front panel.

It consists of a TAP and a Perl application which should run on a slug, ASUS, LinkStation etc.

At present there are a number of limitations, bugs etc and I have only tried it on a LinkStation. If anyone is interested in using or improving this, everything necessary should be included in here, but note that the instructions are definitely not suitable for novices.

EMJB
View user's profile Send private message
billmars
Posted: Thu Mar 04, 2010 6:52 pm Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
I've got this working OK on an NSLU2. It collects emails and sends them to the Topfield. However the TAP only shows the headers, not the body. Your test email displays OK, and the email deposited in the Topfield Email folder by the NSLU2 shows all the message when viewed with a text viewer.
This is my test email:-
Code:
FROM:  Bill Marsden

SUBJECT:  Re: Toppy email test

TIMED:  Thu, 04 Mar 2010 15:05:06

On Thu, 04 Mar 2010 14:57:10 +0000, you wrote:

>/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer
>/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer
>/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer
>/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer/public/EmailViewer
>
>end of test message

....and this is a reply.....
--
Bill Marsden

The email TAP only shows the first four lines.

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800
EMJB
Posted: Thu Mar 04, 2010 7:03 pm Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3639 Location: Maldon Essex
billmars wrote:
I've got this working OK on an NSLU2. It collects emails and sends them to the Topfield.
Good news that you have sorted the potentially difficult bit so quickly. If other slug users want to use it, perhaps you could produce the relevant slug instructions.
billmars wrote:
However the TAP only shows the headers, not the body. Your test email displays OK, and the email deposited in the Topfield Email folder by the NSLU2 shows all the message when viewed with a text viewer....
Can you upload the message file sent to the Toppy to somewhere I can access so that I can investigate? I imagine there is some strange formatting character there that my TAP does not like.

EMJB
View user's profile Send private message
billmars
Posted: Thu Mar 04, 2010 7:39 pm Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
Bit early to give install instructions - I'm only running it manually using PuTTY!

The 'code' bit in my earlier post _is_ the message as uploaded onto the Topfield.

Here's another one which shows only the top 3 lines (doesn't even show the last line).
Code:
FROM:  Bill Marsden

SUBJECT:  Toppy email test

TIMED:  Thu, 04 Mar 2010 18:13:47

/public/EmailViewer/toppyemail.sh/public/EmailViewer/toppyemail.sh/public/EmailViewer/toppyemail.sh
/public/EmailViewer/toppyemail.sh/public/EmailViewer/toppyemail.sh/public/EmailViewer/toppyemail.sh
/public/EmailViewer/toppyemail.sh/public/EmailViewer/toppyemail.sh/public/EmailViewer/toppyemail.sh

end of test message
--
Bill Marsden

I've tried with a few emails and they all display in the same way.
By the way, it's very difficult to look at the email txt files after you've looked at them, because they seem to be deleted even if 'exit' is used
after reading.
I've also noted that the TAP doesn't seem to pick up the emails when it's running, only when it is stopped and re-started.

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800
EMJB
Posted: Thu Mar 04, 2010 7:55 pm Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3639 Location: Maldon Essex
@ Bill,

Just realised what the problem is with your test email. Each line is a single "word", which won't fit on one line on the screen, so it moves it onto the next line, where it still won't fit ad infinitum!

Not sure why you are not seeing emails when running normally - has been working OK for a couple of days.

Will try to look at both in the next couple of days.

EMJB
View user's profile Send private message
billmars
Posted: Thu Mar 04, 2010 8:20 pm Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
Do you mean it would work if I had put spaces in those lines?
I did notice that scrolling down seemed to go on for ever!

I'll leave it with you for a bit!

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800
EMJB
Posted: Thu Mar 04, 2010 8:25 pm Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3639 Location: Maldon Essex
billmars wrote:
Do you mean it would work if I had put spaces in those lines?

Yes!

EMJB
View user's profile Send private message
billmars
Posted: Thu Mar 04, 2010 9:31 pm Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
Yes - I changed the body to 'normal' prose and it displayed OK.
Still a problem with the TAP not noticing a new email after it has initially found one.
With the TAP running and an email already found and read and deleted (so there are no files in the email folder), manually copying your test email to the email folder does not result in the TAP noticing it. Should it?
Once it did identify the file, and there was an error message box, but I was unable to read what it said because the TAP display disappeared too quickly with no option to read the email.
Stopping the TAP and re-starting, does find the email.

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800
EMJB
Posted: Fri Mar 05, 2010 10:32 am Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3639 Location: Maldon Essex
I have updated the TAP to X4 in here with the following changes:

(1) Fix for the problem where a word exceeds the line length - works Ok for me with the long lines posted by billmars above. The result doesn't look very pretty, but very difficult to know how to display such text in a clean way without quite complex logic.

(2) Deletes current message when closing TAP from either screen (was just message screen).

(3) Extended error message display time when TF5000 Display TAP fails to stop, as that is the only one I can think of that billmars saw.

With regards to not seeing subsequent messages, billmar, are you sure you waited long enough? With the default settings it only checks for emails every minute. I have not been able to reproduce this problem.

EMJB
View user's profile Send private message
billmars
Posted: Fri Mar 05, 2010 11:44 am Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
I'll try X4 today.

I don't usually send emails without any spaces or carriage returns! I simply used what was on the clipboard a few times for the email body, inadvertently showing up this probably not realistic problem!

A quick test of X4 seems to be picking up new emails without a re-start.
I'll test some more. (Quite long winded isn't it!)

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800
billmars
Posted: Sat Mar 06, 2010 12:01 am Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
EMJB wrote:
If other slug users want to use it, perhaps you could produce the relevant slug instructions.


Here are some quick notes for NSLU2 installation:-

____________________________________________________________

Follow EMJB's install PDF in the ZIP file.

Create folders under the NSLU2's /public folder:-
/public/EmailViewer (into which you place your modified toppyemail.sh file)
/public/EmailViewer/perl (into which you place your modified Email.cfg file)
/public/EmailViewer/perl/Mail (this is your 'working directory')

It is important to have all these folders and files with a permission of 0775.
(use WinSCP to change permissions)

Enter these locations into the appropriate place in 'toppyemail.sh' and 'Email.cfg' files.

Puppy was in /opt/bin/puppy on my system - you may have to install it.

Make sure perl is installed (I'm not sure if it is by default).

Use ipkg to install packages ('ipkg install ipkg-web' for an easier to use web based frontend).

Create the folders mentioned in points 6 and 7 in the PDF and copy the correct files to the appropriate folders.
My NSLU2 did not have these folders.

I set up a cron job to run the EmailViewer every ten minutes.
Add this line to the file 'crontab':-
0,10,20,30,40,50 * * * * root /public/EmailViewer/toppyemail.sh
Your 'crontab' file should be found in the folder /etc.

____________________________________________________________

Hope this helps....

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800
EMJB
Posted: Sat Mar 06, 2010 8:50 am Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3639 Location: Maldon Essex
@billmars:

Thanks for that.

billmars wrote:
I set up a cron job to run the EmailViewer every ten minutes.
Add this line to the file 'crontab':-
0,10,20,30,40,50 * * * * root /public/EmailViewer/toppyemail.sh
Your 'crontab' file should be found in the folder /etc..


If you are going to run this in this way you will need to include "MaxRunLoops______:1" in your cfg file, or a new version will start running every ten minutes, and the old ones won't stop as far as I can see. You will also need to enable the call to "sub get_history_and_last_log" as otherwise it will keep finding emails that it found the previous occasion.

EMJB
View user's profile Send private message
billmars
Posted: Sat Mar 06, 2010 12:08 pm Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
I only set the cron job up last night, having failed to get EmailViewer to run at NSLU2 reboot - in fact the NSLU2 failed to boot up properly and I was only able to recover by enabling telnet (fortunately the web interface was still working) and editing 'rc-local' with vi to get rid of EmailViewer. My Linux knowledge is very limited and I may be doing something very stupid!

With regard to EmailViewer starting new versions every ten minutes without stopping the previous ones, I don't think I'm seeing this. Looking at running processes there is only one entry for EmailViewer. If each instance is not shutting down I presume I would see multiple entries?

It also seems to be recognising emails it has seen before. The log file shows (extract):-

Code:
Have seen this message before!
Chosen base filename: Bill Marsden_23_40_13
Found message from ' Bill Marsden <bill@*********>' about ' Re: toppy email test' at ' Fri, 05 Mar 2010 23:40:13 +0000'
Have seen this message before!
Chosen base filename: Bill Marsden_23_39_11
Found message from ' Bill Marsden <bill@*********>' about ' Re: toppy email test' at ' Fri, 05 Mar 2010 23:39:11 +0000'
Mailbox has 2 message(s).
Looking for emails at Sat Mar  6 10:04:03 2010
Starting sleep at     Sat Mar  6 09:54:09 2010
Have seen this message before!
Chosen base filename: Bill Marsden_23_40_13
Found message from ' Bill Marsden <bill@*********>' about ' Re: toppy email test' at ' Fri, 05 Mar 2010 23:40:13 +0000'

How often is the log file written?

I'll try altering things as you suggest.

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800
EMJB
Posted: Sat Mar 06, 2010 1:02 pm Reply with quote
Frequent contributor Joined: 08 Jul 2005 Posts: 3639 Location: Maldon Essex
@billmars,

Its looks rather as if the subsequent versions are not being run at all, in which case the changes I suggested are not needed - you appear to have found a way of starting soon after boot! Perhaps there is some logic to ensure you can run only one copy of a Perl script, or even only one Perl script, at a time.

EMJB
View user's profile Send private message
billmars
Posted: Sat Mar 06, 2010 1:26 pm Reply with quote
Frequent contributor Joined: 17 Sep 2005 Posts: 761
Maybe a crontab entry like this:-
Code:
@reboot root /public/EmailViewer/toppyemail.sh
will suffice?

_________________
BM
Firmware
5800 Samsung 1Tb Autostart TAPs: Extend 1.7;TSRCommander 1.5;TF5000 Display 1.53;EPG2MEI 0.95;MyStuff 6.6;QuickJump 1.72;Power Down 0.75;SecCache 0.4;TSSaver 0.4;MHEG Control B2;eit_sub_sng 0.6 Transmitter: Belmont Extras: as2mei (via NSLU2)
View user's profile Send private message TF5800

Display posts from previous:  

All times are GMT + 1 Hour
Page 1 of 2
Goto page 1, 2  Next

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum