Code: Select all
[ ~/torsmo_scripts ] pavel $ ./checker.pl
totalmessages=88
usedspace=9658248
[ ~/torsmo_scripts ] pavel $ cat gmail.txt
totalmessages=86
newmessages=18
status=Using 9 MB (1%) of 1000 MB
Thank you for registering with Imageshack.us
[Bug 76691] New: Russian characters input in nano-1.3.5 is broken
et cetera ;)

Code: Select all
#!/usr/bin/python
import os,sys,urllib2
dir = os.environ['HOME'] + os.sep
try:
greenfile = file(dir + ".infocon_green", 'w')
yellowfile = file(dir + ".infocon_yellow", 'w')
orangefile = file(dir + ".infocon_orange", 'w')
redfile = file(dir + ".infocon_red", 'w')
except:
print "Error opening files!"
sys.exit(1)
filedict = {"green" : greenfile, "yellow" : yellowfile, "orange" : orangefile, "red" : redfile}
status = urllib2.urlopen('http://isc.sans.org/infocon.txt').read(6)
status = status.strip() #Get rid of possible newlines etc.
statusfile = filedict[status]
try:
statusfile.write(status)
except:
print "Error writing file!"
for file in [greenfile, yellowfile, orangefile, redfile]:
file.close()
Code: Select all
Infocon: ${color green}${execi 20 cat ~/.infocon_green}${color yellow}${execi 20 cat ~/.infocon_yellow}${color
orange}${execi 20 cat ~/.infocon_orange}${color red}${execi 20 cat ~/.infocon_red}
If you are getting the above error you need to enable "pop" in you gmail account.plbe wrote:Wrong password, please check your settings.
Operation failed, connection to server is not established.
at ./gmail.pl line 15
Code: Select all
TEXT
${color}Sims
${kernel}
${color}${time %A %d.%m.%y}
${color white}CPU
${color}Load ${color} $cpu%
${color}UpTime ${color}$uptime
${color}Process ${color}${processes}
${color}Running ${color}${running_processes}
${color white}MEMORY
${color}RAM ${color} $mem/$memmax
${color}Swap ${color} $swap/$swapmax
${color white}FILE SYSTEM
${color}Root ${color}${fs_used /}/${fs_size /}
${color}Store ${color}${fs_used /home}/${fs_size
/home}
${color white}NETWORK
${color}Up ${color} ${upspeed eth0} k/s
${color}Down ${color} ${downspeed eth0} k/s
XMMS:
${color grey}Status : $color${execi 10 perl ~/.torsmo/xmms.pl
Status}
${color grey}Playlist : $color${execi 10 perl ~/.torsmo/xmms.pl
Playlist}
${color grey}Title : $color${execi 10 perl ~/.torsmo/xmms.pl Title}
${color grey}Artist : $color${execi 10 perl ~/.torsmo/xmms.pl
Artist}
${color grey}Bitrate : $color${execi 10 perl ~/.torsmo/xmms.pl
Bitrate}
${color grey}Time : $color${execi 10 perl ~/.torsmo/xmms.pl Time}
Code: Select all
#!/usr/bin/perl
# Perl script to display XMMS song info on Torsmo
# Requires XMMS::InfoPipe module and xmms-infopipe plugin
use XMMS::InfoPipe;
my $numArgs = $#ARGV+1;
if($numArgs != 1) {
print "Usage error: xmms.pl [keyname]\n";
exit;
}
else {
my $key = $ARGV[0];
my $xmms = XMMS::InfoPipe->new();
my $playing = $xmms->is_playing();
my $paused = $xmms->is_paused();
# display info since XMMS is playing/paused
if($playing == 1 || $paused == 1) {
# extract song artist
if($key eq "Artist") {
my $title = $xmms->{info}->{Title};
@song = split(/ - /, $title);
my $artist = $song[0];
#truncate long artist names
if(length($artist) >= 30) {
my $temp = substr($artist, 0, 30);
$artist = $temp . "...";
}
print $artist , "\n";
}
# extract song title
elsif($key eq "Title") {
my $title = $xmms->{info}->{Title};
@song = split(/ - /, $title);
print $song[1] , "\n";
}
# join position and length times, ie 2:04 / 4:50
elsif($key eq "Time") {
my $length = $xmms->{info}->{Time};
my $position = $xmms->{info}->{Position};
print $position , " / " , $length , "\n";
}
# format bitrate, ie 192 kbps
elsif($key eq "Bitrate") {
my $bitrate = $xmms->{info}->{"Current bitrate"};
print $bitrate/1000 , " kbps\n";
}
# number of tunes in playlist
elsif($key eq "Playlist") {
my $tunes = $xmms->{info}->{"Tunes in playlist"};
print $tunes , " tunes\n";
}
# print out info for other keys (case sensitive,'cat /tmp/xmms-info')
else {
print $xmms->{info}->{$key} , "\n";
}
}
# display status only since XMMS is not playing/paused
else {
if($key eq "Status") {
print $xmms->{info}->{Status} , "\n";
}
}
}
Code: Select all
sh: line 2: Artist: command not found
sh: line 2: Bitrate: command not found
sh: line 2: Status: command not found
sh: line 2: Playlist: command not found
sh: line 2: Artist: command not found
sh: line 2: Bitrate: command not found
sh: line 2: Status: command not found
sh: line 2: Playlist: command not found
sh: line 2: Artist: command not found
sh: line 2: Bitrate: command not found
sh: line 2: Status: command not found
sh: line 2: Playlist: command not found
sh: line 2: Artist: command not found
sh: line 2: Bitrate: command not found
sh: line 2: Status: command not found
sh: line 2: Playlist: command not found
sh: line 2: Artist: command not found
sh: line 2: Bitrate: command not found
sh: line 2: Status: command not found
sh: line 2: Playlist: command not found
sh: line 2: Artist: command not found
sh: line 2: Bitrate: command not found

Code: Select all
#!/usr/bin/env python
import urllib
data = urllib.urlopen('http://packages.gentoo.org/archs/x86/stable/gentoo_simple.rss').read()
datalist = data.splitlines()
final = []
for x in datalist:
#REMOVE WHITESPACES IN THE BEGINNING OF EACH LINE
line = x.strip()
if line.startswith('<title>'):
final.append(line[7:-8])
for x in final[1:]:
print xCode: Select all
${color orange}New Gentoo Packages:
${color white}${execi 1800 /path/to/gentoo_packages.py}Sorry, you can only put it in the four corners, AFAIKpinguvin wrote:could anybody please tell me how to center my torsmo.. i want it to appear bottom center, but right now its bottom left..
Code: Select all
#!/usr/bin/env python
#
from RSS import ns, CollectionChannel, TrackingChannel
#Create a tracking channel, which is a data structure that
#Indexes RSS data by item URL
tc = TrackingChannel()
#Returns the RSSParser instance used, which can usually be ignored
tc.parse("http://packages.gentoo.org/archs/x86/stable/gentoo_simple.rss")
RSS10_TITLE = (ns.rss10, 'title')
RSS10_DESC = (ns.rss10, 'description')
#You can also use tc.keys()
items = tc.listItems()
for item in items[:4]:
#Each item is a (url, order_index) tuple
#Get all the data for the item as a Python dictionary
item_data = tc.getItem(item)
print item_data.get(RSS10_TITLE, "(none)")
words = item_data.get(RSS10_DESC, "(none)").split()
desc = words[0]
for word in words[1:]:
if len(desc) + len(word) + 1 > 40:
print ' ' + desc
desc = word
else:
desc = desc + ' ' + word
print ' ' + desc

You have to mess with the gap_xpinguvin wrote:could anybody please tell me how to center my torsmo.. i want it to appear bottom center, but right now its bottom left..

