diff options
Diffstat (limited to '')
-rw-r--r-- | contrib/picoLCD/lcd4linux.conf | 628 | ||||
-rw-r--r-- | contrib/picoLCD/lcd4linux.conf.mrtg | 91 | ||||
-rw-r--r-- | contrib/picoLCD/lcd4linux.conf.rss | 142 | ||||
-rw-r--r-- | contrib/picoLCD/lcd4linux.conf.rss.timers | 127 | ||||
-rw-r--r-- | contrib/picoLCD/mrtg.py | 21 | ||||
-rw-r--r-- | contrib/picoLCD/rsstimer.py | 92 |
6 files changed, 1101 insertions, 0 deletions
diff --git a/contrib/picoLCD/lcd4linux.conf b/contrib/picoLCD/lcd4linux.conf new file mode 100644 index 0000000..8901fe2 --- /dev/null +++ b/contrib/picoLCD/lcd4linux.conf @@ -0,0 +1,628 @@ +Display picoLCD { + Driver 'picoLCDGraphic' + Size '256x64' + Contrast 230 + Backlight 1 + Inverted 1 + Icons 1 +} + +Variables { + tick 500 + tack 100 + minute 60000 +} + + + + + +#Plugin MySQL { +# server 'gsmlandia.com' # if none, localhost assumed +# port 3306 # if none, MySQL default assumed +# user 'lcd4linux' # if none, lcd4linux unix owner assumed +# password 'lcd4linux' # if none, empty password assumed +# database 'lcd4linux' # MUST be specified +#} + +#Plugin Pop3 { +# server1 'localhost' +# port1 110 +# user1 'user' +# password1 'pass' +#} + + +Widget OS { + class 'Text' + expression '*** '.uname('sysname').' '.uname('release').' ***' + width 20 + align 'M' + style 'bold' + speed 50 + update tick +} + + + + +Widget HDDTemp { + class 'Text' + expression 'IDE Temp'.exec ('hddtemp /dev/sda | cut -f 3 -d :', 1000) + width 14 + align 'L' + update 1000 +} + +Widget FSSpace { + class 'Text' + expression a=((statfs('/', 'bavail')*statfs('/', 'bsize'))/1024/1024);b=((statfs('/media/disk', 'bavail')*statfs('/media/disk', 'bsize'))/1024/1024);c='/ '.' '.a.'MB /media/disk/ '.b.' MB' + prefix 'Free Space:' + postfix '' + width 42 + align 'M' + #precision 0 + update 1000 +} + + +Widget BottomTicker { + class 'Text' + expression uname('sysname').' '.uname('nodename').' '.uname('release').' '.uname('machine').' '.cpuinfo('model name') + #expression strftime('%A %d/%m %H:%M:%S',time()).' '.cpuinfo('model name').' '. uptime('%d days %H:%M:%S') + #expression strftime('%A %d/%m %H:%M:%S',time()) + prefix '' + width 42 + align 'M' + speed 1000 + update tick + style 'bold' +} + +#Widget CPU { +# class 'Text' +# expression uname('machine') +# prefix 'CPU ' +# width 9 +# align 'L' +# style test::onoff(7)>0?'bold':'norm' +# update tick +#} + + +Widget CPULabel { + class 'text' + expression 'CPU:' + width 4 + align 'L' + style 'bold' +} + +Widget CPU { + class 'Text' + expression proc_stat::cpu('busy', 500) + prefix '' + postfix '% ' + width 5 + precision 0 + align 'R' + update tick +} + +Widget CPUBar { + class 'Bar' + expression proc_stat::cpu('busy', 500) + expression2 proc_stat::cpu('system', 500) + length 10 + min 1 + max 100 + direction 'E' + style 'H' + update tick +} + + +Widget RAMLabel { + class 'text' + expression 'RAM:' + width 4 + align 'L' + style 'bold' +} + + +Widget RAMTotal { + class 'Text' + expression meminfo('MemTotal')/1024 + postfix 'MB FREE' + width 11 + precision 0 + align 'L' + update tick +} + +Widget RAMFree { + class 'Text' + expression meminfo('MemFree')/1024 + prefix '' + postfix '/' + width 5 + precision 0 + align 'R' + update tick +} + +Widget IDELabel { + class 'text' + expression 'IDE:' + width 4 + align 'L' + style 'bold' +} + +Widget IDEIn { + class 'text' + # In MB/s + expression (diskstats('sda', 'read_sectors', 500))/2048 + prefix 'OUT ' + postfix 'MB' + precision 2 + align 'R' + width 10 + update tick +} + +Widget IDEOut { + class 'text' + # In MB/s + expression (diskstats('sda', 'write_sectors', 500))/2048 + prefix 'IN ' + postfix 'MB' + precision 2 + align 'R' + width 10 + update tick +} + +Widget IDEBar { + class 'Bar' + expression diskstats('sda', 'read_sectors', 500) + expression2 diskstats('sda', 'write_sectors', 500) + length 14 + direction 'E' + style 'H' + update tick +} + +Widget ETHLabel { + class 'text' + expression 'ETH:' + width 4 + align 'L' + style 'bold' +} + + +Widget ETHIn { + class 'Text' + expression (netdev('eth0', 'Rx_bytes', 500))/1024 + prefix 'OUT' + postfix 'KB' + width 9 + precision 0 + align 'R' + update tick +} + +Widget ETHOut { + class 'Text' + expression (netdev('eth0', 'Tx_bytes', 500))/1024 + prefix 'IN' + postfix 'KB' + width 9 + precision 0 + align 'R' + update tick +} + +Widget ETHBar { + class 'Bar' + expression netdev('eth0', 'Rx_bytes', 500) + expression2 netdev('eth0', 'Tx_bytes', 500) + length 14 + direction 'E' + style 'H' + update tick +} + +Widget Time { + class 'Text' + expression strftime('%a,%d/%m %H:%M:%S',time()) + width 20 + align 'Left' + update 1000 +} + +Widget Uptime { + class 'Text' + expression uptime('%d d %H:%M:%S') + width 21 + align 'R' + prefix 'Uptime ' + update 1000 +} + + +#Widget Disk { +# class 'Text' +# # disk.[rw]blk return blocks, we assume a blocksize of 512 +# # to get the number in kB/s we would do blk*512/1024, which is blk/2 +# # expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2 +# # with kernel 2.6, disk_io disappeared from /proc/stat but moved to /proc/diskstat +# # therefore you have to use another function called 'diskstats': +# expression diskstats('sda', 'read_sectors', 500) + diskstats('sda', 'write_sectors', 500) +# prefix '' +# postfix ' ' +# width 7 +# precision 0 +# align 'R' +# update tick +#} + +#Widget DiskBar { +# class 'Bar' +# #expression proc_stat::disk('.*', 'rblk', 500) +# #expression2 proc_stat::disk('.*', 'wblk', 500) +# # for kernel 2.6: +# expression diskstats('sda', 'read_sectors', 500) +# expression2 diskstats('sda', 'write_sectors', 500) +# length 14 +# direction 'E' +# update tack +#} + + +Widget PPP { + class 'Text' + expression (ppp('Rx:0', 500)+ppp('Tx:0', 500)) + prefix 'PPP' + width 9 + precision 0 + align 'R' + update tick +} + +Widget Temp { + class 'Text' + expression i2c_sensors('temp_input3')*1.0324-67 + prefix 'Temp' + width 9 + precision 1 + align 'R' + update tick +} + +Widget TempBar { + class 'Bar' + expression i2c_sensors('temp_input3')*1.0324-67 + min 40 + max 80 + length 10 + direction 'E' + update tack +} + +Widget MySQLtest1 { + class 'Text' + expression MySQL::query('SELECT id FROM table1') + width 20 + align 'R' + prefix 'MySQL test:' + update minute +} + +Widget MySQLtest2 { + class 'Text' + expression MySQL::status() + width 20 + align 'M' + prefix 'Status: ' + update minute +} + + + + +# Icons + +Widget Heartbeat { + class 'Icon' + speed 800 + Bitmap { + Row1 '.....|.....' + Row2 '.*.*.|.*.*.' + Row3 '*****|*.*.*' + Row4 '*****|*...*' + Row5 '.***.|.*.*.' + Row6 '.***.|.*.*.' + Row7 '..*..|..*..' + Row8 '.....|.....' + } +} + +Widget EKG { + class 'Icon' + speed 50 + Bitmap { + Row1 '.....|.....|.....|.....|.....|.....|.....|.....' + Row2 '.....|....*|...*.|..*..|.*...|*....|.....|.....' + Row3 '.....|....*|...*.|..*..|.*...|*....|.....|.....' + Row4 '.....|....*|...**|..**.|.**..|**...|*....|.....' + Row5 '.....|....*|...**|..**.|.**..|**...|*....|.....' + Row6 '.....|....*|...*.|..*.*|.*.*.|*.*..|.*...|*....' + Row7 '*****|*****|****.|***..|**..*|*..**|..***|.****' + Row8 '.....|.....|.....|.....|.....|.....|.....|.....' + } +} +Widget Karo { + class 'Icon' + speed 200 + Bitmap { + Row1 '.....|.....|.....|.....|..*..|.....|.....|.....' + Row2 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....' + Row3 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....' + Row4 '.....|..*..|.*.*.|*...*|.....|*...*|.*.*.|..*..' + Row5 '.....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....' + Row6 '.....|.....|.....|..*..|.*.*.|..*..|.....|.....' + Row7 '.....|.....|.....|.....|..*..|.....|.....|.....' + Row8 '.....|.....|.....|.....|.....|.....|.....|.....' + } +} +Widget Heart { + class 'Icon' + speed 250 + Bitmap { + Row1 '.....|.....|.....|.....|.....|.....' + Row2 '.*.*.|.....|.*.*.|.....|.....|.....' + Row3 '*****|.*.*.|*****|.*.*.|.*.*.|.*.*.' + Row4 '*****|.***.|*****|.***.|.***.|.***.' + Row5 '.***.|.***.|.***.|.***.|.***.|.***.' + Row6 '.***.|..*..|.***.|..*..|..*..|..*..' + Row7 '..*..|.....|..*..|.....|.....|.....' + Row8 '.....|.....|.....|.....|.....|.....' + } +} +Widget Blob { + class 'Icon' + speed 250 + Bitmap { + Row1 '.....|.....|.....' + Row2 '.....|.....|.***.' + Row3 '.....|.***.|*...*' + Row4 '..*..|.*.*.|*...*' + Row5 '.....|.***.|*...*' + Row6 '.....|.....|.***.' + Row7 '.....|.....|.....' + Row8 '.....|.....|.....' + } +} +Widget Wave { + class 'Icon' + speed 100 + Bitmap { + Row1 '..**.|.**..|**...|*....|.....|.....|.....|.....|....*|...**' + Row2 '.*..*|*..*.|..*..|.*...|*....|.....|.....|....*|...*.|..*..' + Row3 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...' + Row4 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...' + Row5 '*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...' + Row6 '.....|.....|....*|...*.|..*..|.*..*|*..*.|..*..|.*...|*....' + Row7 '.....|.....|.....|....*|...**|..**.|.**..|**...|*....|.....' + Row8 '.....|.....|.....|.....|.....|.....|.....|.....|.....|.....' + } +} +Widget Squirrel { + class 'Icon' + speed 100 + Bitmap { + Row1 '.....|.....|.....|.....|.....|.....' + Row2 '.....|.....|.....|.....|.....|.....' + Row3 '.....|.....|.....|.....|.....|.....' + Row4 '**...|.**..|..**.|...**|....*|.....' + Row5 '*****|*****|*****|*****|*****|*****' + Row6 '...**|..**.|.**..|**...|*....|.....' + Row7 '.....|.....|.....|.....|.....|.....' + Row8 '.....|.....|.....|.....|.....|.....' + } +} + +Widget IOIcon { + class 'Icon' + speed 100 + Bitmap { + Row1 '.....|.....|.....|.....|.....|.....' + Row2 '...*.|.....|...*.|.....|...*.|.....' + Row3 '*****|.....|*****|.....|*****|.....' + Row4 '...*.|.....|...*.|.....|...*.|.....' + Row5 '.*...|.....|.*...|.....|.*...|.....' + Row6 '*****|.....|*****|.....|*****|.....' + Row7 '.*...|.....|.*...|.....|.*...|.....' + Row8 '.....|.....|.....|.....|.....|.....' + } +} + +Widget Lightning { + class 'icon' + speed 100 + visible cpu('busy', 500)-50 + bitmap { + row1 '...***' + row2 '..***.' + row3 '.***..' + row4 '.****.' + row5 '..**..' + row6 '.**...' + row7 '**....' + row8 '*.....' + } +} + +Widget Rain { + class 'icon' + speed 200 + bitmap { + row1 '...*.|.....|.....|.*...|....*|..*..|.....|*....' + row2 '*....|...*.|.....|.....|.*...|....*|..*..|.....' + row3 '.....|*....|...*.|.....|.....|.*...|....*|..*..' + row4 '..*..|.....|*....|...*.|.....|.....|.*...|....*' + row5 '....*|..*..|.....|*....|...*.|.....|.....|.*...' + row6 '.*...|....*|..*..|.....|*....|...*.|.....|.....' + row7 '.....|.*...|....*|..*..|.....|*....|...*.|.....' + row8 '.....|.....|.*...|....*|..*..|.....|*....|...*.' + } +} + + +Widget GPO_Val1 { + class 'Text' + expression LCD::GPO(1) + prefix 'GPO#1' + width 10 + precision 0 + align 'R' + update tick +} + +Widget GPI_Val1 { + class 'Text' + expression LCD::GPI(1) + prefix 'GPI#1' + width 10 + precision 0 + align 'R' + update tick +} + +Widget GPO_Val4 { + class 'Text' + expression LCD::GPO(4) + prefix 'GPO#4' + width 10 + precision 0 + align 'R' + update tick +} + +Widget GPO_Test1 { + class 'GPO' + expression 255*test::onoff(1) + update 300 +} + +Widget GPO_Test255 { + class 'GPO' + expression test::bar(0,255, 0, 1) + update 100 +} + +Widget GPO_picolcd { + class 'GPO' + expression test::onoff(1) + update 300 +} + +Widget CpuImage { + class 'Image' + file '/etc/picoLCDGraphic/Images/cpu_a.png' + update 1000 + visible 1 + inverted 0 + reload 0 +} + +Widget HddImage { + class 'Image' + file '/etc/picoLCDGraphic/Images/hdd_a.png' + update 1000 + visible 1 + inverted 0 + reload 0 +} + +Widget RamImage { + class 'Image' + file '/etc/picoLCDGraphic/Images/ram_a.png' + update 1000 + visible 1 + inverted 0 + reload 0 +} + +Widget NetImage { + class 'Image' + file '/etc/picoLCDGraphic/Images/net_a.png' + update 1000 + visible 1 + inverted 0 + reload 0 +} + +Widget FanImage { + class 'Image' + file '/etc/picoLCDGraphic/Images/fan_a.png' + update 1000 + visible 1 + inverted 0 + reload 0 +} + + +Layout picoLCD { +# Layer 1 { +# X0.Y0 'BandwidthImage' +# } +# Layer 1 { +# X0.Y0 'CpuImage' +# } + Row1 { + Col1 'CPULabel' + Col6 'CPU' + Col11 'CPUBar' + Col21 'RAMLabel' + Col26 'RAMFree' + Col31 'RAMTotal' + } + Row2 { + Col1 'IDELabel' + Col6 'IDEIn' + Col17 'IDEOut' + Col28 'IDEBar' + } + Row3 { + Col1 'FSSpace' + } + Row4 { + Col1 'ETHLabel' + Col6 'ETHIn' + Col17 'ETHOut' + Col28 'ETHBar' + } + Row7 { + Col1 'Time' + Col22 'Uptime' + } + + Row8 { + Col1 'Uptime' + Col1 'BottomTicker' + } + #Layer 2 { + # X0.Y0 'ImageTest' + #} + +#GPO1 'GPO_picolcd' +#GPO2 'GPO_picolcd' +#GPO8 'GPO_picolcd' +} + +Display 'picoLCD' +Layout 'picoLCD' diff --git a/contrib/picoLCD/lcd4linux.conf.mrtg b/contrib/picoLCD/lcd4linux.conf.mrtg new file mode 100644 index 0000000..56aaac1 --- /dev/null +++ b/contrib/picoLCD/lcd4linux.conf.mrtg @@ -0,0 +1,91 @@ +Display picoLCD { + Driver 'picoLCDGraphic' + Size '256x64' + Contrast 230 + Backlight 1 + Inverted 1 + Icons 1 +} + + +Variables { + n 0 + nkey 0 + currentImage 'http://192.168.12.113/mrtg/127.0.0.1_2-month.png' + mrtgDayImageURL 'http://192.168.12.113/mrtg/127.0.0.1_2-day.png' + mrtgWeekImageURL 'http://192.168.12.113/mrtg/127.0.0.1_2-week.png' + #currentFile '/tmp/127.0.0.1_2-day.png' + currentFile ' ' + tick 500 + tack 100 + minute 60000 +} + +Widget TimerW { + class 'Timer' + expression n=LCD::GPI(1);nkey=n!=0?n:nkey + active 1 + update 100 +} + + +# export PYTHONPATH which should point to the scripts usually /etc/picoLCDGraphic/Scripts +Widget MRTGMinute { + class 'Text' + expression currentFile=python::exec('mrtg', 'saveimage', currentImage) + width 42 + #update minute + update 100 +} + +Widget test { + class 'Text' + expression currentFile + width 42 + #update minute + update 100 +} + +# Python script will save the filename as taken from the URL above in the /etc/picoLCDGraphic/Images path +# Modify mrtg.py to save in another path and also change file tag below +Widget BandwidthImage { + class 'Image' + file currentFile + visible 1 + inverted 0 + reload 1 + #update minute + update 100 + #update tick +} + +Widget GPO_kup { + class 'GPO' + expression currentImage=nkey==5?mrtgDayImageURL:currentImage;nkey==5?1:0 + update 300 +} + + Widget GPO_kdown { + class 'GPO' + expression currentImage=nkey==7?mrtgWeekImageURL:currentImage;nkey==7?1:0 + update 300 +} + + +Layout picoLCD { + Row1 { + Col1 'MRTGMinute' + } + + Layer 1 { + X0.Y0 'BandwidthImage' + } + + Timer1 'TimerW' + GPO2 'GPO_kup' + GPO3 'GPO_kdown' + +} + +Display 'picoLCD' +Layout 'picoLCD' diff --git a/contrib/picoLCD/lcd4linux.conf.rss b/contrib/picoLCD/lcd4linux.conf.rss new file mode 100644 index 0000000..dd99a04 --- /dev/null +++ b/contrib/picoLCD/lcd4linux.conf.rss @@ -0,0 +1,142 @@ +Display picoLCD { + Driver 'picoLCDGraphic' + Size '256x64' + Contrast 230 + Backlight 1 + Inverted 1 + Icons 1 +} + + +Variables { + n 0 + nkey 0 + page 0 + title 0 + rss1 'http://slashdot.org/slashdot.rdf' + rss2 'http://www.engadget.com/rss.xml' + rss 'http://www.linuxsecurity.com/static-content/debian.rss' + tick 500 + tack 100 + minute 60000 +} + +Widget TimerW { + class 'Timer' + expression n=LCD::GPI(1);nkey=n + active 1 + update 100 +} + + +# export PYTHONPATH which should point to the scripts usually /etc/picoLCDGraphic/Scripts + +Widget RSSFeedInfo { + class 'Text' + #expression title=1+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param) + expression rss.' page:'.page + width 42 + align 'L' + style 'bold' + #update minute + update 500 +} + +Widget RSSFeedTitle1 { + class 'Text' + expression title=1+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param) + width 42 + prefix '>' + align 'L' + #update minute + update 500 +} + + + +Widget RSSFeedTitle2 { + class 'Text' + expression title=2+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param) + width 42 + prefix '>' + align 'L' + #update minute + update 500 +} + + +Widget RSSFeedTitle3 { + class 'Text' + expression title=3+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param) + width 42 + prefix '>' + align 'L' + #update minute + update 500 +} + +Widget RSSFeedTitle4 { + class 'Text' + expression title=4+page;param='!'.title;python::exec('rsstimer', 'getfeed', rss.param) + width 42 + prefix '>' + align 'L' + #update minute + update 500 +} + + +Widget GPO_kback { + class 'GPO' + expression rss=nkey==1?rss1:rss + update 100 +} + +Widget GPO_khome { + class 'GPO' + expression rss=nkey==2?rss2:rss + update 100 +} + + +Widget GPO_kup { + class 'GPO' + expression page=nkey==5?page-1:page#;nkey==5?1:0 + update 100 +} + + Widget GPO_kdown { + class 'GPO' + expression page=nkey==7?page+1:page#;nkey==7?1:0 + update 100 +} + + +Layout picoLCD { + Row1 { + Col1 'RSSFeedInfo' + } + Row2 { + Col1 'RSSFeedTitle1' + } + Row4 { + Col1 'RSSFeedTitle2' + } + Row6 { + Col1 'RSSFeedTitle3' + } + Row8 { + Col1 'RSSFeedTitle4' + } + + Timer1 'TimerW' + + GPO1 'GPO_kback' + GPO2 'GPO_khome' + GPO3 'GPO_kup' + GPO4 'GPO_kdown' + +} + +Display 'picoLCD' +Layout 'picoLCD' diff --git a/contrib/picoLCD/lcd4linux.conf.rss.timers b/contrib/picoLCD/lcd4linux.conf.rss.timers new file mode 100644 index 0000000..ef16d4b --- /dev/null +++ b/contrib/picoLCD/lcd4linux.conf.rss.timers @@ -0,0 +1,127 @@ +Display picoLCD { + Driver 'picoLCDGraphic' + Size '256x64' + Contrast 230 + Backlight 1 + Inverted 1 + Icons 1 +} + + +Variables { + n 0 + nkey 0 + page 0 + t 0 + p ' ' + r1 ' ' + r2 ' ' + r3 ' ' + r4 ' ' + rss 'http://slashdot.org/slashdot.rdf' + + tick 500 + tack 100 + minute 60000 + #rssRefresh minute + rssRefresh 1000 +} + +Widget TimerW { + class 'Timer' + expression n=LCD::GPI(1);nkey=n!=0?n:nkey + active 1 + update 100 +} + +Widget TimerRSS { + class 'Timer' + expression t=1+page;p='!'.t;r1=python::exec('rss', 'pf', rss.p);t=2+page;p='!'.t;r2=python::exec('rss', 'pf', rss.p);t=3+page;p='!'.t;r3=python::exec('rss', 'pf', rss.p);t=4+page;p='!'.t;r4=python::exec('rss', 'pf', rss.p);rssRefresh=1000 + active 1 + update rssRefresh +} + + +# export PYTHONPATH which should point to the scripts usually /etc/picoLCDGraphic/Scripts +Widget RSSFeedTitle1 { + class 'Text' + #expression title=1+page;param='!'.title;python::exec('rss', 'parsefeed', slashdotRSS.param) + expression r1 + width 42 + prefix '- ' + align 'L' + #update minute + update 300 +} + + + +Widget RSSFeedTitle2 { + class 'Text' + expression r2 + width 42 + prefix '- ' + align 'L' + #update minute + update 300 +} + + +Widget RSSFeedTitle3 { + class 'Text' + expression r3 + width 42 + prefix '- ' + align 'L' + #update minute + update 300 +} + +Widget RSSFeedTitle4 { + class 'Text' + expression r4 + width 42 + prefix '- ' + align 'L' + #update minute + update 300 +} + + +Widget GPO_kup { + class 'GPO' + expression page=nkey==5?0:page;nkey==5?1:0#;rssRefresh=nkey==5?100:rssRefresh + update 100 +} + + Widget GPO_kdown { + class 'GPO' + expression page=nkey==7?4:page;nkey==7?1:0#;rssRefresh=nkey==7?100:rssRefresh + update 100 +} + + +Layout picoLCD { + Row1 { + Col1 'RSSFeedTitle1' + } + Row3 { + Col1 'RSSFeedTitle2' + } + Row5 { + Col1 'RSSFeedTitle3' + } + Row7 { + Col1 'RSSFeedTitle4' + } + + Timer1 'TimerW' + Timer2 'TimerRSS' + + GPO2 'GPO_kup' + GPO3 'GPO_kdown' + +} + +Display 'picoLCD' +Layout 'picoLCD' diff --git a/contrib/picoLCD/mrtg.py b/contrib/picoLCD/mrtg.py new file mode 100644 index 0000000..e501ca9 --- /dev/null +++ b/contrib/picoLCD/mrtg.py @@ -0,0 +1,21 @@ +import urllib +import shutil + +download_path = "/tmp/" + +def saveimage(imageurl): + filename = imageurl.split('/')[-1] + tmpname = filename + ".tmp" + try: + urllib.urlretrieve(imageurl, download_path + tmpname) + except IOError: + return "Error downloading file" + else: + shutil.move(download_path + tmpname, download_path + filename) + return download_path + filename + + +#saveimage("http://www.switch.ch/network/operation/statistics/geant2-day.png") +#saveimage("http://192.168.12.113/mrtg/127.0.0.1_2-day.png") + + diff --git a/contrib/picoLCD/rsstimer.py b/contrib/picoLCD/rsstimer.py new file mode 100644 index 0000000..5da92ea --- /dev/null +++ b/contrib/picoLCD/rsstimer.py @@ -0,0 +1,92 @@ +import feedparser +import time +import datetime +import tempfile +import linecache + +# temporary file used to store rss entries +filename = "/tmp/rsstimer.tmp" +# interval in seconds between rss updates +updateinterval = 60 + +# lcd4linux permits only 1 parameter passed to the function +# we send the rss title id with the ! spacer +def getfeed(rssfeed): + print rssfeed + idx = 0 + feed = rssfeed.split('!')[0] + idx = int(rssfeed.split('!')[-1]) + if (idx <= 0): idx = 1; + + oldfeed = fgetfeed() + + if (oldfeed != feed): + lastupdate = 0 + print "Feed changed refresing" + else: + lastupdate = fgetseconds() + + if (lastupdate <= 0): + saverss(feed) + else: + now = getseconds() + delta = now - lastupdate + if (delta > updateinterval): + print "Last update: " + str(delta) + " seconds ago. Updating the rss entries." + saverss(feed) + # first line in the file is the timestamp second is the feed url + output = linecache.getline(filename, idx + 2) + print output + return output + +def getseconds(): + ts = datetime.datetime.now() + return time.mktime(ts.timetuple()) + +def fgetseconds(): + try: + f = open(filename, "r") + except IOError: + print "Cannot get timestamp from file" + return 0 + else: + return float(f.readline()) + +def fgetfeed(): + try: + f = open(filename, "r") + except IOError: + print "Cannot get feed from file" + return ' ' + else: + # skip first line + f.readline() + return f.readline().rstrip("\n") + + +def saverss(rssfeed): + linecache.clearcache() + f = open(filename, "w") + # save timestamp + f.write(str(getseconds())) + f.write("\n") + # save feed url + f.write(rssfeed) + f.write("\n") + print "Downloading the rss feed from: " + rssfeed + feed = feedparser.parse(rssfeed) + for entry in feed.entries: + f.write(entry.title) + f.write("\n") + f.close + print "Done" + +def printrss(): + f = open(filename, "r") + f.readline() + for line in f: + print line + +#print getfeed("http://slashdot.org/slashdot.rdf!5") +print getfeed("http://www.linux.com/feed?theme=rss!1") + |