-/*
- * Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>
- *
- * Licensed under the GPL v2. For licencing details see COPYING.
- */
+/* Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
#include <regex.h>
#include <osl.h>
/**
* Close the current playlist.
*
- * \sa playlist_open().
+ * \sa \ref playlist_open().
*/
void playlist_close(void)
{
}
/**
- * 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();
static int handle_audio_file_event(enum afs_events event, void *data)
{
- int ret, was_admissible = 0, is_admissible;
+ int ret;
+ bool was_admissible = false, is_admissible;
struct osl_object playlist_def;
char *new_path;
const struct osl_row *row = data;