SWEET! I didn't know their was an RSS library.Tyir wrote:Sorry, you can only put it in the four corners, AFAIKpinguvin wrote:could anybody please tell me how to center my torsmo.. i want it to appear bottom center, but right now its bottom left..
And sorry to steal your thunder Shiner_Man, but I stole/modified my own, it has the descriptions for the packages.
You need the RSS.py library, and put in your path
http://www.mnot.net/python/RSS.py
and put it in /usr/lib/python2.x
Code: Select all
#!/usr/bin/env python # from RSS import ns, CollectionChannel, TrackingChannel #Create a tracking channel, which is a data structure that #Indexes RSS data by item URL tc = TrackingChannel() #Returns the RSSParser instance used, which can usually be ignored tc.parse("http://packages.gentoo.org/archs/x86/stable/gentoo_simple.rss") RSS10_TITLE = (ns.rss10, 'title') RSS10_DESC = (ns.rss10, 'description') #You can also use tc.keys() items = tc.listItems() for item in items[:4]: #Each item is a (url, order_index) tuple #Get all the data for the item as a Python dictionary item_data = tc.getItem(item) print item_data.get(RSS10_TITLE, "(none)") words = item_data.get(RSS10_DESC, "(none)").split() desc = words[0] for word in words[1:]: if len(desc) + len(word) + 1 > 40: print ' ' + desc desc = word else: desc = desc + ' ' + word print ' ' + desc
My guess is: you only put the title and time on one line. Try putting the other xmms.pl uses on one line as wellssn wrote:this xmms.pl dont work for me. torsmo displays Title and Time perfectly but Status, Playlist, Artist and Bitrate are saying: Usage error xmms.pl [keyname]
my .torsmorc:my xmms.pl:Code: Select all
TEXT ${color}Sims ${kernel} ${color}${time %A %d.%m.%y} ${color white}CPU ${color}Load ${color} $cpu% ${color}UpTime ${color}$uptime ${color}Process ${color}${processes} ${color}Running ${color}${running_processes} ${color white}MEMORY ${color}RAM ${color} $mem/$memmax ${color}Swap ${color} $swap/$swapmax ${color white}FILE SYSTEM ${color}Root ${color}${fs_used /}/${fs_size /} ${color}Store ${color}${fs_used /home}/${fs_size /home} ${color white}NETWORK ${color}Up ${color} ${upspeed eth0} k/s ${color}Down ${color} ${downspeed eth0} k/s XMMS: ${color grey}Status : $color${execi 10 perl ~/.torsmo/xmms.pl Status} ${color grey}Playlist : $color${execi 10 perl ~/.torsmo/xmms.pl Playlist} ${color grey}Title : $color${execi 10 perl ~/.torsmo/xmms.pl Title} ${color grey}Artist : $color${execi 10 perl ~/.torsmo/xmms.pl Artist} ${color grey}Bitrate : $color${execi 10 perl ~/.torsmo/xmms.pl Bitrate} ${color grey}Time : $color${execi 10 perl ~/.torsmo/xmms.pl Time}torsmo message:Code: Select all
#!/usr/bin/perl # Perl script to display XMMS song info on Torsmo # Requires XMMS::InfoPipe module and xmms-infopipe plugin use XMMS::InfoPipe; my $numArgs = $#ARGV+1; if($numArgs != 1) { print "Usage error: xmms.pl [keyname]\n"; exit; } else { my $key = $ARGV[0]; my $xmms = XMMS::InfoPipe->new(); my $playing = $xmms->is_playing(); my $paused = $xmms->is_paused(); # display info since XMMS is playing/paused if($playing == 1 || $paused == 1) { # extract song artist if($key eq "Artist") { my $title = $xmms->{info}->{Title}; @song = split(/ - /, $title); my $artist = $song[0]; #truncate long artist names if(length($artist) >= 30) { my $temp = substr($artist, 0, 30); $artist = $temp . "..."; } print $artist , "\n"; } # extract song title elsif($key eq "Title") { my $title = $xmms->{info}->{Title}; @song = split(/ - /, $title); print $song[1] , "\n"; } # join position and length times, ie 2:04 / 4:50 elsif($key eq "Time") { my $length = $xmms->{info}->{Time}; my $position = $xmms->{info}->{Position}; print $position , " / " , $length , "\n"; } # format bitrate, ie 192 kbps elsif($key eq "Bitrate") { my $bitrate = $xmms->{info}->{"Current bitrate"}; print $bitrate/1000 , " kbps\n"; } # number of tunes in playlist elsif($key eq "Playlist") { my $tunes = $xmms->{info}->{"Tunes in playlist"}; print $tunes , " tunes\n"; } # print out info for other keys (case sensitive,'cat /tmp/xmms-info') else { print $xmms->{info}->{$key} , "\n"; } } # display status only since XMMS is not playing/paused else { if($key eq "Status") { print $xmms->{info}->{Status} , "\n"; } } }
Code: Select all
sh: line 2: Artist: command not found sh: line 2: Bitrate: command not found sh: line 2: Status: command not found sh: line 2: Playlist: command not found sh: line 2: Artist: command not found sh: line 2: Bitrate: command not found sh: line 2: Status: command not found sh: line 2: Playlist: command not found sh: line 2: Artist: command not found sh: line 2: Bitrate: command not found sh: line 2: Status: command not found sh: line 2: Playlist: command not found sh: line 2: Artist: command not found sh: line 2: Bitrate: command not found sh: line 2: Status: command not found sh: line 2: Playlist: command not found sh: line 2: Artist: command not found sh: line 2: Bitrate: command not found sh: line 2: Status: command not found sh: line 2: Playlist: command not found sh: line 2: Artist: command not found sh: line 2: Bitrate: command not found
Code: Select all
# torsmo configuration
# torsmo configuration
# set to yes if you want tormo to be forked in the background
background yes
# X font used, you can pick one with program xfontsel
#font 5x7
font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-fixed-medium-*-*-*-*-*-*-*-*-*-*-*
# mail spool
mail_spool $MAIL
# Update interval in seconds
update_interval 5.0
# Create own window instead of using desktop (required in nautilus)
own_window no
# Minimum size of text area
minimum_size 280 5
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline yes
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 8
# border margins
border_margin 4
# border width
border_width 1
# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color black
# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
gap_x 12
gap_y 12
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
TEXT
${color}Sims
${kernel}
${color}${time %A %d.%m.%y}
${color white}CPU
${color}Load ${color} $cpu%
${color}UpTime ${color}$uptime
${color}Process ${color}${processes}
${color}Running ${color}${running_processes}
${color white}MEMORY
${color}RAM ${color} $mem/$memmax
${color}Swap ${color} $swap/$swapmax
${color white}FILE SYSTEM
${color}Root ${color}${fs_used /}/${fs_size /}
${color}Store ${color}${fs_used /home}/${fs_size
/home}
${color white}NETWORK
${color}Up ${color} ${upspeed eth0} k/s
${color}Down ${color} ${downspeed eth0} k/s
XMMS:
${color grey}Status : $color${execi 10 perl ~/.torsmo/xmms.pl Status}
${color grey}Playlist : $color${execi 10 perl ~/.torsmo/xmms.pl Playlist}
${color grey}Title : $color${execi 10 perl ~/.torsmo/xmms.pl Title}
${color grey}Artist : $color${execi 10 perl ~/.torsmo/xmms.pl Artist}
${color grey}Bitrate : $color${execi 10 perl ~/.torsmo/xmms.pl Bitrate}
${color grey}Time : $color${execi 10 perl ~/.torsmo/xmms.pl Time}

Code: Select all
#!/bin/bash
#This script is free to modify and distribute.
#If you make some cool modification to it, let me know at straivir@ucsd.edu
#Use at your own risk.
#Requirement: bmp-infopipe and/or xmms-infopipe
#Todo: make that song title scrolling within maxcol
#User Setting here
maxcol=21
file=/tmp/xmms-info
player=BMP
#Grab needed information
status=`cat $file | grep Status: | cut -d : -f2`
title=`cat $file | grep Title: | cut -d : -f2`
pos=`cat $file | grep uSecPosition: | cut -d : -f2`
len=`cat $file | grep uSecTime: | cut -d : -f2`
#Count the length in characters of the title
size=`echo $title | wc -c`
#Calculate current position within that length
poscol=$(echo "$pos*$maxcol/$len" | bc)
#Printing
echo $player $status
echo $title | fmt -w $maxcol
for (( i=0; i<$maxcol; i++ ))
do
if [ $i -eq $poscol ]; then
echo -n 'O'
else
echo -n '='
fi
done
#For new line
echo
Code: Select all
${stippled_hr 2 1}
${color slate grey}Music: ${color }${execi 4 ~/tmusic.sh}
${stippled_hr 2 1}

Yeah I had sensor reading problems too this is what I did.Hey, recent problem, I don't know if it is me... I'm using .18, and I noticed that my i2c sensors aren't updating.
When torsmo is first launched, they get the correct values (i2c temp 1), but then they stay that way, stuck.
Everything else updates normally.
Code: Select all
${exec expr `cat /sys/bus/i2c/devices/1-0290/temp1_input` / 1000}Yea, that works, but I didn't want to revert to exec.hpestilence wrote:Yeah I had sensor reading problems too this is what I did.Hey, recent problem, I don't know if it is me... I'm using .18, and I noticed that my i2c sensors aren't updating.
When torsmo is first launched, they get the correct values (i2c temp 1), but then they stay that way, stuck.
Everything else updates normally.
I found where my sensors were then which one is which (from cpu and motherboard) and added the following:
I had to do it like that because my sensors read like 39000 for cpu so I divided by 1000.Code: Select all
${exec expr `cat /sys/bus/i2c/devices/1-0290/temp1_input` / 1000}
Oh yeah, your sensors should be located in "/sys/bus/i2c/devices" too


