On Sun, 2005-08-21 at 20:13 +0200, Dirk Meyer wrote: > me. Two questions: How do I add a subdir? As dir in a dir? Or as file > in a dir? Second: how to handle files in files (e.g. titles on a dvd)? > Just create a dir entry with the filename?
Yes, adding a dir in a dir isn't going to work as it is. Probably the
dirs table should have a dir_id column. Directory names should be
decomposed into parts and new entries created for each part, with dir_id
pointing to its parent.
add_directory("/home/freevo/media/mp3/Enya")
-> creates in dirs table:
id=1, dir_id=NULL, path=/
id=2, dir_id=1, path=/home
id=3, dir_id=2, path=/home/freevo
id=4, dir_id=3, path=/home/freevo/media
id=5, dir_id=4, path=/home/freevo/media/mp3
id=6, dir_id=5, path=/home/freevo/media/mp3/Enya
A dir() would then query all files_* tables for dir_id=X and also the
dirs table itself for dir_id=X.
As for files in files, is that needed? Do you need to be able to search
on title information? Can't you register a "dvd" type, and store title
info in the pickle?
> Now to the generic use. Yes, it is very generic. But do we want this?
> Don't get me wrong, it is a nice database wrapper, but for a mediadb
> we have specific needs. We have kaa.metadata so I don't want the user
> app to call it. This should be done inside the vfs. I propose your
> code as kaa/vfs/src/database.py and we add stuff around it that is
> media specific (e.g. register types no matter what the app knows).
Yes, that was always the idea. DBOverlord is _just_ the database
wrapper. It is not meant to be used directly by the application. It
doesn't understand anything about the filesystem. (It would never call
listdir() or stat() for example.) The VFS is opaquely layered on top of
that, and the application talks only to the VFS. The VFS then,
therefore, wraps the register_file_type_attrs function to provide some
suitable API to the user.
The dir() function that's in DBOverlord right now should be removed and
put into the VFS class instead. (Hence my note in dir() that it's just
testing.)
Jason.
signature.asc
Description: This is a digitally signed message part
