comparison audtool/audtool.c @ 1365:97000f8de201 trunk

[svn] - Added playlist-delete command.
author nhjm449
date Sat, 01 Jul 2006 04:24:23 -0700
parents 3783e06f951b
children acdc12679d1a
comparison
equal deleted inserted replaced
1364:18a6a71b8c15 1365:97000f8de201
38 {"current-song-channels", get_current_song_channels, "returns current song channels"}, 38 {"current-song-channels", get_current_song_channels, "returns current song channels"},
39 {"<sep>", NULL, "Playlist manipulation"}, 39 {"<sep>", NULL, "Playlist manipulation"},
40 {"playlist-advance", playlist_advance, "go to the next song in the playlist"}, 40 {"playlist-advance", playlist_advance, "go to the next song in the playlist"},
41 {"playlist-reverse", playlist_reverse, "go to the previous song in the playlist"}, 41 {"playlist-reverse", playlist_reverse, "go to the previous song in the playlist"},
42 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"}, 42 {"playlist-addurl", playlist_add_url_string, "adds a url to the playlist"},
43 {"playlist-delete", playlist_delete, "deletes a song from the playlist"},
43 {"playlist-length", playlist_length, "returns the total length of the playlist"}, 44 {"playlist-length", playlist_length, "returns the total length of the playlist"},
44 {"playlist-song", playlist_song, "returns the title of a song in the playlist"}, 45 {"playlist-song", playlist_song, "returns the title of a song in the playlist"},
45 {"playlist-song-filename", playlist_song_filename, "returns the filename of a song in the playlist"}, 46 {"playlist-song-filename", playlist_song_filename, "returns the filename of a song in the playlist"},
46 {"playlist-song-length", playlist_song_length, "returns the length of a song in the playlist"}, 47 {"playlist-song-length", playlist_song_length, "returns the length of a song in the playlist"},
47 {"playlist-song-length-seconds", playlist_song_length_seconds, "returns the length of a song in the playlist in seconds"}, 48 {"playlist-song-length-seconds", playlist_song_length_seconds, "returns the length of a song in the playlist in seconds"},
333 } 334 }
334 335
335 xmms_remote_playlist_add_url_string(session, argv[2]); 336 xmms_remote_playlist_add_url_string(session, argv[2]);
336 } 337 }
337 338
339 void playlist_delete(gint session, gint argc, gchar **argv)
340 {
341 if (argc < 3)
342 {
343 g_print("%s: invalid parameters for playlist-delete.\n", argv[0]);
344 g_print("%s: syntax: %s playlist-delete <position>\n", argv[0], argv[0]);
345 return;
346 }
347
348 gint playpos = atoi(argv[2]);
349
350 if (playpos < 1 || playpos > xmms_remote_get_playlist_length(session))
351 {
352 g_print("%s: invalid playlist position %d\n", argv[0], playpos);
353 return;
354 }
355
356 xmms_remote_playlist_delete(session, playpos - 1);
357 }
358
338 void playlist_length(gint session, gint argc, gchar **argv) 359 void playlist_length(gint session, gint argc, gchar **argv)
339 { 360 {
340 gint i; 361 gint i;
341 362
342 i = xmms_remote_get_playlist_length(session); 363 i = xmms_remote_get_playlist_length(session);