Author: duncan
Date: Tue Oct 17 18:52:21 2006
New Revision: 8408

Added:
   branches/rel-1/freevo/src/evdev.py
      - copied unchanged from r8407, /branches/rel-1-6/freevo/src/evdev.py
   branches/rel-1/freevo/src/evfallback.py
      - copied unchanged from r8407, /branches/rel-1-6/freevo/src/evfallback.py
Modified:
   branches/rel-1/freevo/Docs/CREDITS
   branches/rel-1/freevo/freevo_config.py
   branches/rel-1/freevo/local_conf.py.example
   branches/rel-1/freevo/src/audio/plugins/radioplayer.py
   branches/rel-1/freevo/src/config.py
   branches/rel-1/freevo/src/event.py
   branches/rel-1/freevo/src/helpers/recordserver.py
   branches/rel-1/freevo/src/plugins/shutdown.py
   branches/rel-1/freevo/src/plugins/upsoon.py
   branches/rel-1/freevo/src/rc.py
   branches/rel-1/freevo/src/tv/epg_types.py
   branches/rel-1/freevo/src/video/plugins/mover.py
   branches/rel-1/freevo/src/www/htdocs/library.rpy

Log:
Merged changes from branch rel-1-6

Modified: branches/rel-1/freevo/Docs/CREDITS
==============================================================================
--- branches/rel-1/freevo/Docs/CREDITS  (original)
+++ branches/rel-1/freevo/Docs/CREDITS  Tue Oct 17 18:52:21 2006
@@ -49,7 +49,10 @@
 o Mplayer for Audio support
 o Ogg Vorbis Tag and Playback support
 
-Duncan Webb <[EMAIL PROTECTED]>:
+John Molohan <[EMAIL PROTECTED]>
+o Web Site Maintainer
+
+Duncan Webb <[EMAIL PROTECTED]>
 o Maintainer of the stable branch 1.x
 
 
@@ -57,6 +60,22 @@
 Occasional contributors:
 ------------------------
 
+Hans Meine <[EMAIL PROTECTED]>
+o Various plug-ins and bug fixes
+
+Richard van Paasen <[EMAIL PROTECTED]>
+o Automated shutdown and wakeup
+o ivtv live tv pause plug-in
+
+James Oakley <[EMAIL PROTECTED]>
+o xmltv2 patches
+
+Pierre Ossman <[EMAIL PROTECTED]>
+o Linux event device input handler
+
+Gorka Olaizola <[EMAIL PROTECTED]>
+o Various bug fixes and patches
+
 Dan Eriksen <[EMAIL PROTECTED]>
 o 16-bit pixel support for the X11 OSD server
 o Joystick driver

Modified: branches/rel-1/freevo/freevo_config.py
==============================================================================
--- branches/rel-1/freevo/freevo_config.py      (original)
+++ branches/rel-1/freevo/freevo_config.py      Tue Oct 17 18:52:21 2006
@@ -235,7 +235,9 @@
         Added TV_RECORDFILE_OKLETTERS for characters allowed in recording 
filenames.
      Added AUTOSHUTDOWN_ settings to turn off and on the machine automatically
      Added Multi-tuner support to allow recording and watching at the same time
-     Added plug-in "upsoon" to stop the player when a recording is about to 
start''' ),
+     Added plug-in "upsoon" to stop the player when a recording is about to 
start
+     Added USE_SDL_KEYBOARD to specify if generic keyboard handler should be 
used
+     Added EVENT_DEVS and EVENTMAP for the new Linux event device handler''' ),
 ]
 
 
@@ -308,7 +310,6 @@
 ENABLE_SHUTDOWN_SYS = 0  # Performs a whole system shutdown at SHUTDOWN!
                          # For standalone boxes.
 
-# Warn before shutting down the system if the next recording is
 # scheduled for starting in less than this number of seconds:
 WARN_SHUTDOWN = 15 * 60
 
@@ -486,12 +487,35 @@
 MENU_ARROW_NAVIGATION = 0
 
 #
+# Process keyboard events from SDL. You want this unless you use only lirc
+# or event devices below.
+#
+USE_SDL_KEYBOARD = 1
+
+#
 # Keymap to map keyboard keys to event strings. You can also add new keys
 # here, e.g. KEYMAP[key.K_x] = 'SUBTITLE'. The K_-names are defined by pygame.
 #
 KEYMAP = DEFAULT_KEYMAP
 
 #
