-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On July 8, 2003 10:09 pm, Aubin Paul wrote:
> We have a 'date_format_notz' for people who don't have a zone in their > listings, Ah, I'm only familiar with tv_grab_na so I didn't know there were grabbers that didn't use it. I've committed the change. > Only other changes is that we seem to have an 'open' except (which > isn't cool, but I don't want to change it now) where you have a > valueerror, and we fudge the stop times for missing stop data rather > than passing through. I set stop to start when stop is missing, which isn't entirely correct, since only start and channel are required attributes of programme. This made the programme invisible in my grid widget because it's drawn to "scale." > Interesting; currently, we pickle (actually, cPickle into a binary > pickle file) the data so it's pretty quick. But I want to move it to > sqlite. sqlite blows me away every time I use it. The Python API is > very lightweight, and adding sqlite support (including all third-party > things) involves about 200kb. SQLite is indeed very neat. I looked at it for a potential C project a while back. Not having to run/configure a separate DB server is a great thing, especially when your filesystem is on a 128 MB CF. :-) > Looks very cool; though do you have to run a seperate database > process? One of our goals (constraints :) is the aim of keeping > everything as simple as possible, hence our avoidance of a database > until sqlite, which is basically not unlike using berkelydb or an > indexed flat file, except that it's 90% of SQL92 compliant. There is no need for a separate DB process, but you can use one if you want. ZODB is the database used in Zope, so it supports all of the storage types that Zope does, which are: FileStorage (Writes to Data.fs) DirectoryStorage (Writes to multiple files in a directory) BerkeleyStorage (Writes to a BerkeleyDB) DCOracleStorage (Writes to an Oracle DB) ClientStorage (Writes via network to a ZEO server, which then writes to another storage type) The storage interface is well-defined, so new ones are easy to create. I'm currently using ClientStorage to a ZEO server which then writes to a FileStorage. It's totally unnecessary, but I have a fascination with distributed computing and clustering. ZEO was designed for load-balancing clusters... The path of least resistance lies in the following example: createstuff.py:: from ZODB import FileStorage, DB from Persistence import Persistent # If the storage file doesn't exist, it will be created storage = FileStorage.FileStorage('mydbfile.fs') db = DB(storage) conn = db.open() # Get root of DB, which is basically a dict root = conn.root() # Create a persistent class class AClass(Persistent): def __str__(self): return "I am a class" # Stick a string in there print "Adding a string" root['a_string'] = "I am a string" # Stick that class in there print "Adding an instance of AClass" root['a_class'] = AClass() # Commit changes get_transaction().commit() print "Committed" printstuff.py:: from ZODB import FileStorage, DB from Persistence import Persistent storage = FileStorage.FileStorage('mydbfile.fs') db = DB(storage) conn = db.open() root = conn.root() # Create a persistent class class AClass(Persistent): def __str__(self): return "I am a class" # Print what we placed in the DB earlier. Note that AClass needs to be # defined above before we try to use it print "a_string: %s" % root['a_string'] print "a_class: %s" % root['a_class'] Nice documentation is available at http://www.zope.org/Wikis/ZODB/guide/index.html IndexedCatalog makes this even cooler: from IndexedCatalog import Catalog, IndexedObject # Create an IC class class AnICClass(IndexedObject): # Define what to index by name = type("") number = type(0) def cat_init(self, name, number): """ Initialise IC vars """ self.name = name self.number = number # Create a catalog for AnICClass cat = Catalog(AnICClass) # Stick three objects in there firstobj = cat.new() firstobj.cat_init("first", 1) secondobj = cat.new() secondobj.cat_init("second", 2) thirdobj = cat.new() thirdobj.cat_init("third", 3) # Do some searching print "number > 1:" for res in cat.query("number > 1").sort('number'): print "Name: %s, Number: %s" % (res.name, res.number) print "\nname contains 'ir':" for res in cat.query("name ~ 'ir'").sort('number'): print "Name: %s, Number: %s" % (res.name, res.number) > > - - Event - This object, upon creation, schedules a run of > > 'OpenPVR_eventwrapper some_unique_id' upon initialisation via at and is > > placed in a dictionary in the ZODB. OpenPVR_eventwrapper gets the object > > and calls it's run() method, which would generally call some method. I > > use this to schedule recordings from a GUI interface I wrote in PyQt. I > > also see this as being useful for sending Jabber messages: "Your favorite > > show is coming on in one minute!" > > That's really cool. You seem to have a lot of the stuff we had in > mind. It might be a good idea to see what can be merged. That is something I would love to do. > After I get through some of the items on my TODO, I'll look into your > solution. We should just read the XMLTV file and go with those > channels. The only thing is that we need to split up the "display > name" field to figure out the tuner channel; it doesn't appear to > exist anywhere. That's a known deficiency in XMLTV 0.5 that's fixed in 0.6. Until then, the format of display-name shouldn't change. - -- James Oakley [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux) iD8DBQE/C5X2Ktn0F7+/lLMRAl3/AKDaHLjA5XZj+ie7aWP5zbPVO8wg6gCfR1J5 Skole0a+h2nlgPN5nU2QUXs= =rcJQ -----END PGP SIGNATURE----- ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ Freevo-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-devel