Author: dmeyer
Date: Wed Feb 22 09:36:48 2006
New Revision: 1213

Added:
   trunk/WIP/vfs/README

Log:
add small api doc

Added: trunk/WIP/vfs/README
==============================================================================
--- (empty file)
+++ trunk/WIP/vfs/README        Wed Feb 22 09:36:48 2006
@@ -0,0 +1,67 @@
+Small API doc for kaa.vfs. Some parts are still missing but everything
+written here should work. The variable / function names may change in
+the future. 
+
+DO NOT ACCESS ANY MEMBER FUNCTIONS OR VARIABLES STARTING WIRH _vfs!!!
+They are for internal use only and you can do stuff with the db you
+should not be able to do.
+
+
+Fill the database
+
+You can use the monitor stuff (I will explain later) or you can use
+the cache test app to fill the database. Open cache.py in the test dir
+and change the db path to the localtion of your database
+(e.g. /var/lib/freevo/vfsdb). After that call python cache.py with a
+directory as argument. The test app will recursive add the files to
+the database.
+
+
+Access the database
+
+First you need to connect to the database. After that you can get a
+directory object and call the listdir() memeber function. You get a
+Query object in return. Besides some monitoring stuff, the class has
+an interator to walk through the list of results:
+
+| kaa.vfs.connect('/var/lib/freevo/vfsdb')
+| directory = kaa.vfs.get('/home/mp3')
+| listing = directory.listdir()
+| for item in listing:
+|     print item
+
+Item is an object of the type Item (or higher classes like File or
+Directory. You will be able to change that in later versions of
+kaa.vfs to your own classes). Directory object have a 'listdir()'
+again (other types will also have a list in the future). You can
+access the attributes from the database with the memeber function
+'getattr()'. A File/Directory also has attributes 'url', 'filename'
+and 'isdir'. To get a list of all possible attributes call 'keys()'.
+Using the attribute 'thumbnail' will return a kaa.thumb2 object for
+that item you can use to get/set/create thumbnails. The thumbnail
+object has (besides other things) a member variable 'image' returning
+the thumbnail filename with the highest resolution or None if no
+thumbnail exists. If no thumbnail exists, you get check the meber
+variable 'failed' to check if you already tried to create a thumbnail
+and failed. If this returns False, you can use the function 'create()'
+to create a thumbnail. The arguments are size (NORMAL or LARGE) and
+the flag 'wait'. If 'wait' is True the function will block using
+notifier.step until the thumbnail is created. If 'wait' is False
+(default), the function will return a Signal you can connect to to get
+notice when thumbnailing is done. NOTICE: you need to keep the
+thumbnail object, if you delete the object, a scheduled thumbnailing
+will be stopped.
+
+| thumbnail = item.getattr('thumbnail')
+| if thumbnail.image:
+|     print 'thumbnail is', thumbnail.image
+|     return
+| if thumbnail.failed:
+|     print 'unable to create thumbnail for', item.filename
+|     return
+| # create one (blocking)
+| thumbnail.create('large', True)
+
+
+
+More about kaa.vfs and kaa.thumb2 later


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to