+# List of /dev/input/event# devices to monitor. If you monitor your keyboard
+# both here and with USE_SDL_KEYBOARD, then you will get duplicate events.
+#
+
+EVENT_DEVS = []
+
+#
+# Keymap to map input events to event strings. You can change current mappings
+# and add new ones here, e.g. EVENTMAP['KEY_COFFEE'] = 'SUBTITLE'. Key names
+# are defined by the Linux input layer (input.h). An axis is described by a
+# pair, one for positive and one for negative movement, e.g.
+# EVENTMAP['REL_Z'] = ('LEFT', 'RIGHT')
+#
+
+EVENTMAP = DEFAULT_EVENTMAP
+
+#
 # Use Internet resources to fetch information?
 # For example, Freevo can use CDDB for album information,
 # the IMDB movie database for movie info, and Amazon for cover searches. 

Modified: branches/rel-1/freevo/local_conf.py.example
==============================================================================
--- branches/rel-1/freevo/local_conf.py.example (original)
+++ branches/rel-1/freevo/local_conf.py.example Tue Oct 17 18:52:21 2006
@@ -241,11 +241,32 @@
 # MENU_ARROW_NAVIGATION = 0
 
 #
+# Process keyboard events from SDL. You want this unless you use only lirc
+# or event devices below.
+#
+# USE_SDL_KEYBOARD = 1
+
+#
 # Keymap to map keyboard keys to event strings. You can also add new keys
 # here, e.g. KEYMAP[key.K_x] = 'SUBTITLE'. The K_-names are defined by pygame.
 #
 
 #
+# List of /dev/input/event# devices to monitor. If you monitor your keyboard
+# both here and with USE_SDL_KEYBOARD, then you will get duplicate events.
+#
+#
+# EVENT_DEVS = []
+
+#
+# Keymap to map input events to event strings. You can change current mappings
+# and add new ones here, e.g. EVENTMAP['KEY_COFFEE'] = 'SUBTITLE'. Key names
+# are defined by the Linux input layer (input.h). An axis is described by a
+# pair, one for positive and one for negative movement, e.g.
+# EVENTMAP['REL_Z'] = ('LEFT', 'RIGHT')
+#
+
+#
 # Use Internet resources to fetch information?
 # For example, Freevo can use CDDB for album information,
 # the IMDB movie database for movie info, and Amazon for cover searches. 
@@ -965,25 +986,12 @@
 # TV_RECORD_SERVER_IP = 'localhost'
 # TV_RECORD_SERVER_PORT = 18001
 
-# Start every recording X minutes before scheduled,
+# start every recording X minutes before scheduled,
 # and stop X minutes after scheduled - default to zero minutes.
 # This must be a value in seconds although at the moment only has
 # the percision of one minute.
 # TV_RECORD_PADDING = 0 * 60
 
-# Warn before shutting down the system if the next recording is
-# scheduled for starting in less than this number of seconds:
-# WARN_SHUTDOWN = 15 * 60 # quarter hour
-# (This has no extra effect if CONFIRM_SHUTDOWN is set, since then
-#  the shutdown is already confirmed.)
-
-# On Freevo shutdown, use nvram-wakeup to program the computer to
-# wakeup / boot up right before the next recording:
-# USE_NVRAM_WAKEUP    = 1
-
-# If using nvram-wakeup, time in seconds to startup before recording:
-# BOOTTIME_PADDING    = 2 * 60
-
 # VCR_AUDIO = (':adevice=%s' % AUDIO_DEVICE +
 #              ':audiorate=32000' +         # 44100 for better sound
 #              ':forceaudio:forcechan=1:' + # Forced mono for bug in my driver

Modified: branches/rel-1/freevo/src/audio/plugins/radioplayer.py
==============================================================================
--- branches/rel-1/freevo/src/audio/plugins/radioplayer.py      (original)
+++ branches/rel-1/freevo/src/audio/plugins/radioplayer.py      Tue Oct 17 
18:52:21 2006
@@ -86,7 +86,10 @@
         self.item.elapsed = 0
         self.starttime = time.time()
 
-        print 'RadioPlayer.play() %s' % self.item.station
+        try:
+            print 'RadioPlayer.play() %s' % self.item.station
+        except AttributeError:
+            pass
             
         self.mode    = 'play'
 

Modified: branches/rel-1/freevo/src/config.py
==============================================================================
--- branches/rel-1/freevo/src/config.py (original)
+++ branches/rel-1/freevo/src/config.py Tue Oct 17 18:52:21 2006
@@ -267,13 +267,16 @@
 def _debug_function_(s, level=1):
     if DEBUG < level:
         return
-    # add the current trace to the string
-    where =  traceback.extract_stack(limit = 2)[0]
-    if isinstance( s, unicode ):
-        s = s.encode(encoding, 'replace')
-    s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s)
-    # print debug message
-    print s
+    try:
+        # add the current trace to the string
+        where =  traceback.extract_stack(limit = 2)[0]
+        if isinstance( s, unicode ):
+            s = s.encode(encoding, 'replace')
+        s = '%s (%s): %s' % (where[0][where[0].rfind('/')+1:], where[1], s)
+        # print debug message
+        print s
+    except UnicodeEncodeError:
+        print "_debug_ failed."
 
             
 __builtin__.__dict__['_debug_']= _debug_function_

Modified: branches/rel-1/freevo/src/event.py
==============================================================================
--- branches/rel-1/freevo/src/event.py  (original)
+++ branches/rel-1/freevo/src/event.py  Tue Oct 17 18:52:21 2006
@@ -26,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
 #
-# ----------------------------------------------------------------------- */
+# -----------------------------------------------------------------------
 
 
 class Event:
@@ -538,6 +538,76 @@
     }
 
 
+DEFAULT_EVENTMAP = {
+    'KEY_F1'          : 'SLEEP',
+    'KEY_HOME'        : 'MENU',
+    'KEY_G'           : 'GUIDE',
+    'KEY_ESC'         : 'EXIT',
+    'KEY_UP'          : 'UP',
+    'KEY_DOWN'        : 'DOWN',
+    'KEY_LEFT'        : 'LEFT',
+    'KEY_RIGHT'       : 'RIGHT',
+    'KEY_OK'          : 'SELECT',
+    'KEY_SPACE'       : 'SELECT',
+    'KEY_ENTER'       : 'SELECT',
+    'KEY_KPENTER'     : 'SELECT',
+    'KEY_POWER'       : 'POWER',
+    'KEY_F2'          : 'POWER',
+    'KEY_MUTE'        : 'MUTE',
+    'KEY_F3'          : 'MUTE',
+    'KEY_VOLUMEDOWN'  : 'VOL-',
+    'KEY_KPMINUS'     : 'VOL-',
+    'KEY_N'           : 'VOL-',
+    'KEY_VOLUMEUP'    : 'VOL+',
+    'KEY_KPPLUS'      : 'VOL+',
+    'KEY_M'           : 'VOL+',
+    'KEY_CHANNELUP'   : 'CH+',
+    'KEY_C'           : 'CH+',
+    'KEY_CHANNELDOWN' : 'CH-',
+    'KEY_V'           : 'CH-',
+    'KEY_1'           : '1',
+    'KEY_2'           : '2',
+    'KEY_3'           : '3',
+    'KEY_4'           : '4',
+    'KEY_5'           : '5',
+    'KEY_6'           : '6',
+    'KEY_7'           : '7',
+    'KEY_8'           : '8',
+    'KEY_9'           : '9',
+    'KEY_0'           : '0',
+    'KEY_VENDOR'      : 'DISPLAY',
+    'KEY_D'           : 'DISPLAY',
+    'KEY_MENU'        : 'ENTER',
+    'KEY_E'           : 'ENTER',
+    'KEY_MINUS'       : 'PREV_CH',
+    'KEY_O'           : 'PIP_ONOFF',
+    'KEY_W'           : 'PIP_SWAP',
+    'KEY_I'           : 'PIP_MOVE',
+    'KEY_F4'          : 'TV_VCR',
+    'KEY_REWIND'      : 'REW',
+    'KEY_R'           : 'REW',
+    'KEY_PLAY'        : 'PLAY',
+    'KEY_P'           : 'PLAY',
+    'KEY_FORWARD'     : 'FFWD',
+    'KEY_F'           : 'FFWD',
+    'KEY_PAUSE'       : 'PAUSE',
+    'KEY_U'           : 'PAUSE',
+    'KEY_STOP'        : 'STOP',
+    'KEY_S'           : 'STOP',
+    'KEY_RECORD'      : 'RECORD',
+    'KEY_F6'          : 'REC',
+    'KEY_PERIOD'      : 'EJECT',
+    'KEY_L'           : 'SUBTITLE',
+    'KEY_A'           : 'LANG',
+
+    'REL_X'           : ('LEFT', 'RIGHT'),
+    'REL_Y'           : ('UP', 'DOWN'),
+
+    'BTN_LEFT'        : 'SELECT',
+    'BTN_RIGHT'       : 'EXIT',
+    }
+
+
 
 #
 # Internal events, don't map any button on them

Modified: branches/rel-1/freevo/src/helpers/recordserver.py
==============================================================================
--- branches/rel-1/freevo/src/helpers/recordserver.py   (original)
+++ branches/rel-1/freevo/src/helpers/recordserver.py   Tue Oct 17 18:52:21 2006
@@ -129,8 +129,7 @@
         proglist.sort(self.progsTimeCompare)
         for progitem in proglist:
             prog = progs[progitem]
-            _debug_('%s:%s chan=%s %s->%s' % (prog.title.encode('utf-8'), 
prog.sub_title.encode('utf-8'), \
-                prog.channel_id, time.localtime(prog.start), 
time.localtime(prog.stop)), dbglvl+1)
+            _debug_('%s' % (prog), dbglvl+1)
 
             try:
                 recording = prog.isRecording
@@ -153,8 +152,7 @@
             _debug_('No program scheduled to record', dbglvl)
             return None
 
-        _debug_('\"%s\" %s %s->%s' % (next_program.title, 
next_program.channel_id, \
-            time.localtime(next_program.start), 
time.localtime(next_program.stop)), dbglvl)
+        _debug_('%s' % (next_program), dbglvl)
         return next_program
 
 

Modified: branches/rel-1/freevo/src/plugins/shutdown.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/shutdown.py       (original)
+++ branches/rel-1/freevo/src/plugins/shutdown.py       Tue Oct 17 18:52:21 2006
@@ -50,9 +50,6 @@
 from item import Item
 from plugin import MainMenuPlugin
 
-if config.WARN_SHUTDOWN or config.USE_NVRAM_WAKEUP:
-    import tv.record_client as record_client
-
 
 def shutdown(menuw=None, argshutdown=None, argrestart=None, exit=False):
     """
@@ -129,6 +126,7 @@
         time.sleep(1)
         
 
+
 class ShutdownItem(Item):
     """
     Item for shutdown
@@ -148,7 +146,7 @@
                           (self.confirm_system_restart, _('Restart system') ) ]
         else:
             items = [ (self.shutdown_freevo, _('Shutdown Freevo') ),
-                      (self.check_shutdown_system, _('Shutdown system') ),
+                          (self.shutdown_system, _('Shutdown system') ),
                           (self.shutdown_system_restart, _('Restart system') ) 
]
         if config.ENABLE_SHUTDOWN_SYS:
             items = [ items[1], items[0], items[2] ]
@@ -156,46 +154,12 @@
         return items
 
 
-    def next_scheduled_recording(self):
-        """
-        return starting time of next scheduled recording (or None)
-        """
-        (server_available, msg) = record_client.connectionTest()
-        if not server_available:
-            return None
-        (result, recordings) = record_client.getScheduledRecordings()
-        if result:
-            progs = recordings.getProgramList().values()
-            if len(progs):
-                progs.sort(lambda a, b: cmp(a.start, b.start))
-                return progs[0].start
-        return None
-
-
-    def next_recording_message(self, format, start_time = None):
-        if start_time == None:
-            start_time = self.next_scheduled_recording()
-        if start_time == None:
-            return ""
-        rec_distance = start_time - time.time() - config.TV_RECORD_PADDING
-        if rec_distance < 0:
-            result = _('A recording is in progress.')
-        elif rec_distance < 60*60:
-            result = _('The next scheduled recording begins in %d minutes.') % 
int(rec_distance/60)
-        elif rec_distance < 60*60*10:
-            result = _('The next scheduled recording begins at %s.') % 
time.strftime(config.TV_TIMEFORMAT, time.localtime(start_time))
-        else:
-            result = _('The next recording is scheduled for %s.') % 
time.strftime(config.TV_DATETIMEFORMAT, time.localtime(start_time))
-        return format % result
-
-
     def confirm_freevo(self, arg=None, menuw=None):
         """
         Pops up a ConfirmBox.
         """
         self.menuw = menuw
