Author: rshortt
Date: Mon Mar 13 18:09:28 2006
New Revision: 8083
Modified:
trunk/WIP/RobShortt/webserver-epg2/src/base.py
trunk/WIP/RobShortt/webserver-epg2/src/pages/guide.py
Log:
Move compare function.
Modified: trunk/WIP/RobShortt/webserver-epg2/src/base.py
==============================================================================
--- trunk/WIP/RobShortt/webserver-epg2/src/base.py (original)
+++ trunk/WIP/RobShortt/webserver-epg2/src/base.py Mon Mar 13 18:09:28 2006
@@ -167,7 +167,7 @@
"""
def printAdvancedSearchForm(self, form=None):
- from freevo.ipc.epg import connect as guide
+ from freevo.ipc.epg import connect as guide, cmp_channel
chan = searchstr = ''
bychan = False
@@ -192,7 +192,7 @@
channels = guide().get_channels()
channels.sort(lambda a, b: cmp(a.name, b.name))
- channels.sort(lambda a, b: cmp(int(a.tuner_id), int(b.tuner_id)))
+ channels.sort(lambda a, b: cmp_channel(a, b))
for ch in channels:
self.res += '<option value="%s" ' % ch.name
@@ -200,7 +200,7 @@
self.res += 'selected '
if ch.tuner_id:
- self.res += '>%s %s</option>\n' % (ch.tuner_id, ch.name)
+ self.res += '>%s %s</option>\n' % (ch.tuner_id[0], ch.name)
else:
self.res += '>%s</option>\n' % ch.name
Modified: trunk/WIP/RobShortt/webserver-epg2/src/pages/guide.py
==============================================================================
--- trunk/WIP/RobShortt/webserver-epg2/src/pages/guide.py (original)
+++ trunk/WIP/RobShortt/webserver-epg2/src/pages/guide.py Mon Mar 13
18:09:28 2006
@@ -40,7 +40,7 @@
# freevo core imports
import freevo.ipc
-from freevo.ipc.epg import connect as guide
+from freevo.ipc.epg import connect as guide, cmp_channel
# webserver includes
from freevo.webserver import *
@@ -51,51 +51,6 @@
# get tvserver interface
tvserver = freevo.ipc.Instance().tvserver
-def cmp_chan(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
-
class Resource(HTMLResource):
@@ -220,7 +175,7 @@
# for now sort by name first, then tuner_id because tuner_id
# may be None.
channels.sort(lambda a, b: cmp(a.name, b.name))
- channels.sort(lambda a, b: cmp_chan(a, b))
+ channels.sort(lambda a, b: cmp_channel(a, b))
for chan in channels:
#put guidehead every X rows
-------------------------------------------------------
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