Zope is awesome! (Just had to get that off of my chest. :) First of all, I'm not subscribed to this list. Please CC me with any responses; my inbox is just too full to justify subscribing to another list at the moment. :) A few weeks ago, I was having problems interfacing Zope with Roxen. Once I had accomplished that, I began working on redoing my homepage in Zope. Granted, using Zope for a personal webpage is overkill, but I learned lots about Zope in the process. I also like how I can immediately change the appearance of all of my pages, dynamically generate content and such without mucking about with CSS/CGI. Now I'm starting work on another Zope project. Last Christmas I began searching for a web-based system to catalog and play MP3's. I wanted something which would allow me to catalog MP3's, play them, search my collection, etc. I also wanted to stream MP3's to other computers, dynamically create low-bitrate streams for listening to my collection at home over a dial-in line, for example. I searched and, though I found some promising code, none of it did what I wanted. So, I started writing my own system. My first incarnation of code used Icecast for streaming, and since it was an Icecast-based jukebox I decided to call it Icebox. Icebox was a combination of PHP, Python and PostgreSQL though, and considering the fact that I didn't know much about PostgreSQL or PHP at the time, 2/3 of it was rather cludgy. It did the job, though. :) After discovering Zope, I decided to try rewriting Icebox as a one-piece solution. You'd only need to untar a tarball into your library directory and follow a few more Zope-based steps (see below) to get the thing working. This would be much easier than copying PHP pages into a specific page beneath your server root, setting up PostgreSQL and the needed tables, . . . So I rewrote Icebox's database layer to use ZODB, and began organizing the code into a Python package. I'm having a few issues, though. Rewriting Icebox's database layer to use ZODB was easy, but I'm running into a minor problem. I'm using MP3 objects which contain artist, title and album information about an MP3. The files are indexed in a ZODB using their paths as keys. When the Icebox command line utility runs and begins streaming an MP3, *.lock/.tmp files are left in the directory where the databases reside. This prevents the code from running again, since ZODB thinks that its databases are locked. I've tried calling close() methods on the database and root, but this doesn't work. I initially had a get_transaction().commit() call in the code, but this threw the following exception: Traceback (innermost last): File "/home/nolan/bin/icebox", line 37, in ? db.updatePlaylist() File "/home/nolan/src/Icebox/database.py", line 106, in updatePlaylist get_transaction().commit() File "/usr/lib/zope/lib/python/ZODB/Transaction.py", line 237, in commit j.commit(o,self) File "/usr/lib/zope/lib/python/ZODB/Connection.py", line 320, in commit state=object.__getstate__() File "/usr/lib/zope/lib/python/ZODB/Connection.py", line 391, in setstate p, serial = self._storage.load(oid, self._version) File "/usr/lib/zope/lib/python/ZODB/FileStorage.py", line 584, in load try: return self._load(oid, version, self._index, self._file) File "/usr/lib/zope/lib/python/ZODB/FileStorage.py", line 560, in _load pos=_index[oid] KeyError: Exit 1 Can anyone explain that? Is the get_transaction().commit()'s absence causing the lock files to remain? The database's contents appear to be changing, though. I have one final question. I'd like to distribute Icebox when it is complete, but I'm confused about how. Icebox isn't exactly a product; it is more of a complete site which is intended to be dropped in as is, or changed after installation. I think I recall seeing a directory where packages could be installed and their methods could be called as external methods in Zope. Would it be best to just build a tarball which is meant to unpack into this directory from the Zope root, and to export my site and distribute the results? Or, is there a better method for distributing complete sites? (Or, is my understanding of products completely flawed? I imagined them as collections of ZClasses, which Icebox is not.) Thanks a bunch.
participants (1)
-
Nolan Darilek