-        what = _('Do you really want to shut down Freevo?') \
-               + self.next_recording_message(" %s")
+        what = _('Do you really want to shut down Freevo?')
         ConfirmBox(text=what, handler=self.shutdown_freevo, 
default_choice=1).show()
         
         
@@ -204,95 +168,39 @@
         Pops up a ConfirmBox.
         """
         self.menuw = menuw
-        what = _('Do you really want to shut down the system?') \
-               + self.next_recording_message(" %s")
+        what = _('Do you really want to shut down the system?')
         ConfirmBox(text=what, handler=self.shutdown_system, 
default_choice=1).show()
 
-
     def confirm_system_restart(self, arg=None, menuw=None):
         """
         Pops up a ConfirmBox.
         """
         self.menuw = menuw
-        what = _('Do you really want to restart the system?') \
-               + self.next_recording_message(" %s")
+        what = _('Do you really want to restart the system?')
         ConfirmBox(text=what, handler=self.shutdown_system_restart, 
default_choice=1).show()
 
 
-    def check_shutdown_system(self, arg=None, menuw=None):
-        """
-        Shutdown the complete system if the next recording is not too far away
-        """
-        if config.WARN_SHUTDOWN:
-            start_time = self.next_scheduled_recording()
-            if start_time != None:
-                if start_time - config.TV_RECORD_PADDING - time.time() \
-                       < config.WARN_SHUTDOWN:
-                    what = self.next_recording_message("%s ", start_time) + \
-                           _('Do you really want to shut down the system?')
-                    ConfirmBox(text=what, handler=self.shutdown_system, 
default_choice=1).show()
-                    return
-        self.shutdown_system(arg, menuw)
-
-
     def shutdown_freevo(self, arg=None, menuw=None):
         """
-        Shutdown freevo, don't shutdown the system
+        shutdown freevo, don't shutdown the system
         """
         shutdown(menuw=menuw, argshutdown=False, argrestart=False)
 
         
     def shutdown_system(self, arg=None, menuw=None):
         """
-        Shutdown the complete system, use nvram-wakeup to schedule
-        boot-up before next recording (if configured to do so).
-        nvram-wakup may signal that an additional reboot is needed
-        (with exitcode 1), in this case a flag file is created and the
-        system is rebooted.
-        """
-        doShutdown = True
-        if config.USE_NVRAM_WAKEUP:
-            start_time = self.next_scheduled_recording()
-            if start_time != None:
-                wakeupTime = start_time \
-                             - config.TV_RECORD_PADDING \
-                             - config.BOOTTIME_PADDING
-                _debug_("calling nvram-wakeup with %d" % wakeupTime)
-                ec = os.system(config.NVRAM_WAKEUP_CMD % (wakeupTime,))
-                _debug_(".. exitcode was %d" % ec)
-                if ec == 256:
-                    doShutdown = False
-                    file(config.NVRAM_REBOOT_FLAG, "w").close()
-                elif ec > 0:
-                    ConfirmBox(text=_('Could not program computer to boot up 
before next recording. Shutdown anyway?'),
-                               handler=self.shutdown_system_anyway, 
default_choice=1).show()
-                    return
-        shutdown(menuw=menuw, argshutdown=doShutdown, argrestart=not 
doShutdown)
-
-
-    def shutdown_system_anyway(self, arg=None, menuw=None):
-        """
-        Shutdown freevo, don't shutdown the system
+        shutdown the complete system
         """
         shutdown(menuw=menuw, argshutdown=True, argrestart=False)
 
-
     def shutdown_system_restart(self, arg=None, menuw=None):
         """
-        Restart the complete system
+        restart the complete system
         """
         shutdown(menuw=menuw, argshutdown=False, argrestart=True)
 
         
         
-# According to
-# http://mail.python.org/pipermail/python-list/2004-September/241553.html
-# a) Python has no uptime() implementation and
-# b) calling "uptime" is not more portable than parsing /proc/uptime.
-# Since the latter is much easier, I will do so.. ;-)
-def uptime():
-    uptime, idletime = [float(f) for f in file("/proc/uptime").read().split()]
-    return uptime
 
 
 #
@@ -304,8 +212,7 @@
     Plugin to shutdown Freevo from the main menu
     """
 
