## rb-playlist-manager

rb-playlist-manager

## Synopsis

    enum                RBPlaylistManagerError;
    #define             RB_PLAYLIST_MANAGER_ERROR
    GQuark              rb_playlist_manager_error_quark     (void);
    typedef             RBPlaylistManagerPrivate;
    RBPlaylistManager*  rb_playlist_manager_new             (RBShell *shell,
                                                             RBSourceList *sourcelist,
                                                             const char *playlists_file);
    gboolean            rb_playlist_manager_parse_file      (RBPlaylistManager *mgr,
                                                             const char *uri,
                                                             GError **error);
    void                rb_playlist_manager_load_playlists  (RBPlaylistManager *mgr);
    gboolean            rb_playlist_manager_save_playlists  (RBPlaylistManager *mgr,
                                                             gboolean force);
    RBSource*           rb_playlist_manager_new_playlist    (RBPlaylistManager *mgr,
                                                             const char *suggested_name,
                                                             gboolean automatic);
    GList*              rb_playlist_manager_get_playlists   (RBPlaylistManager *manager);

## Description

## Details

### enum RBPlaylistManagerError

    typedef enum
    {
    	RB_PLAYLIST_MANAGER_ERROR_PARSE,
    	RB_PLAYLIST_MANAGER_ERROR_PLAYLIST_EXISTS,
    	RB_PLAYLIST_MANAGER_ERROR_PLAYLIST_NOT_FOUND
    } RBPlaylistManagerError;

### RB_PLAYLIST_MANAGER_ERROR

    #define             RB_PLAYLIST_MANAGER_ERROR

### rb_playlist_manager_error_quark ()

    GQuark              rb_playlist_manager_error_quark     (void);

Returns : |

### RBPlaylistManagerPrivate

### rb_playlist_manager_new ()

    RBPlaylistManager*  rb_playlist_manager_new             (RBShell *shell,
                                                             RBSourceList *sourcelist,
                                                             const char *playlists_file);

`shell` : |
`sourcelist` : |
`playlists_file` : |
Returns : |

### rb_playlist_manager_parse_file ()

    gboolean            rb_playlist_manager_parse_file      (RBPlaylistManager *mgr,
                                                             const char *uri,
                                                             GError **error);

Parses a playlist file, adding entries to the database and to a new static playlist. If the playlist file includes a title, the static playlist created will have the same title.

`mgr` : | the RBPlaylistManager
`uri` : | URI of the playlist to load
`error` : | returns a GError in case of error
Returns : | TRUE on success

### rb_playlist_manager_load_playlists ()

    void                rb_playlist_manager_load_playlists  (RBPlaylistManager *mgr);

Loads the user's playlists, or if the playlist file does not exists, reads the default playlist file. Should be called only once on startup.

`mgr` : | the RBPlaylistManager

### rb_playlist_manager_save_playlists ()

    gboolean            rb_playlist_manager_save_playlists  (RBPlaylistManager *mgr,
                                                             gboolean force);

Saves the user's playlists. If the force flag is TRUE, the playlists will always be saved. Otherwise, the playlists will only be saved if a playlist has been created, modified, or deleted since the last time the playlists were saved, and no save operation is currently taking place.

`mgr` : | the RBPlaylistManager
`force` : | if TRUE, save playlists synchronously and unconditionally
Returns : | TRUE if a playlist save operation has been started

### rb_playlist_manager_new_playlist ()

    RBSource*           rb_playlist_manager_new_playlist    (RBPlaylistManager *mgr,
                                                             const char *suggested_name,
                                                             gboolean automatic);

Creates a new playlist and adds it to the source list.

`mgr` : | the RBPlaylistManager
`suggested_name` : | optional name to use for the new playlist
`automatic` : | if TRUE, create an auto playlist
Returns : | the new playlist object.

### rb_playlist_manager_get_playlists ()

    GList*              rb_playlist_manager_get_playlists   (RBPlaylistManager *manager);

`manager` : |
Returns : | a GList containing all local playlist source objects.