Mercurial > audlegacy
comparison src/audtool/audtool.c @ 2585:c2b49ba4be45 trunk
[svn] - tuple reading now available through audtool with audacious_get_tuple_field_data()
author | nhjm449 |
---|---|
date | Mon, 26 Feb 2007 19:06:45 -0800 |
parents | 921b2d8d9b2e |
children | 65073812a5cf |
comparison
equal
deleted
inserted
replaced
2584:ea937605a48a | 2585:c2b49ba4be45 |
---|---|
36 {"current-song-bitrate", get_current_song_bitrate, "returns current song bitrate in bits per second"}, | 36 {"current-song-bitrate", get_current_song_bitrate, "returns current song bitrate in bits per second"}, |
37 {"current-song-bitrate-kbps", get_current_song_bitrate_kbps, "returns current song bitrate in kilobits per second"}, | 37 {"current-song-bitrate-kbps", get_current_song_bitrate_kbps, "returns current song bitrate in kilobits per second"}, |
38 {"current-song-frequency", get_current_song_frequency, "returns current song frequency in hertz"}, | 38 {"current-song-frequency", get_current_song_frequency, "returns current song frequency in hertz"}, |
39 {"current-song-frequency-khz", get_current_song_frequency_khz, "returns current song frequency in kilohertz"}, | 39 {"current-song-frequency-khz", get_current_song_frequency_khz, "returns current song frequency in kilohertz"}, |
40 {"current-song-channels", get_current_song_channels, "returns current song channels"}, | 40 {"current-song-channels", get_current_song_channels, "returns current song channels"}, |
41 {"current-song-tuple-data", get_current_song_tuple_field_data, "returns the value of a tuple field for the current song"}, | |
41 {"<sep>", NULL, "Playlist manipulation"}, | 42 {"<sep>", NULL, "Playlist manipulation"}, |
42 {"playlist-advance", playlist_advance, "go to the next song in the playlist"}, | 43 {"playlist-advance", playlist_advance, "go to the next song in the playlist"}, |
43 {"playlist-reverse", playlist_reverse, "go to the previous song in the playlist"}, | 44 {"playlist-reverse", playlist_reverse, "go to the previous song in the playlist"}, |
44 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"}, | 45 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"}, |
45 {"playlist-delete", playlist_delete, "deletes a song from the playlist"}, | 46 {"playlist-delete", playlist_delete, "deletes a song from the playlist"}, |
55 {"playlist-clear", playlist_clear, "clears the playlist"}, | 56 {"playlist-clear", playlist_clear, "clears the playlist"}, |
56 {"playlist-repeat-status", playlist_repeat_status, "returns the status of playlist repeat"}, | 57 {"playlist-repeat-status", playlist_repeat_status, "returns the status of playlist repeat"}, |
57 {"playlist-repeat-toggle", playlist_repeat_toggle, "toggles playlist repeat"}, | 58 {"playlist-repeat-toggle", playlist_repeat_toggle, "toggles playlist repeat"}, |
58 {"playlist-shuffle-status", playlist_shuffle_status, "returns the status of playlist shuffle"}, | 59 {"playlist-shuffle-status", playlist_shuffle_status, "returns the status of playlist shuffle"}, |
59 {"playlist-shuffle-toggle", playlist_shuffle_toggle, "toggles playlist shuffle"}, | 60 {"playlist-shuffle-toggle", playlist_shuffle_toggle, "toggles playlist shuffle"}, |
61 {"playlist-tuple-data", playlist_tuple_field_data, "returns the value of a tuple field for a song in the playlist"}, | |
60 {"<sep>", NULL, "Playqueue manipulation"}, | 62 {"<sep>", NULL, "Playqueue manipulation"}, |
61 {"playqueue-add", playqueue_add, "adds a song to the playqueue"}, | 63 {"playqueue-add", playqueue_add, "adds a song to the playqueue"}, |
62 {"playqueue-remove", playqueue_remove, "removes a song from the playqueue"}, | 64 {"playqueue-remove", playqueue_remove, "removes a song from the playqueue"}, |
63 {"playqueue-is-queued", playqueue_is_queued, "returns OK if a song is queued"}, | 65 {"playqueue-is-queued", playqueue_is_queued, "returns OK if a song is queued"}, |
64 {"playqueue-get-position", playqueue_get_position, "returns the queue position of a song in the playlist"}, | 66 {"playqueue-get-position", playqueue_get_position, "returns the queue position of a song in the playlist"}, |
250 xmms_remote_get_info(session, &rate, &freq, &nch); | 252 xmms_remote_get_info(session, &rate, &freq, &nch); |
251 | 253 |
252 g_print("%d\n", nch); | 254 g_print("%d\n", nch); |
253 } | 255 } |
254 | 256 |
257 | |
258 void get_current_song_tuple_field_data(gint session, gint argc, gchar **argv) | |
259 { | |
260 gpointer data; | |
261 | |
262 if (argc < 3) | |
263 { | |
264 g_print("%s: invalid parameters for current-song-tuple-data.\n", argv[0]); | |
265 g_print("%s: syntax: %s current-song-tuple-data <fieldname>\n", argv[0], argv[0]); | |
266 g_print("%s: - fieldname example choices: performer, album_name,\n", argv[0]); | |
267 g_print("%s: track_name, track_number, year, date, genre, comment,\n", argv[0]); | |
268 g_print("%s: file_name, file_ext, file_path, length, formatter, mtime\n", argv[0]); | |
269 return; | |
270 } | |
271 | |
272 if (!(data = audacious_get_tuple_field_data(session, argv[2], xmms_remote_get_playlist_pos(session)))) | |
273 { | |
274 return; | |
275 } | |
276 | |
277 if (!strcasecmp(argv[2], "track_number") || !strcasecmp(argv[2], "year") || !strcasecmp(argv[2], "length") || !strcasecmp(argv[2], "mtime")) | |
278 { | |
279 if (*(gint *)data > 0) | |
280 { | |
281 g_print("%d\n", *(gint *)data); | |
282 } | |
283 return; | |
284 } | |
285 | |
286 g_print("%s\n", (gchar *)data); | |
287 } | |
288 | |
255 void playlist_reverse(gint session, gint argc, gchar **argv) | 289 void playlist_reverse(gint session, gint argc, gchar **argv) |
256 { | 290 { |
257 xmms_remote_playlist_prev(session); | 291 xmms_remote_playlist_prev(session); |
258 } | 292 } |
259 | 293 |
652 } | 686 } |
653 | 687 |
654 void playlist_shuffle_toggle(gint session, gint argc, gchar **argv) | 688 void playlist_shuffle_toggle(gint session, gint argc, gchar **argv) |
655 { | 689 { |
656 xmms_remote_toggle_shuffle(session); | 690 xmms_remote_toggle_shuffle(session); |
691 } | |
692 | |
693 void playlist_tuple_field_data(gint session, gint argc, gchar **argv) | |
694 { | |
695 gint i; | |
696 gpointer data; | |
697 | |
698 if (argc < 4) | |
699 { | |
700 g_print("%s: invalid parameters for playlist-tuple-data.\n", argv[0]); | |
701 g_print("%s: syntax: %s playlist-tuple-data <fieldname> <position>\n", argv[0], argv[0]); | |
702 g_print("%s: - fieldname example choices: performer, album_name,\n", argv[0]); | |
703 g_print("%s: track_name, track_number, year, date, genre, comment,\n", argv[0]); | |
704 g_print("%s: file_name, file_ext, file_path, length, formatter, mtime\n", argv[0]); | |
705 return; | |
706 } | |
707 | |
708 i = atoi(argv[3]); | |
709 | |
710 if (i < 1 || i > xmms_remote_get_playlist_length(session)) | |
711 { | |
712 g_print("%s: invalid playlist position %d\n", argv[0], i); | |
713 return; | |
714 } | |
715 | |
716 if (!(data = audacious_get_tuple_field_data(session, argv[2], i - 1))) | |
717 { | |
718 return; | |
719 } | |
720 | |
721 if (!strcasecmp(argv[2], "track_number") || !strcasecmp(argv[2], "year") || !strcasecmp(argv[2], "length") || !strcasecmp(argv[2], "mtime")) | |
722 { | |
723 if (*(gint *)data > 0) | |
724 { | |
725 g_print("%d\n", *(gint *)data); | |
726 } | |
727 return; | |
728 } | |
729 | |
730 g_print("%s\n", (gchar *)data); | |
657 } | 731 } |
658 | 732 |
659 void playqueue_add(gint session, gint argc, gchar **argv) | 733 void playqueue_add(gint session, gint argc, gchar **argv) |
660 { | 734 { |
661 gint i; | 735 gint i; |