/** * Add a URL to the medialib. If you want to add mutiple files * you should call #xmmsc_medialib_import_path * * same as #xmmsc_medialib_add_entry but expects a encoded URL * instead * * @param conn The #xmmsc_connection_t * @param url URL to add to the medialib. */ xmmsc_result_t * xmmsc_medialib_add_entry_encoded (xmmsc_connection_t *conn, const char *url) { x_check_conn (conn, NULL); if (!_xmmsc_medialib_verify_url (url)) x_api_error ("with a non encoded url", NULL); return do_methodcall (conn, XMMS_IPC_CMD_MLIB_ADD_URL, url); }
/** * Import a all files recursivly from the directory passed as argument * which must already be url encoded. You probably want to use * #xmmsc_medialib_import_path unless you want to add a string that * comes as a result from the daemon, such as from * #xmmsc_xform_media_browse * * @param conn #xmmsc_connection_t * @param path A directory to recursive search for mediafiles, this must * include the protocol, i.e file:// */ xmmsc_result_t * xmmsc_medialib_import_path_encoded (xmmsc_connection_t *conn, const char *path) { x_check_conn (conn, NULL); if (!_xmmsc_medialib_verify_url (path)) x_api_error ("with a non encoded url", NULL); return do_methodcall (conn, XMMS_IPC_CMD_PATH_IMPORT, path); }
/** * 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); }
/** * Insert entry at given position in playlist. * Same as #xmmsc_playlist_insert_url but takes an encoded * url instead. * * @param c The connection structure. * @param playlist The playlist in which to insert the media. * @param pos A position in the playlist * @param url The URL to insert * */ xmmsc_result_t * xmmsc_playlist_insert_encoded (xmmsc_connection_t *c, const char *playlist, int pos, const char *url) { xmms_ipc_msg_t *msg; if (!_xmmsc_medialib_verify_url (url)) x_api_error ("with a non encoded url", NULL); /* default to the active playlist */ if (playlist == NULL) { playlist = XMMS_ACTIVE_PLAYLIST; } msg = xmms_ipc_msg_new (XMMS_IPC_OBJECT_PLAYLIST, XMMS_IPC_CMD_INSERT_URL); xmms_ipc_msg_put_string (msg, playlist); xmms_ipc_msg_put_int32 (msg, pos); xmms_ipc_msg_put_string (msg, url); return xmmsc_send_msg (c, msg); }
/** * Adds a directory recursivly to the playlist. * * The url should be absolute to the server-side and url encoded. Note * that you will have to include the protocol for the url to. ie: * file://mp3/my_mp3s/first.mp3. You probably want to use * #xmmsc_playlist_radd unless you want to add a string that comes as * a result from the daemon, such as from #xmmsc_xform_media_browse * * @param c The connection structure. * @param playlist The playlist in which to add the media. * @param url Encoded path. * */ xmmsc_result_t * xmmsc_playlist_radd_encoded (xmmsc_connection_t *c, const char *playlist, const char *url) { xmms_ipc_msg_t *msg; 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); /* default to the active playlist */ if (playlist == NULL) { playlist = XMMS_ACTIVE_PLAYLIST; } msg = xmms_ipc_msg_new (XMMS_IPC_OBJECT_PLAYLIST, XMMS_IPC_CMD_RADD); xmms_ipc_msg_put_string (msg, playlist); xmms_ipc_msg_put_string (msg, url); return xmmsc_send_msg (c, msg); }
static bool _internal_put_on_bb_collection (xmmsv_t *bb, xmmsv_coll_t *coll) { xmmsv_list_iter_t *it; xmmsv_t *v, *attrs; int n; uint32_t ret; int32_t entry; xmmsv_coll_t *op; if (!bb || !coll) { return false; } /* push type */ if (!xmmsv_bitbuffer_put_bits (bb, 32, xmmsv_coll_get_type (coll))) return false; /* attribute counter and values */ attrs = xmmsv_coll_attributes_get (coll); n = 0; xmmsv_dict_foreach (attrs, _internal_put_on_bb_count_coll_attr, &n); if (!xmmsv_bitbuffer_put_bits (bb, 32, n)) return false; /* needs error checking! */ xmmsv_dict_foreach (attrs, _internal_put_on_bb_append_coll_attr, bb); attrs = NULL; /* no unref needed. */ /* idlist counter and content */ xmmsv_bitbuffer_put_bits (bb, 32, xmmsv_coll_idlist_get_size (coll)); xmmsv_get_list_iter (xmmsv_coll_idlist_get (coll), &it); for (xmmsv_list_iter_first (it); xmmsv_list_iter_valid (it); xmmsv_list_iter_next (it)) { if (!xmmsv_list_iter_entry_int (it, &entry)) { x_api_error ("Non integer in idlist", 0); } xmmsv_bitbuffer_put_bits (bb, 32, entry); } xmmsv_list_iter_explicit_destroy (it); /* operands counter and objects */ n = 0; if (xmmsv_coll_get_type (coll) != XMMS_COLLECTION_TYPE_REFERENCE) { n = xmmsv_list_get_size (xmmsv_coll_operands_get (coll)); } ret = xmmsv_bitbuffer_pos (bb); xmmsv_bitbuffer_put_bits (bb, 32, n); if (n > 0) { xmmsv_get_list_iter (xmmsv_coll_operands_get (coll), &it); while (xmmsv_list_iter_entry (it, &v)) { if (!xmmsv_get_coll (v, &op)) { x_api_error ("Non collection operand", 0); } _internal_put_on_bb_int32 (bb, XMMSV_TYPE_COLL); ret = _internal_put_on_bb_collection (bb, op); xmmsv_list_iter_next (it); } } return ret; }