Author: dmeyer
Date: Sun Feb 25 12:21:35 2007
New Revision: 9275
Modified:
trunk/tvserver/src/epg.py
trunk/ui/src/gui/areas/tvlisting_area.py
trunk/ui/src/tv/plugins/guide.py
trunk/ui/src/tv/program.py
trunk/webserver/src/pages/guide.py
trunk/webserver/src/pages/proginfo.py
trunk/webserver/src/pages/recordings.py
trunk/webserver/src/pages/search.py
Log:
adjust to kaa.epg.search returning an InProgress object
Modified: trunk/tvserver/src/epg.py
==============================================================================
--- trunk/tvserver/src/epg.py (original)
+++ trunk/tvserver/src/epg.py Sun Feb 25 12:21:35 2007
@@ -162,9 +162,8 @@
# Try to find the exact title again. The epg call is async so we
# create a callback for part 2 of this function and return.
- search_callback = Callback(self._check_recordings, rec, recordings,
callback)
- kaa.epg.search(title = rec.name, channel=channel, time = interval,
- callback=search_callback)
+ ip = kaa.epg.search(title = rec.name, channel=channel, time = interval)
+ ip.connect(self._check_recordings, rec, recordings, callback)
def _check_recordings(self, results, rec, recordings, callback):
@@ -221,15 +220,14 @@
# Note: we can't use keyword searching here because it won't match
# some favorite titles when they have short names.
- search_callback = Callback(self._check_favorities, fav, all_favorites,
- favorites, recordings, callback)
if fav.substring:
# unable to do that right now
- kaa.epg.search(keywords=fav.name, callback=search_callback)
- return
- # 'like' search
- kaa.epg.search(title=kaa.epg.QExpr('like', fav.name),
callback=search_callback)
-
+ ip = kaa.epg.search(keywords=fav.name)
+ else:
+ # 'like' search
+ ip = kaa.epg.search(title=kaa.epg.QExpr('like', fav.name))
+ ip.connect(self._check_favorities, fav, all_favorites,
+ favorites, recordings, callback)
def _check_favorities(self, listing, fav, all_favorites, favorites,
recordings,
callback):
Modified: trunk/ui/src/gui/areas/tvlisting_area.py
==============================================================================
--- trunk/ui/src/gui/areas/tvlisting_area.py (original)
+++ trunk/ui/src/gui/areas/tvlisting_area.py Sun Feb 25 12:21:35 2007
@@ -388,7 +388,8 @@
for channel in channel_list:
try:
#for prg in channel[start_time:stop_time]:
- for prg in kaa.epg.search(channel=channel, time=(start_time,
stop_time)):
+ for prg in kaa.epg.search(channel=channel, time=(start_time,
stop_time),
+ block = True):
flag_left = 0
flag_right = 0
Modified: trunk/ui/src/tv/plugins/guide.py
==============================================================================
--- trunk/ui/src/tv/plugins/guide.py (original)
+++ trunk/ui/src/tv/plugins/guide.py Sun Feb 25 12:21:35 2007
@@ -109,10 +109,9 @@
timestamp = self.current_time
log.info('channel: %s time %s', self.channel, timestamp)
- wait = kaa.notifier.YieldCallback()
- kaa.epg.search(channel=self.channel, time=timestamp, callback=wait)
+ wait = kaa.epg.search(channel=self.channel, time=timestamp)
yield wait
- prg = wait.get()
+ prg = wait()
if prg:
# one program found, return it
@@ -120,21 +119,18 @@
else:
# Now we are in trouble, there is no program item. We need to
create a fake
# one between the last stop and the next start time. This is very
slow!!!
- wait = kaa.notifier.YieldCallback()
- kaa.epg.search(channel=self.channel, time=(0, timestamp),
callback=wait)
+ wait = kaa.epg.search(channel=self.channel, time=(0, timestamp))
yield wait
- p = wait.get()
+ p = wait()
p.sort(lambda x,y: cmp(x.start, y.start))
if p:
start = p[-1].stop
else:
start = 0
- wait = kaa.notifier.YieldCallback()
- kaa.epg.search(channel=self.channel, time=(timestamp, sys.maxint),
- callback=wait)
+ wait = kaa.epg.search(channel=self.channel, time=(timestamp,
sys.maxint))
yield wait
- p = wait.get()
+ p = wait()
p.sort(lambda x,y: cmp(x.start, y.start))
if p:
stop = p[0].start
Modified: trunk/ui/src/tv/program.py
==============================================================================
--- trunk/ui/src/tv/program.py (original)
+++ trunk/ui/src/tv/program.py Sun Feb 25 12:21:35 2007
@@ -199,9 +199,15 @@
self.get_menustack().delete_submenu()
+ @kaa.notifier.yield_execution()
def channel_details(self):
items = []
- for prog in kaa.epg.search(channel=self.channel):
+ # query the epg database in background
+ query_data = kaa.epg.search(channel=self.channel)
+ yield query_data
+ # get data from InProgress object
+ query_data = query_data()
+ for prog in query_data:
items.append(ProgramItem(prog, self))
cmenu = Menu(self.channel.name, items, type = 'tv program menu')
# FIXME: the percent values need to be calculated
Modified: trunk/webserver/src/pages/guide.py
==============================================================================
--- trunk/webserver/src/pages/guide.py (original)
+++ trunk/webserver/src/pages/guide.py Sun Feb 25 12:21:35 2007
@@ -210,7 +210,7 @@
c_left = n_cols * cpb
progs = kaa.epg.search(channel = kaa.epg.get_channel(chan.name),
- time = (mfrguidestart, mfrnextguide))
+ time = (mfrguidestart, mfrnextguide),
block=True)
if not len(progs):
rowdata.append(u'<td class="programnodata"
colspan="%s">« ' % (n_cols*cpb) + _('This channel has no data loaded') +
' »' )
Modified: trunk/webserver/src/pages/proginfo.py
==============================================================================
--- trunk/webserver/src/pages/proginfo.py (original)
+++ trunk/webserver/src/pages/proginfo.py Sun Feb 25 12:21:35 2007
@@ -59,7 +59,7 @@
self.add(u'no such channel %s' % chanid)
return True
- prog = kaa.epg.search(channel = chan, time = starttime)[0]
+ prog = kaa.epg.search(channel = chan, time = starttime, block =
True)[0]
log.debug('program: %s', prog.title)
if prog.description in [u'', None]:
Modified: trunk/webserver/src/pages/recordings.py
==============================================================================
--- trunk/webserver/src/pages/recordings.py (original)
+++ trunk/webserver/src/pages/recordings.py Sun Feb 25 12:21:35 2007
@@ -92,7 +92,7 @@
elif action == 'add':
try:
prog = kaa.epg.search(channel=kaa.epg.get_channel(chan),
- time=int(start))[0]
+ time=int(start), block=True)[0]
except:
self.printHeader('Scheduled Recordings', 'styles/main.css')
self.printMessages(
Modified: trunk/webserver/src/pages/search.py
==============================================================================
--- trunk/webserver/src/pages/search.py (original)
+++ trunk/webserver/src/pages/search.py Sun Feb 25 12:21:35 2007
@@ -70,11 +70,10 @@
programs = []
else:
if channel:
- programs = kaa.epg.search(channel = channel,
- keywords = searchstr,
- limit = 100)
+ programs = kaa.epg.search(channel = channel, keywords =
searchstr,
+ limit = 100, wait = True)
else:
- programs = kaa.epg.search(keywords = searchstr, limit = 100)
+ programs = kaa.epg.search(keywords = searchstr, limit = 100,
block=True)
if len(programs) < 1:
if searchstr:
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog