Author: dmeyer
Date: Sat Mar 18 19:44:09 2006
New Revision: 8103

Modified:
   trunk/tvserver/src/recorder.py

Log:
improve channel guessing

Modified: trunk/tvserver/src/recorder.py
==============================================================================
--- trunk/tvserver/src/recorder.py      (original)
+++ trunk/tvserver/src/recorder.py      Sat Mar 18 19:44:09 2006
@@ -237,7 +237,6 @@
 
 
     def sys_exit(self):
-        config.save()
         log.error('Unknown channels detected on device %s.' % self.device)
         log.error('Please check %s' % config.get_filename())
         log.error('Freevo guessed some settings, so maybe a new start will 
work\n')
@@ -271,6 +270,7 @@
         self.possible_bouquets = []
 
         error = False
+        guessing = False
         for bouquet in result[2]:
             self.possible_bouquets.append([])
             for channel in bouquet:
@@ -298,35 +298,28 @@
                     self.add_channel(chan, channel)
                     continue
 
-                # ok, new channel, try to guess mapping
+                guessing = True
+                # maybe the name is a little bit different
                 normchannel = self.normalize_name(channel)
-                chan = guide().get_channel(self.normalize_name(channel))
-                if chan:
-                    self.add_channel(chan, channel)
-                    continue
-
+                for c in guide().get_channels():
+                    if self.normalize_name(c.name) == normchannel:
+                        self.add_channel(c, channel)
+                        config.epg.mapping[channel] = c.name
+                        break
                 else:
                     # if we got this far that means there is nothing to connect
                     # the channel reported by tvdev to one in the EPG
-
+                    
                     # server may have started with previously unknown channels
                     # TODO: handle these unknown_channels, which are just
                     #       channels with no EPG data
-
+                    
                     if channel not in self.unknown_channels:
                         error = True
-                    chan = ''
-                    config.epg.mapping[channel] = chan
-
-        # TODO: remove this debugging when everything works good
-        log.debug('bouquets: %s', self.possible_bouquets)
-        n = 1
-        for b in self.possible_bouquets:
-            log.debug('bouquet %d', n)
-            for c in b:
-                log.debug('chan: %s', c)
-            n = n+1
+                    config.epg.mapping[channel] = ''
 
+        if guessing:
+            config.save()
         if error:
             OneShotTimer(self.sys_exit).start(1)
             return


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to