Matt's Blog - aka DarwinsTheory |
I've been writing usage meters for ISP's now for about 6 years and generally using vbscript and Samurize.. I really liked the combo as it allowed anyone to modify the UI without having any coding skills and the code was also pretty simple for people to have a hack at.
Having recently made the move to a Linux desktop (i love ubuntu) Samurize is no long an option and obviously vb is seriously limited., (although there is a project to provide a framework for .net on Linux.)
So I decided to look at a simple cross platform language to provide the same functionality and finally decided on Python.... easy to use, heaps of modules and no worries with Windows and Linux.
I got the backend written pretty quick, ie login to the ISP and scrape the usage data. The challenge was going to be a UI that could be easily customised.... frankly i haven't found anything like Samurize for Linux and so fell back to finding something that people could still learn pretty quickly... gDesklets looked like the best solution but frankly i drove myself nuts trying to get the backend wrapped in a class etc... it just kept erroring and after a few days i gave in...
So another search and I found Screenlets... no documentation but it looks good and there was enough examples for me to hack around and get my UI working.
If your looking at something and think... hmmmm.. thats stupid... you gotta give me some slack, new to Linux, Python and Screenlets... lol
So my code comes in two parts;
isp_usagescraper_
The UI – For windows this is a simple Samurize interface that extracts data from the XML file and displays it... Feel free to customise and modify as much as you like.. its really easy.
On Linux the UI is built in Screenlets and unfortunately your going to have to really hack around in Python to change the look and feel.
Download and install ActivePython (needed for Samurize, other versions don't seem to work).
http://www.activestate.com/Products/activepython/index.plex
Download and install Samurize
Download my samurize package and double click, this will offer to automatically install it.
http://www.taet.com.au/mb.nsf/DOWNLOADS/8A51B3BC7BB4A6FCCA257366000129A5/$FILE/Netspeedv3.sam
Once installed you will need to load the Samurize config editor and work through all the properties for your usage plan.
Click Start\All Programs\Serious Samurize\Config Tool
As marked in the diagram above click on the black text that says “Update: [Not”
Then Click Edit Meters
Then Click Source
Then Click Change Parameters (each one should be self explanatory.. Login name is blah@netspeed.com.au)

You should now be able to click test on check that it works and the file is downloaded, double click the file to check that the data looks right.
Rel 1 – Virtually no error checking.. so if it works great it not.......
Rel 2 - Minor fixes
Rel 3 - Huge update, now includes current session downloads so is far more accurate and updates without having to disconnect etc.
Improve the error handling and generally make the code more robust.
Port the backend so it can be used for gDesklets
Huge thanks to Angelo at Velocity who whipped up a custom HTML page to make scraping really easy.
Thanks to the creators of Screenlets and Samurize for providing tools to make an easy to use and modify UI.
Thanks to all those people who created the great examples and howto's which I leverage to hack this thing together.
Zero thanks to Netspeed for making no effort to provide any information or simple site etc... out of 6 isp's the ONLY one who hasn't helped..
Basically use at your own risk, no warranty, blah blah... I'm providing all the source code and your getting it for nothing.. don't wanna hear about how you over ran your usage and cost you money. In fact if you have a need to blame the rest of the world for your issues then piss off and don't download it at all.... geeeez
Note: You can access all downloads here