Poe wrote:@grad_guy
Can I please your full .torsmorc? If you want/can, please send to my mail (under signature) or send here.
thanks and greetz
Code: Select all
background no
font -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*
use_xft 1
xftfont Terminus :pixelsize=10
xftalpha 0.8
update_interval 1.0
own_window no
minimum_size 80 5
draw_shades yes
draw_outline no
draw_borders no
stippled_borders 0
border_margin 2
border_width 1
default_color white
default_shade_color black
default_outline_color black
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
gap_x 5
gap_y 100
no_buffers yes
uppercase no
TEXT
${color slate grey}${time %a, }${color }${time %e %B %G}
${color slate grey}${time %Z, }${color }${time %H:%M:%S}
${stippled_hr 2 1}
${execi 40000 cal}${stippled_hr 2 1}
${color slate grey}UpTime: ${color }$uptime
${color slate grey}Lnx ${color }$kernel
${stippled_hr 2 1}
${color slate grey}Net :
${color}Up :${color } ${upspeed eth0} k/s
${color}Down:${color } ${downspeed eth0} k/s ${color}
${stippled_hr 2 1}
${color slate grey}CPU :${color } $cpu%
${cpubar 3}
${color slate grey}RAM :${color } $memperc% $mem/$memmax
${membar 3}
${color slate grey}SWAP:${color } $swapperc% $swap/$swapmax
${swapbar 3}
${stippled_hr 2 1}
${color slate grey}Cpu Mem Procs ${color }
${execi 10 ps gaxo %cpu,%mem,comm | sort +0nr | head -n 5 | sed -e 's/-bin//' | sed -e 's/-media-play//'}
${stippled_hr 2 1}
${color slate grey}ROOT: ${color }${fs_used_perc /}% -- ${fs_size /}
${fs_bar 3 /}
${color slate grey}DHDD: ${color }${fs_used_perc /mnt/dhdd}% -- ${fs_size /mnt/dhdd}
${fs_bar 3 /mnt/dhdd}
${color slate grey}NFS1 : ${color }${fs_used_perc /mnt/nfs}% -- ${fs_size /mnt/nfs}
${fs_bar 3 /mnt/nfs}
${color slate grey}NFS2 : ${color }${fs_used_perc /mnt/nfs2}% -- ${fs_size /mnt/nfs2}
${fs_bar 3 /mnt/nfs2}
${stippled_hr 2 1}
${color slate grey}Weather :${color}
${execi 900 /home/nui/.torsmo/tweather.sh Today}
${stippled_hr 2 1}
${color slate grey}Tomorrow :${color}
${execi 900 /home/nui/.torsmo/tweather.sh Tomorrow}
${stippled_hr 2 1}
${color slate grey}Music: ${color }${execi 3 /home/nui/.torsmo/tmusic.sh}
${stippled_hr 2 1}
${color slate grey}Battery: ${color }$battery

Code: Select all
# emerge xmmsctrlthen just do somthing like this:<snip>
print <string> : general formatted print, similar to printf. The codes are:
%n : new line,
%t : tab,
%F : current filename,
%T : current title,
%P : current position,
%s : playback time in sec,
%m : playback time in min:sec,
%S : song length in sec,
%M : song length in min:sec,
%v : master volume,
%l : playlist length,
%p : playback time in percent,
<snip>
Code: Select all
${color green}XMMS
${color}$stippled_hr
${color #1E90FF}title: ${color}${execi 10 /usr/bin/xmmsctrl title|cut -c -22}
${color #1E90FF}time: ${color}${execi 5 /usr/bin/xmmsctrl print %m} of ${execi 5 /usr/bin/xmmsctrl print %M}
${color #1E90FF}playlist: ${color}playing ${execi 10 /usr/bin/xmmsctrl print %P} of ${execi 10 /usr/bin/xmmsctrl print %l}