Author: dmeyer
Date: Sat Jul 21 16:14:05 2007
New Revision: 2764
Log:
Add some test code to store the entry in beacon without
downloading it.
Modified:
trunk/WIP/mediafeed.py
Modified: trunk/WIP/mediafeed.py
==============================================================================
--- trunk/WIP/mediafeed.py (original)
+++ trunk/WIP/mediafeed.py Sat Jul 21 16:14:05 2007
@@ -9,6 +9,11 @@
import feedparser
import kaa.notifier
+import kaa.beacon
+
+for t in ('video', 'audio', 'image'):
+ kaa.beacon.register_file_type_attrs(
+ t, mediafeed_channel = (int, kaa.beacon.ATTR_SIMPLE))
# ##################################################################
# Brain Dump
@@ -162,6 +167,32 @@
if num == 0:
return
+ @kaa.notifier.yield_execution()
+ def store_in_beacon(self, num, destdir):
+ d = kaa.beacon.get(destdir)
+ items = {}
+ for i in d.list():
+ if i.get('mediafeed_channel') == self.url:
+ items[i.url] = i
+
+ for entry in self:
+ if isinstance(entry, kaa.notifier.InProgress):
+ # dummy entry to signal waiting
+ yield entry
+ continue
+
+ if entry.url in items:
+ del items[entry.url]
+ else:
+ i = kaa.beacon.add_item(type='video', parent=d,
+ mediafeed_channel=self.url, **entry)
+ num -= 1
+ if num == 0:
+ break
+
+ for i in items.values():
+ i.delete()
+
# ##################################################################
# specific channels
@@ -268,17 +299,23 @@
if self._filter(f):
yield f
-# c = Stage6('Diva-Channel')
-# f = Filter(c, lambda(e): 'Lisa Loeb' in e.title)
-# f.update('/local/video')
-
-# f = Stage6('Diva-Channel')
-# f.update('/local/video/MusicVideo', 2)
-
-f = RSS('http://www.tagesschau.de/export/video-podcast')
-f.update('/local/video', 2).connect(sys.exit)
-
-# f = YouTube(tags='robot chicken')
-# f.update('/local/video', 2)
-
+if 0:
+ c = Stage6('Diva-Channel')
+ f = Filter(c, lambda(e): 'Garbage' in e.title)
+ f.update('/local/video')
+
+ # f = Stage6('Diva-Channel')
+ # f.update('/local/video/MusicVideo', 2)
+
+ # f = RSS('http://www.tagesschau.de/export/video-podcast')
+ # f.update('/local/video', 2).connect(sys.exit)
+
+ # f = YouTube(tags='robot chicken')
+ # f.update('/local/video', 2)
+
+if 1:
+ kaa.beacon.connect()
+ f = RSS('http://www.tagesschau.de/export/video-podcast')
+ f.store_in_beacon(2, '/local/video2').connect(sys.exit)
+
kaa.notifier.loop()
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog