Changeset 3616

Show
Ignore:
Timestamp:
11/10/08 21:47:51 (3 months ago)
Author:
dmeyer
Message:

Add Sphinx documentation support. It is not done yet but gives an
idea how the doc should look like. Calling 'python setup.py doc'
will trigger html generation. The html files will be located in
doc/.build/html (that has to change in the future to something more
userfriendly).

Location:
trunk/beacon
Files:
10 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/beacon/setup.py

    r3612 r3616  
    8282       version     = '0.1.0', 
    8383       license     = 'LGPL', 
    84        epydoc      = [ 'doc/epydoc' ], 
    8584       summary     = "Media-oriented virtual filesystem", 
    8685       scripts     = [ 'bin/kaa-thumb', 'bin/beacon-daemon', 'bin/beacon-search', 
  • trunk/beacon/src/__init__.py

    r3614 r3616  
    121121    Lauch a beacon server and connect to it. 
    122122 
    123     @param autoshutdown: if the server should shut down when no client is 
    124         connected anymore 
    125     @param verbose: verbose level for the server log 
     123    :param autoshutdown: shutdown server when no client is connected anymore 
     124    :param verbose: verbose level for the server log 
    126125    """ 
    127126    beacon = os.path.dirname(__file__), '../../../../../bin/beacon-daemon' 
     
    142141    """ 
    143142    Query the database. This function will raise an exception if the 
    144     client is not connected and the server is not running for a connect. 
    145  
    146     @returns: InProgress 
    147     @rtype: L{Query} 
     143    client is not connected and the server is not running for a 
     144    connect.  The function returns an InProgress object with a Query 
     145    object as result. 
    148146    """ 
    149147    if not _client: 
     
    153151def get(filename): 
    154152    """ 
    155     Get object for the given filename. This function will raise an exception if 
    156     the client is not connected and the server is not running for a connect. 
    157  
    158     @returns: InProgress 
    159     @rtype: L{File} 
     153    Get object for the given filename. This function will raise an 
     154    exception if the client is not connected and the server is not 
     155    running for a connect. The function returns an InProgress object 
     156    with a File object as result. 
    160157    """ 
    161158    if not _client: 
     
    236233    object type) or by altering the object's tables to add new columns 
    237234    or indexes. 
    238  
    239     Previously registered attributes may be updated in limited ways 
    240     (e.g.  by adding an index to the attribute).  If the attributes 
    241     and indexes specified have not changed from previous invocations, 
    242     no changes will be made to the database. Therefore an application 
    243     should always call this function on startup if it needs attributes 
    244     not defined by beacon already. 
    245  
    246     @param type_name: is the name of the type the attributes and 
    247         indexes apply to (e.g. 'dir' or 'image'). 
    248     @param indexes: a list of tuples, where each tuple contains 2 or 
    249         more strings, where each string references a registered 
    250         attribute.  This is used for creating a multi-column index on 
    251         these attributes, which is useful for speeding up queries 
    252         involving these attributes. 
    253     @param attrs: where each keyword value is a tuple of 2 to 4 items 
    254         in length and in the form (name, flags, ivtidx, split): 
    255          - name: The name of the attribute; cannot conflict with any of the 
    256              values in RESERVED_ATTRIBUTES. 
    257          - flags: A bitmask of ATTR_* flags. 
    258          - ivtidx: Name of the previously registered inverted index used for 
    259              this attribute, only if flags contains ATTR_INVERTED_INDEX. 
    260          - split: Function or regular expression used to split string-based 
    261              values for this attributes into separate terms for indexing. 
    262     @note: currently indexes and attributes can only be added, not 
    263         removed. That is, once an attribute or indexes is added, it 
    264         lives forever. 
    265235    """ 
    266236    if not _client: 
     
    272242    Register new attrs and types for tracks. See L{register_file_type_attrs} 
    273243    for details. The only difference between this two functions is that this 
    274     adds C{track_} to the type name. 
     244    adds track\_ to the type name. 
    275245    """ 
    276246    if not _client: 
  • trunk/beacon/src/file.py

    r3614 r3616  
    4747class File(Item): 
    4848    """ 
    49     A File-based Database Item. 
    50  
    51     see L{Item} for a list of available attributes. 
    52  
    53     @ivar url:         unique url of the item 
    54     @ivar filename:    complete filename 
    55     @ivar isdir:       True if it is a directory 
    56     @ivar isfile:      True if it is a regular file 
    57     @ivar scanned:     True if the item is scanned 
    58  
    59     @note: do not access attributes starting with _beacon outside kaa.beacon 
     49    A file-based database item 
    6050    """ 
    6151 
  • trunk/beacon/src/item.py

    r3614 r3616  
    4545class Item(object): 
    4646    """ 
    47     A Database Item 
    48     =============== 
    49  
    50     The following attributes are available. If more are needed please call 
    51     L{register_file_type_attrs} or L{register_track_type_attrs}. 
    52  
    53     Directories (type = C{dir}) 
    54      - C{name} (str, searchable, inverted_index: 'keywords') 
    55      - C{overlay} (bool, simple) 
    56      - C{media} (int, searchable, indexed) 
    57      - C{image} (int, simple) 
    58      - C{mtime} (int, simple) 
    59      - C{title} (unicode, simple) 
    60      - C{artist} (unicode, simple) 
    61      - C{album} (unicode, simple) 
    62      - C{length} (float, simple), length in seconds of all items in that directory 
    63  
    64     Items and Files (type = C{file} and all media types) 
    65      - C{name} (str, searchable, inverted_index: 'keywords') 
    66      - C{overlay} (bool, simple) 
    67      - C{media} (int, searchable, indexed) 
    68      - C{image} (int, simple) 
    69      - C{mtime} (int, simple) 
    70  
    71     Video Items (type = C{video}) 
    72      - C{title} (unicode, searchable, ignore_case, inverted_index: 'keywords'), 
    73      - C{width} (int, simple) 
    74      - C{height} (int, simple) 
    75      - C{length} (float, simple) 
    76      - C{scheme} (str, simple) 
    77      - C{description} (unicode, simple) 
    78      - C{timestamp} (int, searchable) 
    79  
    80     Audio Items (type = C{audio}) 
    81      - C{title} (unicode, searchable, ignore_case, inverted_index: 'keywords') 
    82      - C{artist} (unicode, searchable, indexed, ignore_case, inverted_index: 'keywords') 
    83      - C{album} (unicode, searchable, ignore_case, inverted_index: 'keywords') 
    84      - C{genre} (unicode, searchable, indexed, ignore_case) 
    85      - C{samplerate} (int, simple) 
    86      - C{length} (float, simple) 
    87      - C{bitrate} (int, simple) 
    88      - C{trackno} (int, simple) 
    89      - C{userdate} (unicode, simple) 
    90      - C{description} (unicode, simple) 
    91      - C{timestamp} (int, searchable) 
    92  
    93     Image Items (type = C{image}) 
    94      - C{width} (int, searchable) 
    95      - C{height} (int, searchable) 
    96      - C{comment} (unicode, searchable, ignore_case, inverted_index: 'keywords') 
    97      - C{rotation} (int, simple) 
    98      - C{author} (unicode, simple) 
    99      - C{timestamp} (int, searchable) 
    100  
    101     DVD Track Items (type = C{dvd}) 
    102      - C{length} (float, simple) 
    103      - C{audio} (list, simple) 
    104      - C{chapters} (int, simple) 
    105      - C{subtitles} (list, simple) 
    106  
    107     VCD Track Items (type = C{vcd}) 
    108      - C{audio} (list, simple) 
    109  
    110     Audio CD Track Items (type = C{cdda}) 
    111      - C{title} (unicode, searchable, inverted_index: 'keywords') 
    112      - C{artist} (unicode, searchable, indexed, inverted_index: 'keywords') 
    113  
    114     @ivar url:         unique url of the item 
    115     @ivar filename:    complete filename or file items 
    116     @ivar isdir:       True if it is a directory 
    117     @ivar isfile:      True if it is a regular file 
    118     @ivar scanned:     True if the item is scanned 
    119     @ivar thumbnail:   Thumbnail for the Item 
    120     @type thumbnail:   L{Thumbnail} 
    121     @note: do not access attributes starting with _beacon outside kaa.beacon 
    122     """ 
    123  
    124     def __init__(self, _beacon_id, url, data, parent, media): 
     47    A generic database item 
     48    """ 
     49 
     50    def __init__(self, beacon_id, url, data, parent, media): 
    12551        # url of the item 
    12652        self.url = url 
    12753        self.filename = '' 
    12854        # internal data 
    129         self._beacon_id = _beacon_id 
     55        self._beacon_id = beacon_id 
    13056        # FIXME: ugly, maybe use the ObjectRow stuff from kaa.db 
    13157        # with extra write support. Or copy on write. 
     
    14268        Access attributes of the item. 
    14369 
    144         Besides the keys in the database an item has the following attributes 
    145         accessable with this function: 
    146  
    147          - parent: parent L{Item} or L{Item} 
    148          - media: L{Media} object the item is on 
    149          - thumbnail: L{Thumbnail} object for the item or parent 
    150          - image: image path for the item or parent 
    151          - read_only: True if the item is on a read only media 
    152  
    153         @returns: the value of a given attribute. If the attribute is not in the db, 
    154             return None. 
    155         @note: If the key starts with C{'tmp:'}, the data will be fetched from the 
    156             temp directory and not from the db. 
    157             attribute. 
     70        :param key: Attribute name 
     71        :param default: Default return when the attribute is not set 
    15872        """ 
    15973        if key.startswith('tmp:'): 
     
    198112 
    199113    def __getitem__(self, key): 
     114        """ 
     115        Access attributes of the item 
     116        """ 
    200117        return self.get(key) 
    201118 
     
    203120        """ 
    204121        Set the value of a given attribute. If the key starts with 
    205         C{'tmp:'}, the data will only be valid in this item and not 
     122        'tmp:', the data will only be valid in this item and not 
    206123        stored in the db. Loosing the item object will remove that 
    207124        attribute. 
     
    218135        """ 
    219136        List item attributes 
    220  
    221         @returns: all attributes of the item. 
    222137        """ 
    223138        return self._beacon_data.keys() + self._beacon_tmpdata.keys() 
     
    226141        """ 
    227142        Check if the item has a specific attributes set 
    228  
    229         @returns: True if the key is stored in the item. 
    230143        """ 
    231144        return key in self._beacon_data.keys() or \ 
     
    264177        Return all subitems to his item. 
    265178 
    266         @returns: InProgress object with list or kaa.beacon.Query 
     179        :returns: InProgress object with empty list or :class:`beacon.Query` 
    267180        """ 
    268181        # This function is not used internally 
  • trunk/beacon/src/query.py

    r3614 r3616  
    7171    """ 
    7272    Query object for the client. Created by Client.query() 
    73  
    74     This object feels like a list, you can iterate over the results, 
    75     access items based on position and get the length of the 
    76     results. 
    77  
    78     @group Internal API: __init__, __del__, __repr__, __inprogress__ 
    79     @note: A Query is created by Client.query(), do not create Query objects 
    80         from outside beacon. 
    8173    """ 
    8274    NEXT_ID = 1 
     
    187179        Get the result. 
    188180 
    189         @param filter: filter function set by L{register_filter} to use on the 
     181        :param filter: filter function set by L{register_filter} to use on the 
    190182            result. If a filter is used the result type may be different. 
    191         @returns: (filtered) query result 
    192         @rtype: list of L{Item} or L{File} 
     183        :returns: (filtered) list of Items 
    193184        """ 
    194185        if filter == None: 
  • trunk/beacon/src/thumbnail.py

    r3614 r3616  
    7979    """ 
    8080    Thumbnail handling. This objects is a wrapper for full size image path names. 
    81  
    82     @note: A Thumbnail object is created by an L{Item}, do not create Thumbnail objects 
    83         from outside beacon. 
    8481    """ 
    8582    # priority for creating