コード例 #1
0
ファイル: commands_playback.c プロジェクト: vdust/xmms2-devel
gboolean
cli_jump (cli_context_t *ctx, command_t *cmd)
{
	xmmsc_connection_t *conn = cli_context_xmms_sync (ctx);
	xmmsv_t *query;
	gboolean backward = FALSE;
	playlist_positions_t *positions;

	command_flag_boolean_get (cmd, "backward", &backward);

	/* Select by positions */
	if (command_arg_positions_get (cmd, 0, &positions, cli_context_current_position (ctx))) {
		gint pos;
		if (playlist_positions_get_single (positions, &pos)) {
			XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_playlist_set_next, conn, pos),
			                 XMMS_CALL_P (xmmsc_playback_tickle, conn));
		} else {
			g_printf (_("Cannot jump to several positions!\n"));
		}
		playlist_positions_free (positions);
		/* Select by pattern */
	} else if (command_arg_pattern_get (cmd, 0, &query, TRUE)) {
		query = xmmsv_coll_intersect_with_playlist (query, XMMS_ACTIVE_PLAYLIST);
		XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_coll_query_ids, conn, query, NULL, 0, 0),
		                 FUNC_CALL_P (cli_jump_relative, ctx, (backward ? -1 : 1), XMMS_PREV_VALUE));
		xmmsv_unref (query);
	}

	return FALSE;
}
コード例 #2
0
static void
currently_playing_request_status (currently_playing_t *entry)
{
	xmmsc_connection_t *conn = cli_context_xmms_sync (entry->ctx);
	XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_playback_status, conn),
	                 FUNC_CALL_P (currently_playing_update_status, entry, XMMS_PREV_VALUE));
}
コード例 #3
0
ファイル: cli_cache.c プロジェクト: randalboyle/xmms2-devel
void
cli_cache_refresh (cli_cache_t *cache)
{
    XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_playlist_current_pos, cache->conn, XMMS_ACTIVE_PLAYLIST),
                     FUNC_CALL_P (refresh_currpos, XMMS_PREV_VALUE, cache));

    XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_playback_current_id, cache->conn),
                     FUNC_CALL_P (refresh_currid, XMMS_PREV_VALUE, cache));

    XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_playback_status, cache->conn),
                     FUNC_CALL_P (refresh_playback_status, XMMS_PREV_VALUE, cache));

    XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_playlist_list_entries, cache->conn, XMMS_ACTIVE_PLAYLIST),
                     FUNC_CALL_P (refresh_active_playlist, XMMS_PREV_VALUE, cache));

    XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_playlist_current_active, cache->conn),
                     FUNC_CALL_P (refresh_active_playlist_name, XMMS_PREV_VALUE, cache));
}
コード例 #4
0
static void
currently_playing_request_info (currently_playing_t *entry)
{
	xmmsc_connection_t *conn = cli_context_xmms_sync (entry->ctx);
	gint current_id = cli_context_current_id (entry->ctx);

	if (current_id > 0) {
		XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_medialib_get_info, conn, current_id),
		                 FUNC_CALL_P (currently_playing_update_info, entry, XMMS_PREV_VALUE));
	}
}
コード例 #5
0
ファイル: commands_playlist.c プロジェクト: vdust/xmms2-devel
/* Get current position in @playlist or in active playlist if
   @playlist == NULL. */
static gboolean
playlist_currpos_get (cli_context_t *ctx, const gchar *playlist, gint *pos)
{
	xmmsc_connection_t *conn = cli_context_xmms_sync (ctx);

	if (playlist) {
		XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_coll_get, conn, playlist, XMMS_COLLECTION_NS_PLAYLISTS),
		                 FUNC_CALL_P (playlist_coll_attribute_get_position, XMMS_PREV_VALUE, pos));
	} else {
		*pos = cli_context_current_position (ctx);
	}

	return TRUE;
}
コード例 #6
0
ファイル: commands_playlist.c プロジェクト: vdust/xmms2-devel
static void
cli_list_print_positions_row (gint pos, void *udata)
{
	cli_list_positions_t *pack = (cli_list_positions_t *) udata;
	gint id;

	if (pos >= xmmsv_list_get_size (pack->entries)) {
		return;
	}

	if (xmmsv_list_get_int (pack->entries, pos, &id)) {
		column_display_set_position (pack->coldisp, pos);
		XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_medialib_get_info, pack->sync, id),
		                 FUNC_CALL_P (cli_list_print_row, pack->coldisp, XMMS_PREV_VALUE));
	}
}
コード例 #7
0
ファイル: commands_playlist.c プロジェクト: vdust/xmms2-devel
/* Get length of @playlist or of active playlist if @playlist == NULL. */
static gboolean
playlist_length_get (cli_context_t *ctx, const gchar *playlist, gint *length)
{
	xmmsc_connection_t *conn = cli_context_xmms_sync (ctx);

	*length = -1;

	if (playlist) {
		XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_coll_get, conn, playlist, XMMS_COLLECTION_NS_PLAYLISTS),
		                 FUNC_CALL_P (playlist_coll_idlist_get_size, XMMS_PREV_VALUE, length));
	} else {
		xmmsv_t *entries = cli_context_active_playlist (ctx);
		*length = xmmsv_list_get_size (entries);
	}

	return *length >= 0;
}
コード例 #8
0
static void
cli_info_print_list (cli_context_t *ctx, xmmsv_t *val)
{
	xmmsc_connection_t *conn = cli_context_xmms_sync (ctx);
	xmmsv_list_iter_t *it;
	gboolean first = TRUE;
	gint32 id;

	xmmsv_get_list_iter (val, &it);
	while (xmmsv_list_iter_entry_int (it, &id)) {
		if (!first) {
			g_printf ("\n");
		} else {
			first = FALSE;
		}

		XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_medialib_get_info, conn, id),
		                 FUNC_CALL_P (cli_info_print, XMMS_PREV_VALUE));

		xmmsv_list_iter_next (it);
	}
}
コード例 #9
0
static void
cli_info_print_position (gint pos, void *userdata)
{
	cli_info_print_positions_t *pack = (cli_info_print_positions_t *) userdata;
	xmmsc_connection_t *conn = cli_context_xmms_sync (pack->ctx);
	xmmsv_t *playlist = cli_context_active_playlist (pack->ctx);
	gint id;

	/* Skip if outside of playlist */
	if (!xmmsv_list_get_int (playlist, pos, &id)) {
		return;
	}

	/* Do not prepend newline before the first entry */
	if (pack->inc > 0) {
		g_printf ("\n");
	} else {
		pack->inc++;
	}

	XMMS_CALL_CHAIN (XMMS_CALL_P (xmmsc_medialib_get_info, conn, id),
	                 FUNC_CALL_P (cli_info_print, XMMS_PREV_VALUE));
}