Dmap.Db¶
- Implementations:
 None
Methods¶
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Dmap.Db¶
 - Bases:
 - Structure:
 
- add(record)¶
 - Parameters:
 record (
Dmap.Record) – A database record.- Raises:
 - Returns:
 The ID for the newly added record or
Dmap.DbId.BADon failure. A reference to the record will be retained by the database (if required; an adapter-type implementation might not want to retain a reference as the record data may be placed elsewhere). In all cases, a returned record should be unrefed by the calling code.- Return type:
 
Add a record to the database.
- add_path(path)¶
 - Parameters:
 path (
str) – A path to an appropriate media file.- Raises:
 - Returns:
 The ID for the newly added record or
Dmap.DbId.BADon failure.See also the notes for
Dmap.Db.addregarding reference counting.- Return type:
 
Create a record and add it to the database.
- add_with_id(record, id)¶
 - Parameters:
 record (
Dmap.Record) – A database record.id (
int) – A database record ID.
- Raises:
 - Returns:
 The ID for the newly added record or
Dmap.DbId.BADon failure.See also the notes for
Dmap.Db.addregarding reference counting.- Return type:
 
Add a record to the database and assign it the given ID. id cannot be
Dmap.DbId.BAD.
- apply_filter(filter_def)¶
 - Parameters:
 filter_def ([
Dmap.DbFilterDefinition]) – A series of filter definitions.- Returns:
 the records which satisfy a record in filter_def.
- Return type:
 {
int:Dmap.Record}
- foreach(func, *data)¶
 - Parameters:
 func (
Dmap.IdRecordFunc) – The function to apply to each record in the database.
Apply a function to each record in a media database.
- lookup_by_id(id)¶
 - Parameters:
 id (
int) – A record ID.- Returns:
 the database record corresponding to id. id cannot be
Dmap.DbId.BAD. The returned record should be unrefed by the calling code when no longer required.If you are implementing a full database using this API, then you probably want to increment the reference count before returning a record pointer.
On the other hand, if you are implementing an adapter class and the records are stored elsewhere, then you will probably return a transient record. That is, once the user is done using it, the returned record should be free’d because it is a adapter copy of the real record. In this case, the reference count should not be incremented before returning a record pointer.
- Return type:
 
- lookup_id_by_location(location)¶
 - Parameters:
 location (
str) – A record location.- Returns:
 the database id for the record corresponding to path or
Dmap.DbId.BADif such a record does not exist.- Return type:
 
- do_add(record) virtual¶
 - Parameters:
 record (
Dmap.Record) – A database record.- Returns:
 The ID for the newly added record or
Dmap.DbId.BADon failure. A reference to the record will be retained by the database (if required; an adapter-type implementation might not want to retain a reference as the record data may be placed elsewhere). In all cases, a returned record should be unrefed by the calling code.- Return type:
 
Add a record to the database.
- do_add_path(path) virtual¶
 - Parameters:
 path (
str) – A path to an appropriate media file.- Returns:
 The ID for the newly added record or
Dmap.DbId.BADon failure.See also the notes for
Dmap.Db.addregarding reference counting.- Return type:
 
Create a record and add it to the database.
- do_add_with_id(record, id) virtual¶
 - Parameters:
 record (
Dmap.Record) – A database record.id (
int) – A database record ID.
- Returns:
 The ID for the newly added record or
Dmap.DbId.BADon failure.See also the notes for
Dmap.Db.addregarding reference counting.- Return type:
 
Add a record to the database and assign it the given ID. id cannot be
Dmap.DbId.BAD.
- do_foreach(func, data) virtual¶
 - Parameters:
 func (
Dmap.IdRecordFunc) – The function to apply to each record in the database.
Apply a function to each record in a media database.
- do_lookup_by_id(id) virtual¶
 - Parameters:
 id (
int) – A record ID.- Returns:
 the database record corresponding to id. id cannot be
Dmap.DbId.BAD. The returned record should be unrefed by the calling code when no longer required.If you are implementing a full database using this API, then you probably want to increment the reference count before returning a record pointer.
On the other hand, if you are implementing an adapter class and the records are stored elsewhere, then you will probably return a transient record. That is, once the user is done using it, the returned record should be free’d because it is a adapter copy of the real record. In this case, the reference count should not be incremented before returning a record pointer.
- Return type:
 
- do_lookup_id_by_location(location) virtual¶
 - Parameters:
 location (
str) – A record location.- Returns:
 the database id for the record corresponding to path or
Dmap.DbId.BADif such a record does not exist.- Return type: