## RhythmDBEntryType RhythmDBEntryType — Database entry type base class |

## Synopsis

    enum                RhythmDBEntryCategory;
    enum                RhythmDBEntryAvailability;
    char *              (*RhythmDBEntryTypeStringFunc)      (RhythmDBEntryType *entry_type,
                                                             RhythmDBEntry *entry);
    gboolean            (*RhythmDBEntryTypeBooleanFunc)     (RhythmDBEntryType *entry_type,
                                                             RhythmDBEntry *entry);
    void                (*RhythmDBEntryTypeSyncFunc)        (RhythmDBEntryType *entry_type,
                                                             RhythmDBEntry *entry,
                                                             GSList *changes,
                                                             GError **error);
    struct              RhythmDBEntryType;
    struct              RhythmDBEntryTypeClass;
    const char *        rhythmdb_entry_type_get_name        (RhythmDBEntryType *etype);
    char *              rhythmdb_entry_get_playback_uri     (RhythmDBEntry *entry);
    void                rhythmdb_entry_update_availability  (RhythmDBEntry *entry,
                                                             RhythmDBEntryAvailability avail);
    void                rhythmdb_entry_created              (RhythmDBEntry *entry);
    void                rhythmdb_entry_pre_destroy          (RhythmDBEntry *entry);
    gboolean            rhythmdb_entry_can_sync_metadata    (RhythmDBEntry *entry);
    void                rhythmdb_entry_sync_metadata        (RhythmDBEntry *entry,
                                                             GSList *changes,
                                                             GError **error);
    #define             RHYTHMDB_ENTRY_TYPE_SONG
    #define             RHYTHMDB_ENTRY_TYPE_IMPORT_ERROR
    #define             RHYTHMDB_ENTRY_TYPE_IGNORE
    RhythmDBEntryType * rhythmdb_get_song_entry_type        (void);
    RhythmDBEntryType * rhythmdb_get_error_entry_type       (void);
    RhythmDBEntryType * rhythmdb_get_ignore_entry_type      (void);

## Object Hierarchy

      GEnum
       +----RhythmDBEntryCategory

      GObject
       +----RhythmDBEntryType

## Properties

      "category"                 RhythmDBEntryCategory  : Read / Write / Construct Only
      "db"                       RhythmDB*             : Read / Write / Construct Only
      "name"                     gchar*                : Read / Write / Construct Only
      "save-to-disk"             gboolean              : Read / Write / Construct Only
      "type-data-size"           guint                 : Read / Write / Construct Only

## Description

This is the base class for database entry type classes, which provide some aspects of the behaviour of database entry types. There are different entry types for songs, radio streams, podcast feeds and episodes, and so on.

Plugins written in Python or Vala can create new entry types by subclassing and overriding any methods required. Plugins written in C can create a new instance of the RhythmDBEntryType base class and use its function pointer members rather than subclassing.

## Details

### enum RhythmDBEntryCategory

    typedef enum {
    	RHYTHMDB_ENTRY_NORMAL,
    	RHYTHMDB_ENTRY_STREAM,
    	RHYTHMDB_ENTRY_CONTAINER,
    	RHYTHMDB_ENTRY_VIRTUAL
    } RhythmDBEntryCategory;

Categories used to group entry types. These are used in a few places to control handling of entries.

`RHYTHMDB_ENTRY_NORMAL` | Normal files on disk
`RHYTHMDB_ENTRY_STREAM` | Endless streams (eg shoutcast)
`RHYTHMDB_ENTRY_CONTAINER` | Containers for other entries (eg podcast feeds)
`RHYTHMDB_ENTRY_VIRTUAL` | Things Rhythmbox shouldn't normally deal with

### enum RhythmDBEntryAvailability

    typedef enum {
    	RHYTHMDB_ENTRY_AVAIL_CHECKED,
    	RHYTHMDB_ENTRY_AVAIL_MOUNTED,
    	RHYTHMDB_ENTRY_AVAIL_UNMOUNTED,
    	RHYTHMDB_ENTRY_AVAIL_NOT_FOUND
    } RhythmDBEntryAvailability;

Various events that can result in changes to the entry's availability.

`RHYTHMDB_ENTRY_AVAIL_CHECKED` | File was checked and found present
`RHYTHMDB_ENTRY_AVAIL_MOUNTED` | Filesystem holding the file was mounted
`RHYTHMDB_ENTRY_AVAIL_UNMOUNTED` | Filesystem holding the file was unmounted
`RHYTHMDB_ENTRY_AVAIL_NOT_FOUND` | File was checked or played and could not be found

### RhythmDBEntryTypeStringFunc ()

    char *              (*RhythmDBEntryTypeStringFunc)      (RhythmDBEntryType *entry_type,
                                                             RhythmDBEntry *entry);

### RhythmDBEntryTypeBooleanFunc ()

    gboolean            (*RhythmDBEntryTypeBooleanFunc)     (RhythmDBEntryType *entry_type,
                                                             RhythmDBEntry *entry);

### RhythmDBEntryTypeSyncFunc ()

    void                (*RhythmDBEntryTypeSyncFunc)        (RhythmDBEntryType *entry_type,
                                                             RhythmDBEntry *entry,
                                                             GSList *changes,
                                                             GError **error);

