Author: duncan
Date: Sun Oct 15 09:44:34 2006
New Revision: 8377
Added:
branches/rel-1-5/freevo/src/plugins/idlebar/cdstatus.py
branches/rel-1-5/freevo/src/plugins/idlebar/diskfree.py
branches/rel-1-5/freevo/src/plugins/idlebar/holidays.py
branches/rel-1-5/freevo/src/plugins/idlebar/mail.py
branches/rel-1-5/freevo/src/plugins/idlebar/tv.py
branches/rel-1-5/freevo/src/plugins/idlebar/weather.py
Modified:
branches/rel-1-5/freevo/ChangeLog
branches/rel-1-5/freevo/src/plugins/idlebar/MultiMail.py
branches/rel-1-5/freevo/src/plugins/idlebar/__init__.py
branches/rel-1-5/freevo/src/plugins/idlebar/system.py
branches/rel-1-5/freevo/src/plugins/idlebar/volume.py
Log:
[ 1577109 ] Idlebar not working because of idlebar.tv
Patches applied and modules added
Modified: branches/rel-1-5/freevo/ChangeLog
==============================================================================
--- branches/rel-1-5/freevo/ChangeLog (original)
+++ branches/rel-1-5/freevo/ChangeLog Sun Oct 15 09:44:34 2006
@@ -28,6 +28,7 @@
* Updated df_xine is detected, use it for DVDs (B#1563026)
* Updated freevo tv_grab to report a failure (B#1567705)
* Updated generation of lircrc to allow more buttons to be detected
(B#1567503)
+ * Updated idlebar to split up the plug-ins to separate modules (F#1577109)
* Updated LCDproc for 5.x series (B#1563153)
* Updated lirc handling to suspend and resume correctly (B#1567499)
* Updated menu for DVDs audio and subtitle tracks to use language name
instead of code (B#1402649)
@@ -38,6 +39,7 @@
* Updated record server to allow separate pre- and post-padding times
(B#1567502)
* Updated record server to ignore case of the title when scheduling a
favorite (B#1574292)
* Updated the audio player to allow control when detached, automatic
detaching (B#1567939)
+ * Updated tv ivtv so that it will allow 2.6.18 and higher kernels, uses
ivtv-0.8+
* Updated tvtime with new play events (B#1563005)
* Updated tv_util to use TV_RECORDFILE_OKLETTERS (B#1566067)
* Updated webserver so that it can run as a non-privileged user (B#1567943)
Modified: branches/rel-1-5/freevo/src/plugins/idlebar/MultiMail.py
==============================================================================
--- branches/rel-1-5/freevo/src/plugins/idlebar/MultiMail.py (original)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/MultiMail.py Sun Oct 15
09:44:34 2006
@@ -2,16 +2,12 @@
# -----------------------------------------------------------------------
# idlebar/MultiMail - IdleBar plugins for checking email accounts
# -----------------------------------------------------------------------
+# $Id$
#
# Author : Chris Griffiths ([EMAIL PROTECTED])
# Date : Nov 8th 2003
#
# -----------------------------------------------------------------------
-# $Log$
-# Revision 1.4 2004/07/10 12:33:41 dischi
-# header cleanup
-#
-# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
@@ -30,7 +26,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# ----------------------------------------------------------------------- */
+# -----------------------------------------------------------------------
import os
import config
Modified: branches/rel-1-5/freevo/src/plugins/idlebar/__init__.py
==============================================================================
--- branches/rel-1-5/freevo/src/plugins/idlebar/__init__.py (original)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/__init__.py Sun Oct 15
09:44:34 2006
@@ -22,7 +22,7 @@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 2 of the Licestringnse, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -34,25 +34,19 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# ----------------------------------------------------------------------- */
-
+# -----------------------------------------------------------------------
+# python modules
import time
import os
-import sys
-import string
-import types
-import mailbox
-import re
import locale
-import glob
+# freevo modules
import config
import plugin
import skin
-import util.tv_util as tv_util
-import util.pymetar as pymetar
-import util.fileops as util
+
+
from pygame import image,transform
@@ -184,280 +178,7 @@
return 0
-class cdstatus(IdleBarPlugin):
- """
- Show the status of all rom drives.
-
- Activate with:
- plugin.activate('idlebar.cdstatus')
- """
- def __init__(self):
- IdleBarPlugin.__init__(self)
- icondir = os.path.join(config.ICON_DIR, 'status')
- self.cdimages ={}
- self.cdimages ['audiocd'] = os.path.join(icondir, 'cd_audio.png')
- self.cdimages ['empty_cdrom'] = os.path.join(icondir,
'cd_inactive.png')
- self.cdimages ['images'] = os.path.join(icondir, 'cd_photo.png')
- self.cdimages ['video'] = os.path.join(icondir, 'cd_video.png')
- self.cdimages ['dvd'] = os.path.join(icondir, 'cd_video.png')
- self.cdimages ['burn'] = os.path.join(icondir, 'cd_burn.png')
- self.cdimages ['cdrip'] = os.path.join(icondir, 'cd_rip.png')
- self.cdimages ['mixed'] = os.path.join(icondir, 'cd_mixed.png')
-
- def draw(self, (type, object), x, osd):
- image = self.cdimages['empty_cdrom']
- width = 0
- for media in config.REMOVABLE_MEDIA:
- image = self.cdimages['empty_cdrom']
- if media.type == 'empty_cdrom':
- image = self.cdimages['empty_cdrom']
- if media.type and self.cdimages.has_key(media.type):
- image = self.cdimages[media.type]
- else:
- image = self.cdimages['mixed']
-
- width += osd.draw_image(image, (x+width, osd.y + 10, -1, -1))[0] +
10
- if width:
- width -= 10
- return width
-
-
-class mail(IdleBarPlugin):
- """
- Shows if new mail is in the mailbox.
-
- Activate with:
- plugin.activate('idlebar.mail', level=10, args=('path to mailbox', ))
-
- """
- def __init__(self, mailbox):
- IdleBarPlugin.__init__(self)
- self.NO_MAILIMAGE = os.path.join(config.ICON_DIR,
'status/newmail_dimmed.png')
- self.MAILIMAGE = os.path.join(config.ICON_DIR,
'status/newmail_active.png')
- self.MAILBOX = mailbox
-
- def checkmail(self):
- if not self.MAILBOX:
- return 0
- if os.path.isfile(self.MAILBOX):
- mb = mailbox.UnixMailbox (file(self.MAILBOX,'r'))
- msg = mb.next()
- count = 0
- while msg is not None:
- count = count + 1
- msg = mb.next()
- return count
- else:
- return 0
-
- def draw(self, (type, object), x, osd):
- if self.checkmail() > 0:
- return osd.draw_image(self.MAILIMAGE, (x, osd.y + 10, -1, -1))[0]
- else:
- return osd.draw_image(self.NO_MAILIMAGE, (x, osd.y + 10, -1,
-1))[0]
-
-
-
-
-class tv(IdleBarPlugin):
- """
- Informs you, when the xmltv-listings expires.
-
- Activate with:
- plugin.activate('idlebar.tv', level=20, args=(listings_threshold,))
- listings_threshold must be a number in hours. For example if you put
- args=(12, ) then 12 hours befor your xmltv listings run out the tv icon
- will present a warning. Once your xmltv data is expired it will present
- a more severe warning. If no args are given then no warnings will be
- given.
- """
- def __init__(self, listings_threshold=-1):
- IdleBarPlugin.__init__(self)
-
- self.listings_threshold = listings_threshold
- self.next_guide_check = 0
- self.listings_expire = 0
- self.tvlockfile = config.FREEVO_CACHEDIR + '/record.*'
- icondir = os.path.join(config.ICON_DIR, 'status')
- self.TVLOCKED = os.path.join(icondir, 'television_active.png')
- self.TVFREE = os.path.join(icondir, 'television_inactive.png')
- self.NEAR_EXPIRED = os.path.join(icondir,
'television_near_expired.png')
- self.EXPIRED = os.path.join(icondir, 'television_expired.png')
-
- def checktv(self):
- if len(glob.glob(self.tvlockfile)) > 0:
- return 1
- return 0
-
- def draw(self, (type, object), x, osd):
-
- if self.checktv() == 1:
- return osd.draw_image(self.TVLOCKED, (x, osd.y + 10, -1, -1))[0]
-
- if self.listings_threshold != -1:
- now = time.time()
-
- if now > self.next_guide_check:
- _debug_('TV: checking guide')
- self.listings_expire = tv_util.when_listings_expire()
- _debug_('TV: listings expire in %s hours' %
self.listings_expire)
- # check again in 10 minutes
- self.next_guide_check = now + 10*60
-
- if self.listings_expire == 0:
- return osd.draw_image(self.EXPIRED, (x, osd.y + 10, -1, -1))[0]
- elif self.listings_expire <= self.listings_threshold:
- return osd.draw_image(self.NEAR_EXPIRED, (x, osd.y + 10, -1,
-1))[0]
-
- return osd.draw_image(self.TVFREE, (x, osd.y + 10, -1, -1))[0]
-
-
-
-class weather(IdleBarPlugin):
- """
- Shows the current weather.
-
- Activate with:
- plugin.activate('idlebar.weather', level=30, args=('4-letter code', ))
-
- For weather station codes see: http://www.nws.noaa.gov/tg/siteloc.shtml
- You can also set the unit as second parameter in args ('C', 'F', or 'K')
- """
- def __init__(self, zone='CYYZ', units='C'):
- IdleBarPlugin.__init__(self)
- self.TEMPUNITS = units
- self.METARCODE = zone
- self.WEATHERCACHE = config.FREEVO_CACHEDIR + '/weather'
- print
- print 'WARNING: the idlebar.weather plugin downloads new weather'
- print 'information inside the main loop. This bug makes all menu'
- print 'actions _very_ slow. Consider not using this plugin for higher'
- print 'speed.'
- print
-
-
- def checkweather(self):
- # We don't want to do this every 30 seconds, so we need
- # to cache the date somewhere.
- #
- # First check the age of the cache.
- #
- if (os.path.isfile(self.WEATHERCACHE) == 0 or \
- (abs(time.time() - os.path.getmtime(self.WEATHERCACHE)) > 3600)):
- try:
- rf=pymetar.ReportFetcher(self.METARCODE)
- rep=rf.FetchReport()
- rp=pymetar.ReportParser()
- pr=rp.ParseReport(rep)
- if (pr.getTemperatureCelsius()):
- if self.TEMPUNITS == 'F':
- temperature = '%2d' % pr.getTemperatureFahrenheit()
- elif self.TEMPUNITS == 'K':
- ktemp = pr.getTemperatureCelsius() + 273
- temperature = '%3d' % ktemp
- else:
- temperature = '%2d' % pr.getTemperatureCelsius()
- else:
- temperature = '?' # Make it a string to match above.
- if pr.getPixmap():
- icon = pr.getPixmap() + '.png'
- else:
- icon = 'sun.png'
- cachefile = open(self.WEATHERCACHE,'w+')
- cachefile.write(temperature + '\n')
- cachefile.write(icon + '\n')
- cachefile.close()
- except:
- try:
- # HTTP Problems, use cache. Wait till next try.
- cachefile = open(self.WEATHERCACHE,'r')
- newlist = map(string.rstrip, cachefile.readlines())
- temperature,icon = newlist
- cachefile.close()
- except IOError:
- print 'WEATHER: error reading cache. Using fake weather.'
- try:
- cachefile = open(self.WEATHERCACHE,'w+')
- cachefile.write('?' + '\n')
- cachefile.write('sun.png' + '\n')
- cachefile.close()
- except IOError:
- print 'You have no permission to write %s' %
self.WEATHERCACHE
- return '0', 'sun.png'
-
-
- else:
- cachefile = open(self.WEATHERCACHE,'r')
- newlist = map(string.rstrip, cachefile.readlines())
- temperature,icon = newlist
- cachefile.close()
- return temperature, icon
-
- def draw(self, (type, object), x, osd):
- temp,icon = self.checkweather()
- font = osd.get_font('small0')
- osd.draw_image(os.path.join(config.ICON_DIR, 'weather/' + icon),
- (x, osd.y + 15, -1, -1))
- temp = u'%s\xb0' % temp
- width = font.stringsize(temp)
- osd.write_text(temp, font, None, x + 15, osd.y + 55 - font.h, width,
font.h,
- 'left', 'top')
- return width + 15
-
-
-class holidays(IdleBarPlugin):
- """
- Display some holidays in the idlebar
-
- This plugin checks if the current date is a holiday and will
- display a specified icon for that holiday. If no holiday is found,
- nothing will be displayed. If you use the idlebar, you should activate
- this plugin, most of the time you won't see it.
-
- You can customize the list of holidays with the variable HOLIDAYS in
- local_config.py. The default value is:
-
- [ ('01-01', 'newyear.png'),
- ('02-14', 'valentine.png'),
- ('05-07', 'freevo_bday.png'),
- ('07-03', 'usa_flag.png'),
- ('07-04', 'usa_flag.png'),
- ('10-30', 'ghost.png'),
- ('10-31', 'pumpkin.png'),
- ('12-21', 'snowman.png'),
- ('12-25', 'christmas.png')]
- """
- def __init__(self):
- IdleBarPlugin.__init__(self)
-
- def config(self):
- return [ ('HOLIDAYS', [ ('01-01', 'newyear.png'),
- ('02-14', 'valentine.png'),
- ('05-07', 'freevo_bday.png'),
- ('07-03', 'usa_flag.png'),
- ('07-04', 'usa_flag.png'),
- ('10-30', 'ghost.png'),
- ('10-31', 'pumpkin.png'),
- ('12-21', 'snowman.png'),
- ('12-25', 'christmas.png')],
- 'list of holidays this plugin knows') ]
-
- def get_holiday_icon(self):
- # Creates a string which looks like "07-04" meaning July 04
- todays_date = time.strftime('%m-%d')
-
- for i in config.HOLIDAYS:
- holiday, icon = i
- if todays_date == holiday:
- return os.path.join(config.ICON_DIR, 'holidays', icon)
-
- def draw(self, (type, object), x, osd):
- icon = self.get_holiday_icon()
- if icon:
- return osd.draw_image(icon, (x, osd.y + 10, -1, -1))[0]
-
-
-
+
class logo(IdleBarPlugin):
"""
Display the freevo logo in the idlebar
@@ -474,43 +195,4 @@
return osd.drawimage(image, (x, osd.y + 5, -1, 75))[0]
-class diskfree(IdleBarPlugin):
- """
- Displays the amount of free disk space
-
- Activate with:
- plugin.activate('idlebar.diskfree', level=30)
-
- This plugin displays the total amount of free disk space for recordings
- """
- def __init__(self):
- IdleBarPlugin.__init__(self)
- self.time = 0
- self.diskfree = 0
-
-
- def getDiskFree(self):
- """
- Determine amount of freedisk space
- Update maximum every 30 seconds
-
- """
- if (time.time()-self.time)>30:
- self.time = time.time()
- freespace = util.freespace(config.TV_RECORD_DIR)
- self.diskfree = _('%iGb') % (((freespace / 1024) / 1024) / 1024)
-
- def draw(self, (type,object),x,osd):
- """
- Drawing to idlebar
- """
-
- self.getDiskFree()
- font = osd.get_font('small0')
- widthdf = 0
- widthdf = font.stringsize(self.diskfree)
- osd.draw_image(os.path.join(config.ICON_DIR, 'misc/chartpie.png' ),(x,
osd.y + 7, -1, -1))
- osd.write_text(self.diskfree, font, None, x + 15, osd.y + 55 - font.h,
widthdf, font.h, 'left', 'top')
-
- return widthdf + 15
Added: branches/rel-1-5/freevo/src/plugins/idlebar/cdstatus.py
==============================================================================
--- (empty file)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/cdstatus.py Sun Oct 15
09:44:34 2006
@@ -0,0 +1,76 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# cdstatus.py - IdleBarplugin for monitoring the cdstatus
+# -----------------------------------------------------------------------
+# $Id: __init__.py 8333 2006-10-07 06:11:59Z duncan $
+#
+# -----------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2003 Krister Lagerstrom, et al.
+# Please see the file freevo/Docs/CREDITS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------
+
+
+# python modules
+import os
+
+# freevo modules
+from plugins.idlebar import IdleBarPlugin
+import plugin, config
+
+
+
+class PluginInterface(IdleBarPlugin):
+ """
+ Show the status of all rom drives.
+
+ Activate with:
+ plugin.activate('idlebar.cdstatus')
+ """
+ def __init__(self):
+ IdleBarPlugin.__init__(self)
+ self.plugin_name = 'idlebar.cdstatus'
+ icondir = os.path.join(config.ICON_DIR, 'status')
+ self.cdimages ={}
+ self.cdimages ['audiocd'] = os.path.join(icondir, 'cd_audio.png')
+ self.cdimages ['empty_cdrom'] = os.path.join(icondir,
'cd_inactive.png')
+ self.cdimages ['images'] = os.path.join(icondir, 'cd_photo.png')
+ self.cdimages ['video'] = os.path.join(icondir, 'cd_video.png')
+ self.cdimages ['dvd'] = os.path.join(icondir, 'cd_video.png')
+ self.cdimages ['burn'] = os.path.join(icondir, 'cd_burn.png')
+ self.cdimages ['cdrip'] = os.path.join(icondir, 'cd_rip.png')
+ self.cdimages ['mixed'] = os.path.join(icondir, 'cd_mixed.png')
+
+ def draw(self, (type, object), x, osd):
+ image = self.cdimages['empty_cdrom']
+ width = 0
+ for media in config.REMOVABLE_MEDIA:
+ image = self.cdimages['empty_cdrom']
+ if media.type == 'empty_cdrom':
+ image = self.cdimages['empty_cdrom']
+ if media.type and self.cdimages.has_key(media.type):
+ image = self.cdimages[media.type]
+ else:
+ image = self.cdimages['mixed']
+
+ width += osd.draw_image(image, (x+width, osd.y + 10, -1, -1))[0] +
10
+ if width:
+ width -= 10
+ return width
+
+
Added: branches/rel-1-5/freevo/src/plugins/idlebar/diskfree.py
==============================================================================
--- (empty file)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/diskfree.py Sun Oct 15
09:44:34 2006
@@ -0,0 +1,80 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# diskfree.py - IdleBarplugin for showing the freedisk space for recording
+# -----------------------------------------------------------------------
+# $Id: __init__.py 8333 2006-10-07 06:11:59Z duncan $
+#
+# Author: Tanja Kotthaus <[EMAIL PROTECTED]>
+# -----------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2003 Krister Lagerstrom, et al.
+# Please see the file freevo/Docs/CREDITS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------
+
+
+# python modules
+import time
+import os
+
+# freevo modules
+from plugins.idlebar import IdleBarPlugin
+import plugin, config
+import util.fileops as util
+
+
+class PluginInterface(IdleBarPlugin):
+ """
+ Displays the amount of free disk space
+
+ Activate with:
+ plugin.activate('idlebar.diskfree', level=30)
+
+ This plugin displays the total amount of free disk space for recordings
+ """
+ def __init__(self):
+ IdleBarPlugin.__init__(self)
+ self.plugin_name = 'idlebar.diskfree'
+ self.time = 0
+ self.diskfree = 0
+
+
+ def getDiskFree(self):
+ """
+ Determine amount of freedisk space
+ Update maximum every 30 seconds
+
+ """
+ if (time.time()-self.time)>30:
+ self.time = time.time()
+ freespace = util.freespace(config.TV_RECORD_DIR)
+ self.diskfree = _('%iGb') % (((freespace / 1024) / 1024) / 1024)
+
+ def draw(self, (type,object),x,osd):
+ """
+ Drawing to idlebar
+ """
+
+ self.getDiskFree()
+ font = osd.get_font('small0')
+ widthdf = 0
+ widthdf = font.stringsize(self.diskfree)
+ osd.draw_image(os.path.join(config.ICON_DIR, 'misc/chartpie.png' ),(x,
osd.y + 7, -1, -1))
+ osd.write_text(self.diskfree, font, None, x + 15, osd.y + 55 - font.h,
widthdf, font.h, 'left', 'top')
+
+ return widthdf + 15
+
Added: branches/rel-1-5/freevo/src/plugins/idlebar/holidays.py
==============================================================================
--- (empty file)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/holidays.py Sun Oct 15
09:44:34 2006
@@ -0,0 +1,88 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# holidays.py - IdleBarplugin that displays holidays
+# -----------------------------------------------------------------------
+# $Id: __init__.py 8333 2006-10-07 06:11:59Z duncan $
+# -----------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2003 Krister Lagerstrom, et al.
+# Please see the file freevo/Docs/CREDITS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------
+
+
+# python modules
+import os
+import time
+
+# freevo modules
+from plugins.idlebar import IdleBarPlugin
+import plugin, config
+
+
+
+class PluginInterface(IdleBarPlugin):
+ """
+ Display some holidays in the idlebar
+
+ This plugin checks if the current date is a holiday and will
+ display a specified icon for that holiday. If no holiday is found,
+ nothing will be displayed. If you use the idlebar, you should activate
+ this plugin, most of the time you won't see it.
+
+ You can customize the list of holidays with the variable HOLIDAYS in
+ local_config.py. The default value is:
+
+ [ ('01-01', 'newyear.png'),
+ ('02-14', 'valentine.png'),
+ ('05-07', 'freevo_bday.png'),
+ ('07-03', 'usa_flag.png'),
+ ('07-04', 'usa_flag.png'),
+ ('10-30', 'ghost.png'),
+ ('10-31', 'pumpkin.png'),
+ ('12-21', 'snowman.png'),
+ ('12-25', 'christmas.png')]
+ """
+ def __init__(self):
+ IdleBarPlugin.__init__(self)
+ self.plugin_name = 'idlebar.holidays'
+
+ def config(self):
+ return [ ('HOLIDAYS', [ ('01-01', 'newyear.png'),
+ ('02-14', 'valentine.png'),
+ ('05-07', 'freevo_bday.png'),
+ ('07-03', 'usa_flag.png'),
+ ('07-04', 'usa_flag.png'),
+ ('10-30', 'ghost.png'),
+ ('10-31', 'pumpkin.png'),
+ ('12-21', 'snowman.png'),
+ ('12-25', 'christmas.png')],
+ 'list of holidays this plugin knows') ]
+
+ def get_holiday_icon(self):
+ # Creates a string which looks like "07-04" meaning July 04
+ todays_date = time.strftime('%m-%d')
+
+ for i in config.HOLIDAYS:
+ holiday, icon = i
+ if todays_date == holiday:
+ return os.path.join(config.ICON_DIR, 'holidays', icon)
+
+ def draw(self, (type, object), x, osd):
+ icon = self.get_holiday_icon()
+ if icon:
+ return osd.draw_image(icon, (x, osd.y + 10, -1, -1))[0]
Added: branches/rel-1-5/freevo/src/plugins/idlebar/mail.py
==============================================================================
--- (empty file)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/mail.py Sun Oct 15 09:44:34 2006
@@ -0,0 +1,73 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# mail.py - IdleBarplugin for monitoring the mail box
+# -----------------------------------------------------------------------
+# $Id: __init__.py 8333 2006-10-07 06:11:59Z duncan $
+#
+# -----------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2003 Krister Lagerstrom, et al.
+# Please see the file freevo/Docs/CREDITS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------
+
+
+# python modules
+import os
+import time
+import mailbox
+
+# freevo modules
+from plugins.idlebar import IdleBarPlugin
+import plugin, config
+
+
+
+class PluginInterface(IdleBarPlugin):
+ """
+ Shows if new mail is in the mailbox.
+
+ Activate with:
+ plugin.activate('idlebar.mail', level=10, args=('path to mailbox', ))
+
+ """
+ def __init__(self, mailbox):
+ IdleBarPlugin.__init__(self)
+ self.plugin_name = 'idlebar.mail'
+ self.NO_MAILIMAGE = os.path.join(config.ICON_DIR,
'status/newmail_dimmed.png')
+ self.MAILIMAGE = os.path.join(config.ICON_DIR,
'status/newmail_active.png')
+ self.MAILBOX = mailbox
+
+ def checkmail(self):
+ if not self.MAILBOX:
+ return 0
+ if os.path.isfile(self.MAILBOX):
+ mb = mailbox.UnixMailbox (file(self.MAILBOX,'r'))
+ msg = mb.next()
+ count = 0
+ while msg is not None:
+ count = count + 1
+ msg = mb.next()
+ return count
+ else:
+ return 0
+
+ def draw(self, (type, object), x, osd):
+ if self.checkmail() > 0:
+ return osd.draw_image(self.MAILIMAGE, (x, osd.y + 10, -1, -1))[0]
+ else:
+ return osd.draw_image(self.NO_MAILIMAGE, (x, osd.y + 10, -1,
-1))[0]
Modified: branches/rel-1-5/freevo/src/plugins/idlebar/system.py
==============================================================================
--- branches/rel-1-5/freevo/src/plugins/idlebar/system.py (original)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/system.py Sun Oct 15
09:44:34 2006
@@ -11,17 +11,6 @@
# idlebar.system.sensors
#
# -----------------------------------------------------------------------
-# $Log$
-# Revision 1.11 2004/07/11 11:06:56 dischi
-# 2.6.x kernel fixes
-#
-# Revision 1.10 2004/07/10 12:33:41 dischi
-# header cleanup
-#
-# Revision 1.9 2004/05/13 12:30:53 dischi
-# 2.6 fix from Viggo Fredriksen
-#
-# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al.
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
@@ -40,7 +29,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# ----------------------------------------------------------------------- */
+# -----------------------------------------------------------------------
import time
Added: branches/rel-1-5/freevo/src/plugins/idlebar/tv.py
==============================================================================
--- (empty file)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/tv.py Sun Oct 15 09:44:34 2006
@@ -0,0 +1,90 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# tv.py - IdleBarplugin for monitoring the xmltv-listings
+# -----------------------------------------------------------------------
+# $Id: system.py 5868 2004-07-11 11:06:56Z dischi $
+#
+# -----------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2003 Krister Lagerstrom, et al.
+# Please see the file freevo/Docs/CREDITS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------
+
+
+# python modules
+import os
+import glob
+import time
+
+# freevo modules
+from plugins.idlebar import IdleBarPlugin
+import plugin, config
+import util.tv_util as tv_util
+
+
+class PluginInterface(IdleBarPlugin):
+ """
+ Informs you, when the xmltv-listings expires.
+
+ Activate with:
+ plugin.activate('idlebar.tv', level=20, args=(listings_threshold,))
+ listings_threshold must be a number in hours. For example if you put
+ args=(12, ) then 12 hours befor your xmltv listings run out the tv icon
+ will present a warning. Once your xmltv data is expired it will present
+ a more severe warning. If no args are given then no warnings will be
+ given.
+ """
+ def __init__(self, listings_threshold=-1):
+ IdleBarPlugin.__init__(self)
+ self.plugin_name = 'idlebar.tv'
+ self.listings_threshold = listings_threshold
+ self.next_guide_check = 0
+ self.listings_expire = 0
+ self.tvlockfile = config.FREEVO_CACHEDIR + '/record.*'
+ icondir = os.path.join(config.ICON_DIR, 'status')
+ self.TVLOCKED = os.path.join(icondir, 'television_active.png')
+ self.TVFREE = os.path.join(icondir, 'television_inactive.png')
+ self.NEAR_EXPIRED = os.path.join(icondir,
'television_near_expired.png')
+ self.EXPIRED = os.path.join(icondir, 'television_expired.png')
+
+ def checktv(self):
+ if len(glob.glob(self.tvlockfile)) > 0:
+ return 1
+ return 0
+
+ def draw(self, (type, object), x, osd):
+
+ if self.checktv() == 1:
+ return osd.draw_image(self.TVLOCKED, (x, osd.y + 10, -1, -1))[0]
+
+ if self.listings_threshold != -1:
+ now = time.time()
+
+ if now > self.next_guide_check:
+ _debug_('TV: checking guide')
+ self.listings_expire = tv_util.when_listings_expire()
+ _debug_('TV: listings expire in %s hours' %
self.listings_expire)
+ # check again in 10 minutes
+ self.next_guide_check = now + 10*60
+
+ if self.listings_expire == 0:
+ return osd.draw_image(self.EXPIRED, (x, osd.y + 10, -1, -1))[0]
+ elif self.listings_expire <= self.listings_threshold:
+ return osd.draw_image(self.NEAR_EXPIRED, (x, osd.y + 10, -1,
-1))[0]
+
+ return osd.draw_image(self.TVFREE, (x, osd.y + 10, -1, -1))[0]
Modified: branches/rel-1-5/freevo/src/plugins/idlebar/volume.py
==============================================================================
--- branches/rel-1-5/freevo/src/plugins/idlebar/volume.py (original)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/volume.py Sun Oct 15
09:44:34 2006
@@ -1,14 +1,10 @@
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# volume.py - IdleBarplugin for showing volume
-# Author: Viggo Fredriksen <[EMAIL PROTECTED]>
# -----------------------------------------------------------------------
# $Id$
#
-# -----------------------------------------------------------------------
-# $Log$
-# Revision 1.2 2004/07/10 12:33:41 dischi
-# header cleanup
+# Author: Viggo Fredriksen <[EMAIL PROTECTED]>
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
@@ -29,7 +25,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# ----------------------------------------------------------------------- */
+# -----------------------------------------------------------------------
# python modules
Added: branches/rel-1-5/freevo/src/plugins/idlebar/weather.py
==============================================================================
--- (empty file)
+++ branches/rel-1-5/freevo/src/plugins/idlebar/weather.py Sun Oct 15
09:44:34 2006
@@ -0,0 +1,130 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------
+# weather.py - IdleBarplugin for weather
+# -----------------------------------------------------------------------
+# $Id: volume.py 5860 2004-07-10 12:33:43Z dischi $
+#
+# -----------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2003 Krister Lagerstrom, et al.
+# Please see the file freevo/Docs/CREDITS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------
+
+
+# python modules
+import os
+import time
+import string
+
+# freevo modules
+from plugins.idlebar import IdleBarPlugin
+import plugin, config
+import util.pymetar as pymetar
+
+
+class PluginInterface(IdleBarPlugin):
+ """
+ Shows the current weather.
+
+ Activate with:
+ plugin.activate('idlebar.weather', level=30, args=('4-letter code', ))
+
+ For weather station codes see: http://www.nws.noaa.gov/tg/siteloc.shtml
+ You can also set the unit as second parameter in args ('C', 'F', or 'K')
+ """
+ def __init__(self, zone='CYYZ', units='C'):
+ IdleBarPlugin.__init__(self)
+ self.plugin_name = 'idlebar.weather'
+ self.TEMPUNITS = units
+ self.METARCODE = zone
+ self.WEATHERCACHE = config.FREEVO_CACHEDIR + '/weather'
+ print
+ print 'WARNING: the idlebar.weather plugin downloads new weather'
+ print 'information inside the main loop. This bug makes all menu'
+ print 'actions _very_ slow. Consider not using this plugin for higher'
+ print 'speed.'
+ print
+
+
+ def checkweather(self):
+ # We don't want to do this every 30 seconds, so we need
+ # to cache the date somewhere.
+ #
+ # First check the age of the cache.
+ #
+ if (os.path.isfile(self.WEATHERCACHE) == 0 or \
+ (abs(time.time() - os.path.getmtime(self.WEATHERCACHE)) > 3600)):
+ try:
+ rf=pymetar.ReportFetcher(self.METARCODE)
+ rep=rf.FetchReport()
+ rp=pymetar.ReportParser()
+ pr=rp.ParseReport(rep)
+ if (pr.getTemperatureCelsius()):
+ if self.TEMPUNITS == 'F':
+ temperature = '%2d' % pr.getTemperatureFahrenheit()
+ elif self.TEMPUNITS == 'K':
+ ktemp = pr.getTemperatureCelsius() + 273
+ temperature = '%3d' % ktemp
+ else:
+ temperature = '%2d' % pr.getTemperatureCelsius()
+ else:
+ temperature = '?' # Make it a string to match above.
+ if pr.getPixmap():
+ icon = pr.getPixmap() + '.png'
+ else:
+ icon = 'sun.png'
+ cachefile = open(self.WEATHERCACHE,'w+')
+ cachefile.write(temperature + '\n')
+ cachefile.write(icon + '\n')
+ cachefile.close()
+ except:
+ try:
+ # HTTP Problems, use cache. Wait till next try.
+ cachefile = open(self.WEATHERCACHE,'r')
+ newlist = map(string.rstrip, cachefile.readlines())
+ temperature,icon = newlist
+ cachefile.close()
+ except IOError:
+ print 'WEATHER: error reading cache. Using fake weather.'
+ try:
+ cachefile = open(self.WEATHERCACHE,'w+')
+ cachefile.write('?' + '\n')
+ cachefile.write('sun.png' + '\n')
+ cachefile.close()
+ except IOError:
+ print 'You have no permission to write %s' %
self.WEATHERCACHE
+ return '0', 'sun.png'
+
+
+ else:
+ cachefile = open(self.WEATHERCACHE,'r')
+ newlist = map(string.rstrip, cachefile.readlines())
+ temperature,icon = newlist
+ cachefile.close()
+ return temperature, icon
+
+ def draw(self, (type, object), x, osd):
+ temp,icon = self.checkweather()
+ font = osd.get_font('small0')
+ osd.draw_image(os.path.join(config.ICON_DIR, 'weather/' + icon),
+ (x, osd.y + 15, -1, -1))
+ temp = u'%s\xb0' % temp
+ width = font.stringsize(temp)
+ osd.write_text(temp, font, None, x + 15, osd.y + 55 - font.h, width,
font.h,
+ 'left', 'top')
+ return width + 15
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog