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); }
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); }
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); }
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)); }
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/"); }
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); }
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); }
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); }
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); }
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); }
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); }
void playqueue_length(gint argc, gchar **argv) { gint i; i = audacious_remote_get_playqueue_length(dbus_proxy); audtool_report("%d", i); }
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); }
void get_volume(gint argc, gchar **argv) { gint i; i = audacious_remote_get_main_volume(dbus_proxy); audtool_report("%d", i); }
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); }
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); }
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); }
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); }
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"); }
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); }
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); }
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); }
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); }
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); }
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); }
void get_volume (int argc, char * * argv) { audtool_report ("%d", get_main_volume ()); }
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"); }
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); }
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); }
void playqueue_length (int argc, char * * argv) { audtool_report ("%d", get_queue_length ()); }