### struct RhythmDBEntryType

    struct RhythmDBEntryType;

### struct RhythmDBEntryTypeClass

    struct RhythmDBEntryTypeClass {
    	GObjectClass parent_class;

    	/* methods */
    	void		(*entry_created) (RhythmDBEntryType *etype, RhythmDBEntry *entry);
    	void		(*destroy_entry) (RhythmDBEntryType *etype, RhythmDBEntry *entry);

    	char *		(*get_playback_uri) (RhythmDBEntryType *etype, RhythmDBEntry *entry);
    	void		(*update_availability) (RhythmDBEntryType *etype, RhythmDBEntry *entry, RhythmDBEntryAvailability avail);

    	gboolean (*can_sync_metadata) (RhythmDBEntryType *etype, RhythmDBEntry *entry);
    	void		(*sync_metadata) (RhythmDBEntryType *etype, RhythmDBEntry *entry, GSList *changes, GError **error);
    };

### rhythmdb_entry_type_get_name ()

    const char *        rhythmdb_entry_type_get_name        (RhythmDBEntryType *etype);

Returns the name of the entry type

`etype` : | a RhythmDBEntryType
Returns : | entry type name

### rhythmdb_entry_get_playback_uri ()

    char *              rhythmdb_entry_get_playback_uri     (RhythmDBEntry *entry);

Returns an allocated string containing the playback URI for `entry`, or NULL if the entry cannot be played.

`entry` : | a RhythmDBEntry
Returns : | playback URI or NULL

### rhythmdb_entry_update_availability ()

    void                rhythmdb_entry_update_availability  (RhythmDBEntry *entry,
                                                             RhythmDBEntryAvailability avail);

Updates `entry` to reflect its new availability.

`entry` : | a RhythmDBEntry
`avail` : | an availability event

### rhythmdb_entry_created ()

    void                rhythmdb_entry_created              (RhythmDBEntry *entry);

Calls the entry type's post-creation method for `entry`.

`entry` : | a newly created RhythmDBEntry

### rhythmdb_entry_pre_destroy ()

    void                rhythmdb_entry_pre_destroy          (RhythmDBEntry *entry);

Calls the entry type's pre-deletion method for `entry`.

`entry` : | a RhythmDBEntry

### rhythmdb_entry_can_sync_metadata ()

    gboolean            rhythmdb_entry_can_sync_metadata    (RhythmDBEntry *entry);

Calls the entry type's method to check if it can sync metadata for `entry`. Usually this is only true for entries backed by files, where tag-writing is enabled, and the appropriate tag-writing facilities are available.

`entry` : | a RhythmDBEntry
Returns : | `TRUE` if the entry can be synced

### rhythmdb_entry_sync_metadata ()

    void                rhythmdb_entry_sync_metadata        (RhythmDBEntry *entry,
                                                             GSList *changes,
                                                             GError **error);

Calls the entry type's method to sync metadata changes for `entry`.

`entry` : | a RhythmDBEntry
`changes` : | a list of RhythmDBEntryChange structures. [element-type RB.RhythmDBEntryChange]
`error` : | returns error information

### RHYTHMDB_ENTRY_TYPE_SONG

    #define RHYTHMDB_ENTRY_TYPE_SONG (rhythmdb_get_song_entry_type ())

### RHYTHMDB_ENTRY_TYPE_IMPORT_ERROR

    #define RHYTHMDB_ENTRY_TYPE_IMPORT_ERROR (rhythmdb_get_error_entry_type ())

### RHYTHMDB_ENTRY_TYPE_IGNORE

    #define RHYTHMDB_ENTRY_TYPE_IGNORE (rhythmdb_get_ignore_entry_type ())

### rhythmdb_get_song_entry_type ()

    RhythmDBEntryType * rhythmdb_get_song_entry_type        (void);

Returns the RhythmDBEntryType for normal songs.

Returns : | the entry type for normal songs. [transfer none]

### rhythmdb_get_error_entry_type ()

    RhythmDBEntryType * rhythmdb_get_error_entry_type       (void);

Returns the RhythmDBEntryType for import errors

Returns : | the entry type for import errors. [transfer none]

### rhythmdb_get_ignore_entry_type ()

    RhythmDBEntryType * rhythmdb_get_ignore_entry_type      (void);

Returns the RhythmDBEntryType for ignored files

Returns : | the entry type for ignored files. [transfer none]

## Property Details

### The `"category"` property

      "category"                 RhythmDBEntryCategory  : Read / Write / Construct Only

The RhythmDBEntryCategory that this entry type fits into.

Default value: RHYTHMDB_ENTRY_NORMAL

### The `"db"` property

      "db"                       RhythmDB*             : Read / Write / Construct Only

The RhythmDB instance.

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct Only

Entry type name. This must be unique.

Default value: NULL

### The `"save-to-disk"` property

      "save-to-disk"             gboolean              : Read / Write / Construct Only

If `TRUE`, entries of this type should be written to the on-disk database.

Default value: FALSE

### The `"type-data-size"` property

      "type-data-size"           guint                 : Read / Write / Construct Only

The size of the type-specific data structure to allocate for each entry of this type.

Default value: 0