示例#1
0
文件: playlist.c 项目: dsheeler/xmms2
static void
xmms_playlist_client_insert_collection (xmms_playlist_t *playlist, const gchar *plname,
                                        gint32 pos, xmmsv_coll_t *coll,
                                        xmmsv_t *order, xmms_error_t *err)
{
	xmmsv_list_iter_t *it;
	xmmsv_t *list;

	list = xmms_collection_query_ids (playlist->colldag, coll, 0, 0, order, err);
	if (xmms_error_iserror (err)) {
		return;
	}

	xmmsv_get_list_iter (list, &it);

	xmmsv_list_iter_last (it);

	while (xmmsv_list_iter_valid (it)) {
		xmms_medialib_entry_t mid;
		xmmsv_t *entry;

		xmmsv_list_iter_entry (it, &entry);
		xmmsv_get_int (entry, &mid);

		xmms_playlist_insert_entry (playlist, plname, pos, mid, err);

		xmmsv_list_iter_prev (it);
	}

	xmmsv_unref (list);
}
示例#2
0
文件: playlist.c 项目: dsheeler/xmms2
/**
  * Convenient function for inserting a directory at a given position
  * in the playlist, It will dive down the URL you feed it and
  * recursivly insert all files.
  *
  * @param playlist the playlist to add it URL to.
  * @param plname the name of the playlist to modify.
  * @param pos a position in the playlist.
  * @param nurl the URL of an directory you want to add
  * @param err an #xmms_error_t that should be defined upon error.
  */
static void
xmms_playlist_client_rinsert (xmms_playlist_t *playlist, const gchar *plname, gint32 pos,
                              const gchar *path, xmms_error_t *err)
{
	xmmsv_coll_t *idlist;
	xmmsv_list_iter_t *it;
	xmmsv_t *list;

	idlist = xmms_medialib_add_recursive (playlist->medialib, path, err);
	list = xmmsv_coll_idlist_get (idlist);

	xmmsv_get_list_iter (list, &it);
	xmmsv_list_iter_last (it);
	while (xmmsv_list_iter_valid (it)) {
		xmms_medialib_entry_t entry;
		xmmsv_t *value;

		xmmsv_list_iter_entry (it, &value);
		xmmsv_get_int (value, &entry);

		xmms_playlist_insert_entry (playlist, plname, pos, entry, err);

		xmmsv_list_iter_prev (it);
	}

	xmmsv_coll_unref (idlist);
}
示例#3
0
文件: playlist.c 项目: dsheeler/xmms2
/**
 * Insert an xmms_medialib_entry to the playlist at given position.
 *
 * @param playlist the playlist to add the entry to.
 * @param pos the position where the entry is inserted.
 * @param file the #xmms_medialib_entry to add.
 * @param error Upon error this will be set.
 * @returns TRUE on success and FALSE otherwise.
 */
static void
xmms_playlist_client_insert_id (xmms_playlist_t *playlist, const gchar *plname,
                                gint32 pos, xmms_medialib_entry_t file,
                                xmms_error_t *err)
{
	xmms_playlist_insert_entry (playlist, plname, pos, file, err);
}
示例#4
0
文件: playlist.c 项目: chrippa/xmms2
/**
 * Insert an entry into the playlist at given position.
 * Creates a #xmms_medialib_entry for you and insert it
 * in the list.
 *
 * @param playlist the playlist to add it URL to.
 * @param pos the position where the entry is inserted.
 * @param url the URL to add.
 * @param err an #xmms_error_t that should be defined upon error.
 * @return TRUE on success and FALSE otherwise.
 *
 */
static void
xmms_playlist_client_insert_url (xmms_playlist_t *playlist, const gchar *plname,
                                 gint32 pos, const gchar *url, xmms_error_t *err)
{
    xmms_medialib_session_t *session;
    xmms_medialib_entry_t entry = 0;

    do {
        session = xmms_medialib_session_begin (playlist->medialib);
        entry = xmms_medialib_entry_new_encoded (session, url, err);
    } while (!xmms_medialib_session_commit (session));

    if (entry)
        xmms_playlist_insert_entry (playlist, plname, pos, entry, err);
}