Ejemplo n.º 1
0
void get_current_song(gint argc, gchar **argv)
{
	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
	gchar *song = audacious_remote_get_playlist_title(dbus_proxy, playpos);

	if (!song)
	{
		audtool_report("No song playing.");
		return;
	}

	audtool_report("%s", song);
}
Ejemplo n.º 2
0
void get_current_song_output_length_seconds(gint argc, gchar **argv)
{
	gint frames = audacious_remote_get_output_time(dbus_proxy);
	gint length = frames / 1000;

	audtool_report("%d", length);
}
Ejemplo n.º 3
0
void get_current_song_length_frames(gint argc, gchar **argv)
{
	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
	gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos);

	audtool_report("%d", frames);
}
Ejemplo n.º 4
0
void equalizer_get_eq_band(gint argc, gchar **argv)
{
    int band;

    if (argc < 2)
    {
        audtool_whine_args(argv[0], "<band>");
        exit(1);
    }

    band = atoi(argv[1]);

    /* FIXME, XXX, TODO: we should have a function for requesting
     * the actual number of bands, if we support dynamic amount some day ...
     * -- ccr
     */
    if (band < 0 || band > 9)
    {
        audtool_whine("band number out of range\n");
        exit(1);
    }
    
    audtool_report("band %d = %.2f", band, audacious_remote_get_eq_band(dbus_proxy, band));
    
}
Ejemplo n.º 5
0
void get_handlers_list(gint argc, gchar **argv)
{
	gint i;

	for (i = 0; handlers[i].name != NULL; i++)
	{
		if (!g_ascii_strcasecmp("<sep>", handlers[i].name))
			audtool_report("%s%s:", i == 0 ? "" : "\n", handlers[i].desc);
		else
			audtool_report("   %-34s - %s", handlers[i].name, handlers[i].desc);
	}

    audtool_report("");
	audtool_report("Handlers may be prefixed with `--' (GNU-style long-options) or not, your choice.");
	audtool_report("Report bugs to http://redmine.audacious-media-player.org/");
}
Ejemplo n.º 6
0
void get_current_song_info(gint argc, gchar **argv)
{
    gint rate, freq, nch;

    audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);
    audtool_report("rate = %d freq = %d nch = %d", rate, freq, nch);
}
Ejemplo n.º 7
0
void playqueue_display(gint argc, gchar **argv)
{
	gint i, ii, position, frames, length, total;
	gchar *songname;
	gchar *fmt = NULL, *p;
	gint column;

	i = audacious_remote_get_playqueue_length(dbus_proxy);

	audtool_report("%d queued tracks.", i);

	total = 0;

	for (ii = 0; ii < i; ii++)
	{
		position = audacious_remote_get_playqueue_list_position(dbus_proxy, ii);
		songname = audacious_remote_get_playlist_title(dbus_proxy, position);
		frames = audacious_remote_get_playlist_time(dbus_proxy, position);
		length = frames / 1000;
		total += length;

		/* adjust width for multi byte characters */
		column = 60;
		if(songname) {
			p = songname;
			while(*p){
				gint stride;
				stride = g_utf8_next_char(p) - p;
				if(g_unichar_iswide(g_utf8_get_char(p))
				   || g_unichar_iswide_cjk(g_utf8_get_char(p))
				){
					column += (stride - 2);
				}
				else {
					column += (stride - 1);
				}
				p = g_utf8_next_char(p);
			}
		}

		fmt = g_strdup_printf("%%4d | %%4d | %%-%ds | %%d:%%.2d", column);
		audtool_report(fmt, ii + 1, position + 1, songname, length / 60, length % 60);
		g_free(fmt);
	}

	audtool_report("Total length: %d:%.2d", total / 60, total % 60);
}
Ejemplo n.º 8
0
void get_current_song_frequency_khz(gint argc, gchar **argv)
{
	gint rate, freq, nch;

	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);

	audtool_report("%0.1f", (gfloat) freq / 1000);
}
Ejemplo n.º 9
0
void get_current_song_frequency(gint argc, gchar **argv)
{
	gint rate, freq, nch;

	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);

	audtool_report("%d", freq);
}
Ejemplo n.º 10
0
void get_current_song_bitrate_kbps(gint argc, gchar **argv)
{
	gint rate, freq, nch;

	audacious_remote_get_info(dbus_proxy, &rate, &freq, &nch);

	audtool_report("%d", rate / 1000);
}
Ejemplo n.º 11
0
void get_current_song_length(gint argc, gchar **argv)
{
	gint playpos = audacious_remote_get_playlist_pos(dbus_proxy);
	gint frames = audacious_remote_get_playlist_time(dbus_proxy, playpos);
	gint length = frames / 1000;

	audtool_report("%d:%.2d", length / 60, length % 60);
}
Ejemplo n.º 12
0
void playqueue_length(gint argc, gchar **argv)
{
	gint i;

	i = audacious_remote_get_playqueue_length(dbus_proxy);

	audtool_report("%d", i);
}
Ejemplo n.º 13
0
void get_version(gint argc, gchar **argv)
{
    gchar *version = NULL;
    version = audacious_remote_get_version(dbus_proxy);
    if(version)
        audtool_report("Audacious %s", version);
    g_free(version);
}
Ejemplo n.º 14
0
void get_volume(gint argc, gchar **argv)
{
	gint i;

	i = audacious_remote_get_main_volume(dbus_proxy);

	audtool_report("%d", i);
}
Ejemplo n.º 15
0
void playqueue_get_list_position(gint argc, gchar **argv)
{
	gint pos, i = check_args_playlist_pos(argc, argv);

	pos = audacious_remote_get_playqueue_list_position(dbus_proxy, i - 1) + 1;

	if (pos < 1)
		return;

	audtool_report("%d", pos);
}
Ejemplo n.º 16
0
void playback_status (int argc, char * * argv)
{
    char * status = NULL;
    obj_audacious_call_status_sync (dbus_proxy, & status, NULL, NULL);

    if (! status)
        exit (1);

    audtool_report ("%s", status);
    g_free (status);
}
Ejemplo n.º 17
0
void get_version (int argc, char * * argv)
{
    char * version = NULL;
    obj_audacious_call_version_sync (dbus_proxy, & version, NULL, NULL);

    if (! version)
        exit (1);

    audtool_report ("Audacious %s", version);
    g_free (version);
}
Ejemplo n.º 18
0
void playqueue_is_queued(gint argc, gchar **argv)
{
	gint i = check_args_playlist_pos(argc, argv);

    if (audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)) {
        audtool_report("OK");
        exit(0);
    }
    else
        exit(1);
}
Ejemplo n.º 19
0
void get_handlers_list (int argc, char * * argv)
{
    audtool_report ("Usage: audtool [-#] COMMAND ...");
    audtool_report ("       where # (1-9) selects the instance of Audacious to control");
    audtool_report ("");

    for (int i = 0; handlers[i].name; i ++)
    {
        if (! g_ascii_strcasecmp ("<sep>", handlers[i].name))
            audtool_report ("%s%s:", i == 0 ? "" : "\n", handlers[i].desc);
        else
            audtool_report ("   %-34s - %s", handlers[i].name, handlers[i].desc);
    }

    audtool_report ("");
    audtool_report ("Commands may be prefixed with '--' (GNU-style long options) or not, your choice.");
    audtool_report ("Show/hide and enable/disable commands take an optional 'on' or 'off' argument.");
    audtool_report ("Report bugs to http://redmine.audacious-media-player.org/projects/audacious");
}
Ejemplo n.º 20
0
void equalizer_get_eq_band (int argc, char * * argv)
{
    if (argc < 2)
    {
        audtool_whine_args (argv[0], "<band>");
        exit (1);
    }

    int band = atoi (argv[1]);

    double level = 0;
    obj_audacious_call_get_eq_band_sync (dbus_proxy, band, & level, NULL, NULL);
    audtool_report ("band %d = %.2f", band, level);
}
Ejemplo n.º 21
0
void get_current_song_filename (gint argc, gchar * * argv)
{
    gint playpos = audacious_remote_get_playlist_pos (dbus_proxy);
    gchar * uri, * filename;

    uri = audacious_remote_get_playlist_file (dbus_proxy, playpos);
    filename = (uri != NULL) ? g_filename_from_uri (uri, NULL, NULL) : NULL;

    audtool_report ("%s", (filename != NULL) ? filename : (uri != NULL) ? uri :
     _("No song playing."));

    g_free (uri);
    g_free (filename);
}
Ejemplo n.º 22
0
void playqueue_display (int argc, char * * argv)
{
    int qlength = get_queue_length ();

    audtool_report ("%d queued tracks.", qlength);

    int total = 0;

    for (int qpos = 0; qpos < qlength; qpos ++)
    {
        int pos = get_queue_entry (qpos);
        char * title = get_entry_title (pos);
        int length = get_entry_length (pos) / 1000;

        total += length;

        /* adjust width for multi byte characters */
        int column = 60;

        for (const char * p = title; * p; p = g_utf8_next_char (p))
        {
            int stride = g_utf8_next_char (p) - p;

            if (g_unichar_iswide (g_utf8_get_char (p)) ||
             g_unichar_iswide_cjk (g_utf8_get_char (p)))
                column += (stride - 2);
            else
                column += (stride - 1);
        }

        char * fmt = g_strdup_printf ("%%4d | %%4d | %%-%ds | %%d:%%.2d", column);
        audtool_report (fmt, qpos + 1, pos + 1, title, length / 60, length % 60);
        g_free (fmt);
    }

    audtool_report ("Total length: %d:%.2d", total / 60, total % 60);
}
Ejemplo n.º 23
0
void equalizer_get_eq(gint argc, gchar **argv)
{
    double preamp;
    GArray *bands;
    int i;

    audacious_remote_get_eq(dbus_proxy, &preamp, &bands);

    audtool_report("preamp = %.2f", preamp);
    for(i=0; i<10; i++){
        printf("%.2f ", g_array_index(bands, gdouble, i));
    }
    printf("\n");
    g_array_free(bands, TRUE);
}
Ejemplo n.º 24
0
void get_current_song_tuple_field_data(gint argc, gchar **argv)
{
	gchar *data;

	if (argc < 2)
	{
		audtool_whine_args(argv[0], "<fieldname>");
		audtool_whine_tuple_fields();
		exit(1);
	}

	if (!(data = audacious_get_tuple_field_data(dbus_proxy, argv[1], audacious_remote_get_playlist_pos(dbus_proxy))))
	{
		return;
	}

	audtool_report("%s", data);

	g_free(data);
}
Ejemplo n.º 25
0
void equalizer_get_eq (int argc, char * * argv)
{
    double preamp = 0.0;
    GVariant * var = NULL;

    obj_audacious_call_get_eq_sync (dbus_proxy, & preamp, & var, NULL, NULL);

    if (! var || ! g_variant_is_of_type (var, G_VARIANT_TYPE ("ad")))
        exit (1);

    audtool_report ("preamp = %.2f", preamp);

    size_t nbands = 0;
    const double * bands = g_variant_get_fixed_array (var, & nbands, sizeof (double));

    if (nbands != NUM_BANDS)
        exit (1);

    for (int i = 0; i < NUM_BANDS; i ++)
        printf ("%.2f ", bands[i]);

    printf ("\n");
    g_variant_unref (var);
}
Ejemplo n.º 26
0
void get_volume (int argc, char * * argv)
{
    audtool_report ("%d", get_main_volume ());
}
Ejemplo n.º 27
0
void playqueue_is_queued (int argc, char * * argv)
{
    int pos = check_args_playlist_pos (argc, argv);
    find_in_queue (pos - 1); /* exits if not found */
    audtool_report ("OK");
}
Ejemplo n.º 28
0
void playqueue_get_queue_position (int argc, char * * argv)
{
    int pos = check_args_playlist_pos (argc, argv);
    audtool_report ("%d", find_in_queue (pos - 1) + 1);
}
Ejemplo n.º 29
0
void playqueue_get_list_position (int argc, char * * argv)
{
    int qpos = check_args_playlist_pos (argc, argv);
    audtool_report ("%d", get_queue_entry (qpos - 1) + 1);
}
Ejemplo n.º 30
0
void playqueue_length (int argc, char * * argv)
{
    audtool_report ("%d", get_queue_length ());
}