Author: rshortt
Date: Mon Mar 13 18:11:29 2006
New Revision: 8084
Modified:
trunk/core/src/ipc/epg.py
Log:
Put cmp_channel function here for now but there may be a better place.
Modified: trunk/core/src/ipc/epg.py
==============================================================================
--- trunk/core/src/ipc/epg.py (original)
+++ trunk/core/src/ipc/epg.py Mon Mar 13 18:11:29 2006
@@ -45,7 +45,7 @@
# FIXME: create logger objects in conf
import freevo.conf
-__all__ = [ 'config', 'connect' ]
+__all__ = [ 'cmp_channel', 'config', 'connect' ]
# get logging object
log = logging.getLogger('epg')
@@ -137,3 +137,49 @@
return guide
+
+def cmp_channel(c1, c2):
+ l1 = len(c1.tuner_id)
+ l2 = len(c2.tuner_id)
+
+ if l1 == 0:
+ if l2 == 0:
+ return 0
+ else:
+ return -1
+
+ if l2 == 0:
+ if l1 == 0:
+ return 0
+ else:
+ return 1
+
+ a = 0
+ b = 0
+
+ for t in c1.tuner_id:
+ try:
+ a = int(t)
+ break
+ except:
+ if c1.tuner_id.index(t) < l1-1:
+ # try next time
+ continue
+ else:
+ break
+
+ for t in c2.tuner_id:
+ try:
+ b = int(t)
+ break
+ except:
+ if c2.tuner_id.index(t) < l2-1:
+ # try next time
+ continue
+ else:
+ break
+
+ if a < b: return -1
+ elif a > b: return 1
+ else: return 0
+
-------------------------------------------------------
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