-    def __init__(self, *args):
-        MainMenuPlugin.__init__(self, *args)
-
     def items(self, parent):
         return [ ShutdownItem(parent) ]
+
+

Modified: branches/rel-1/freevo/src/plugins/upsoon.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/upsoon.py (original)
+++ branches/rel-1/freevo/src/plugins/upsoon.py Tue Oct 17 18:52:21 2006
@@ -188,7 +188,7 @@
         _debug_('poll(self)', dbglvl+1)
 
         self.next_program  = self.findNextProgram()
-        #_debug_('now=%s next_program=%s ' % (time.strftime('%T', 
time.localtime(now)), self.next_program), dbglvl)
+        _debug_('now=%s next_program=%s ' % (time.strftime('%T', 
time.localtime(now)), self.next_program), dbglvl)
         if self.next_program == None:
             return None
 

Modified: branches/rel-1/freevo/src/rc.py
==============================================================================
--- branches/rel-1/freevo/src/rc.py     (original)
+++ branches/rel-1/freevo/src/rc.py     Tue Oct 17 18:52:21 2006
@@ -8,30 +8,6 @@
 # Todo:        
 #
 # -----------------------------------------------------------------------
-# $Log$
-# Revision 1.36.2.1  2004/10/20 18:31:46  dischi
-# remove one shot callback from list before calling it
-#
-# Revision 1.36  2004/07/10 12:33:36  dischi
-# header cleanup
-#
-# Revision 1.35  2004/05/31 10:39:55  dischi
-# Again some interface changes. There is now only one function
-# handling all callbacks, including repeating calls with timer
-#
-# Revision 1.34  2004/05/30 18:27:53  dischi
-# More event / main loop cleanup. rc.py has a changed interface now
-#
-# Revision 1.33  2004/05/29 19:06:26  dischi
-# move some code from main to rc, create main class
-#
-# Revision 1.32  2004/05/20 18:26:27  dischi
-# patch from Viggo
-#
-# Revision 1.31  2004/05/09 14:16:16  dischi
-# let the child stdout handled by main
-#
-# -----------------------------------------------------------------------
 # 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.
@@ -50,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
@@ -60,6 +36,7 @@
 import types
 
 import config
+import evdev
 
 from event import Event, BUTTON
 
@@ -323,6 +300,45 @@
             # No data available
             return None
 
+# 
--------------------------------------------------------------------------------
+
+class Evdev:
+    """
+    Class to handle evdev events
+    """
+    def __init__(self):
+        """
+        init all specified devices
+        """
+        self._devs = []
+
+        for dev in config.EVENT_DEVS:
+            try:
+                e = evdev.evdev(dev)
+                print "Added input device '%s': %s" % (dev, e.get_name())
+                self._devs.append(e)
+            except:
+                print "Problem opening event device '%s'" % dev
+
+    def poll(self, rc):
+        """
+        return next event
+        """
+        for dev in self._devs:
+            event = dev.read()
+            if event is None:
+                continue
+
+            if config.EVENTMAP.has_key(event[2]):
+                if event[1] == 'EV_KEY':
+                    # 0 = release, 1 = press, 2 = repeat
+                    if event[3] > 0:
+                        return config.EVENTMAP[event[2]]
+                elif event[1] == 'EV_REL':
+                    if event[3] < -10:
+                        return config.EVENTMAP[event[2]][0]
+                    elif event[3] > 10:
+                        return config.EVENTMAP[event[2]][1]
 
 # 
--------------------------------------------------------------------------------
     
@@ -340,8 +356,14 @@
             except:
                 pass
 
+        if config.USE_SDL_KEYBOARD:
+            try:
+                self.inputs.append(Keyboard())
+            except:
+                pass
+
         try:
-            self.inputs.append(Keyboard())
+            self.inputs.append(Evdev())
         except:
             pass
 

Modified: branches/rel-1/freevo/src/tv/epg_types.py
==============================================================================
--- branches/rel-1/freevo/src/tv/epg_types.py   (original)
+++ branches/rel-1/freevo/src/tv/epg_types.py   Tue Oct 17 18:52:21 2006
@@ -9,26 +9,6 @@
 # Todo:        
 #
 # -----------------------------------------------------------------------
-# $Log$
-# Revision 1.21  2004/07/19 16:24:47  rshortt
-# Attempt to solve scheduled recordings upgrade problem.
-#
-# Revision 1.20  2004/07/10 12:33:41  dischi
-# header cleanup
-#
-# Revision 1.19  2004/07/01 22:49:49  rshortt
-# Unicode fix.
-#
-# Revision 1.18  2004/06/22 01:07:49  rshortt
-# Move stuff into __init__() and fix a bug for twisted's serialization.
-#
-# Revision 1.17  2004/03/05 20:49:11  rshortt
-# Add support for searching by movies only.  This uses the date field in xmltv
-# which is what tv_imdb uses and is really acurate.  I added a date property
-# to TvProgram for this and updated findMatches in the record_client and
-# recordserver.
-#
-# -----------------------------------------------------------------------
 # 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.
@@ -47,7 +27,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 #
-# ----------------------------------------------------------------------- */
+# -----------------------------------------------------------------------
 
 
 import sys
@@ -104,10 +84,14 @@
     def __str__(self):
         bt = time.localtime(self.start)   # Beginning time tuple
         et = time.localtime(self.stop)   # End time tuple
-        begins = '%s-%02d-%02d %02d:%02d' % (bt[0], bt[1], bt[2], bt[3], bt[4])
-        ends = '%s-%02d-%02d %02d:%02d' % (et[0], et[1], et[2], et[3], et[4])
-
-        s = '%s to %s  %3s %s' % (begins, ends, self.channel_id, self.title)
+        begins = time.strftime('%Y-%m-%d %a %H:%M', bt)
+        ends = time.strftime('%H:%M', et)
+        try:
+            channel_id = self.channel_id.encode('utf-8')
+            title = self.title.encode('utf-8')
+            s = '%s->%s  %3s %s' % (begins, ends, channel_id, title)
+        except UnicodeEncodeError: #just in case
+            s = '%s->%s. %3s %s' % (begins, ends, self.channel_id, self.title)
         return s
 
 

Modified: branches/rel-1/freevo/src/video/plugins/mover.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/mover.py    (original)
+++ branches/rel-1/freevo/src/video/plugins/mover.py    Tue Oct 17 18:52:21 2006
@@ -11,14 +11,6 @@
 # Todo:        
 #
 # -----------------------------------------------------------------------
-# $Log$
-# Revision 1.9  2004/07/10 12:33:43  dischi
-# header cleanup
-#
-# Revision 1.8  2004/01/12 19:11:48  dischi
-# fix typo to prevent crash
-#
-# -----------------------------------------------------------------------
 # 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.
@@ -37,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 os

Modified: branches/rel-1/freevo/src/www/htdocs/library.rpy
==============================================================================
--- branches/rel-1/freevo/src/www/htdocs/library.rpy    (original)
+++ branches/rel-1/freevo/src/www/htdocs/library.rpy    Tue Oct 17 18:52:21 2006
@@ -48,6 +48,18 @@
 
 class LibraryResource(FreevoResource):
     isLeaf=1
+    def is_access_allowed(self, dir_str):
+        allowed_dirs = []
+        allowed_dirs.extend(config.VIDEO_ITEMS)
+        allowed_dirs.extend(config.AUDIO_ITEMS)
+        allowed_dirs.extend( [ ('Recorded TV', config.TV_RECORD_DIR) ])
+        allowed_dirs.extend(config.IMAGE_ITEMS)
+        for i in range(len(allowed_dirs)):
+            val = allowed_dirs[i][1]
+            if dir_str.startswith(val):
+                return TRUE
+        return FALSE
+
     def get_suffixes (self, media):
         suffixes = []
         if media == 'music':
@@ -110,6 +122,10 @@
             action_newfile = Unicode( action_newfile, 'latin-1' )
             
         action_dir       = Unicode(fv.formValue(form, 'dir'))
+        dir_str = fv.formValue(form, 'dir')
+        if isinstance(dir_str, str):
+            if not self.is_access_allowed(dir_str):
+                action_dir = ""
         if isinstance( action_dir, str ):
             action_dir = Unicode( action_dir, 'latin-1' )
             

-------------------------------------------------------------------------
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

Reply via email to