}
} else {
if (!strncmp(arg, "p/", 2)) {
- ret = playlist_open(arg + 2);
- if (ret < 0 && errmsg)
- *errmsg = make_message( "could not open %s",
- arg);
+ ret = playlist_open(arg + 2, errmsg);
mode = PLAY_MODE_PLAYLIST;
} else if (!strncmp(arg, "m/", 2)) {
ret = change_current_mood(arg + 2, errmsg);
void free_status_items(void);
/* playlist */
-int playlist_open(const char *name);
+int playlist_open(const char *name, char **errmsg);
void playlist_close(void);
int playlist_check_callback(struct afs_callback_arg *aca);
}
/**
- * Open the given playlist.
+ * Open and load the given playlist.
*
* \param name The name of the playlist to open.
+ * \param errmsg To be sent to the client (if called via select command).
*
* Files which are listed in the playlist, but not contained in the database
* are ignored. This is not considered an error.
*
- * \return Standard.
+ * \return The length of the loaded playlist on success, negative error code
+ * else.
*/
-int playlist_open(const char *name)
+int playlist_open(const char *name, char **errmsg)
{
struct osl_object obj;
int ret;
obj.size = strlen(obj.data);
ret = osl(osl_get_row(playlists_table, BLOBCOL_NAME, &obj, &row));
if (ret < 0) {
- PARA_NOTICE_LOG("failed to load playlist %s\n", name);
+ if (errmsg)
+ *errmsg = make_message("could not open playlist %s",
+ name);
return ret;
}
playlist_close();