Exemple #1
0
/**
 * Remove a custom field in the medialib associated with an entry.
 * Identical to #xmmsc_medialib_entry_property_remove except with specifying
 * your own source.
 */
xmmsc_result_t *
xmmsc_medialib_entry_property_remove_with_source (xmmsc_connection_t *c,
                                                  int id,
                                                  const char *source,
                                                  const char *key)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_MEDIALIB,
	                       XMMS_IPC_CMD_PROPERTY_REMOVE,
	                       XMMSV_LIST_ENTRY_INT (id),
	                       XMMSV_LIST_ENTRY_STR (source),
	                       XMMSV_LIST_ENTRY_STR (key),
	                       XMMSV_LIST_END);
}
/**
 * Remove a file with associated with the hash from the server
 */
xmmsc_result_t *
xmmsc_bindata_remove (xmmsc_connection_t *c, const char *hash)
{
	x_check_conn (c, NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_BINDATA, XMMS_IPC_CMD_REMOVE_DATA,
	                       XMMSV_LIST_ENTRY_STR (hash), XMMSV_LIST_END);
}
Exemple #3
0
static xmmsc_result_t *
xmmsc_send_hello (xmmsc_connection_t *c)
{
	const int protocol_version = XMMS_IPC_PROTOCOL_VERSION;

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_MAIN, XMMS_IPC_CMD_HELLO,
	                       XMMSV_LIST_ENTRY_INT (protocol_version),
	                       XMMSV_LIST_ENTRY_STR (c->clientname),
	                       XMMSV_LIST_END);
}
Exemple #4
0
/**
 * Change the url property of an entry in the media library.  Note
 * that you need to handle the actual file move yourself.
 *
 * @param conn The #xmmsc_connection_t
 * @param entry The entry id you want to move
 * @param url The url to move it to
 */
xmmsc_result_t *
xmmsc_medialib_move_entry (xmmsc_connection_t *conn, int entry, const char *url)
{
	x_check_conn (conn, NULL);

	return xmmsc_send_cmd (conn, XMMS_IPC_OBJECT_MEDIALIB,
	                       XMMS_IPC_CMD_MOVE_URL,
	                       XMMSV_LIST_ENTRY_INT (entry),
	                       XMMSV_LIST_ENTRY_STR (url),
	                       XMMSV_LIST_END);
}
Exemple #5
0
/**
 * Browse available media in a (already encoded) path.
 *
 * Retrieves a list of paths available (directly) under the specified
 * path.
 *
 */
xmmsc_result_t *
xmmsc_xform_media_browse_encoded (xmmsc_connection_t *c, const char *url)
{
	x_check_conn (c, NULL);
	x_api_error_if (!url, "with a NULL url", NULL);

	if (!_xmmsc_medialib_verify_url (url))
		x_api_error ("with a non encoded url", NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_XFORM, XMMS_IPC_CMD_BROWSE,
	                       XMMSV_LIST_ENTRY_STR (url), XMMSV_LIST_END);
}
Exemple #6
0
xmmsc_result_t *
xmmsc_playback_volume_set (xmmsc_connection_t *c,
                           const char *channel, int volume)
{
	x_check_conn (c, NULL);
	x_api_error_if (!channel, "with a NULL channel", NULL);

	return xmmsc_send_cmd (c, XMMS_IPC_OBJECT_PLAYBACK,
	                       XMMS_IPC_CMD_VOLUME_SET,
	                       XMMSV_LIST_ENTRY_STR (channel),
	                       XMMSV_LIST_ENTRY_INT (volume),
	                       XMMSV_LIST_END);
}
Exemple #7
0
xmmsc_result_t *
setup_shm_prepare (xmmsc_connection_t *c, int32_t vv)
{
	xmmsc_result_t *res;
	xmmsc_vischunk_t *buffer;
	xmmsc_vis_unixshm_t *t;
	xmmsc_visualization_t *v;
	char shmidstr[32];

	x_check_conn (c, 0);
	v = get_dataset (c, vv);

	t = &v->transport.shm;

	/* prepare unixshm + semaphores */
	/* following access modifiers imply everyone on the system could inject wrong vis data ;) */
	t->shmid = shmget (IPC_PRIVATE, sizeof (xmmsc_vischunk_t) * XMMS_VISPACKET_SHMCOUNT, S_IRWXU + S_IRWXG + S_IRWXO);
	if (t->shmid == -1) {
		c->error = strdup ("Couldn't create the shared memory!");
		return false;
	}
	/* attach early, so that the server doesn't think we aren't there */
	buffer = shmat(t->shmid, NULL, SHM_RDONLY);
	t->buffer = buffer;

	/* we send it as string to make it work on 64bit systems.
	   Ugly? Yes, but works. */
	snprintf (shmidstr, sizeof (shmidstr), "%d", t->shmid);

	/* send packet */
	res = xmmsc_send_cmd (c, XMMS_IPC_OBJECT_VISUALIZATION,
	                      XMMS_IPC_COMMAND_VISUALIZATION_INIT_SHM,
	                      XMMSV_LIST_ENTRY_INT (v->id),
	                      XMMSV_LIST_ENTRY_STR (shmidstr),
	                      XMMSV_LIST_END);

	if (res) {
		xmmsc_result_visc_set (res, v);
	}

	return res;
}
Exemple #8
0
/**
 * Returns a random entry from a collection
 *
 * @param coll The collection to find a random entry in
 * @return A random entry from the collection, 0 if the collection is empty
 */
xmms_medialib_entry_t
xmms_medialib_query_random_id (xmms_medialib_session_t *session,
                               xmmsv_t *coll)
{
	xmms_medialib_entry_t ret;
	xmmsv_t *spec, *res;
	xmms_error_t err;

	spec = xmmsv_build_list (XMMSV_LIST_ENTRY_STR ("id"),
	                         XMMSV_LIST_END);

	spec = xmmsv_build_dict (XMMSV_DICT_ENTRY_STR ("type", "metadata"),
	                         XMMSV_DICT_ENTRY_STR ("aggregate", "random"),
	                         XMMSV_DICT_ENTRY ("get", spec),
	                         XMMSV_DICT_END);

	res = xmms_medialib_query (session, coll, spec, &err);
	xmmsv_get_int (res, &ret);

	xmmsv_unref (spec);
	xmmsv_unref (res);

	return ret;
}
Exemple #9
0
static xmmsc_result_t *
do_methodcall (xmmsc_connection_t *conn, unsigned int id, const char *arg)
{
	return xmmsc_send_cmd (conn, XMMS_IPC_OBJECT_MEDIALIB, id,
	                       XMMSV_LIST_ENTRY_STR (arg), XMMSV_LIST_END);
}