This patch for the 0.8 branch adds support for --print-playing-artist, --print-playing-album, --print-playing-track, and --print-playing-genre. Please consider for inclusion. Regards, Jon Oberheide jon focalhost com
--- rhythmbox.old/shell/main.c 2004-05-03 18:09:56.000000000 -0500
+++ rhythmbox-0.8/shell/main.c 2004-05-15 11:11:39.000000000 -0500
@@ -68,6 +68,10 @@
static gboolean dry_run = FALSE;
static char *rhythmdb_file = NULL;
static gboolean print_playing = FALSE;
+static gboolean print_playing_artist = FALSE;
+static gboolean print_playing_album = FALSE;
+static gboolean print_playing_track = FALSE;
+static gboolean print_playing_genre = FALSE;
static gboolean print_playing_path = FALSE;
static gboolean playpause = FALSE;
static gboolean focus = FALSE;
@@ -89,6 +93,10 @@
const struct poptOption popt_options[] =
{
{ "print-playing", 0, POPT_ARG_NONE, &print_playing, 0, N_("Print the playing song and exit"), NULL },
+ { "print-playing-artist", 0, POPT_ARG_NONE, &print_playing_artist, 0, N_("Print the playing song artist and exit"), NULL },
+ { "print-playing-album", 0, POPT_ARG_NONE, &print_playing_album, 0, N_("Print the playing song album title and exit"), NULL },
+ { "print-playing-track", 0, POPT_ARG_NONE, &print_playing_track, 0, N_("Print the playing song track number and exit"), NULL },
+ { "print-playing-genre", 0, POPT_ARG_NONE, &print_playing_genre, 0, N_("Print the playing song genre and exit"), NULL },
{ "print-playing-path", 0, POPT_ARG_NONE, &print_playing_path, 0, N_("Print the playing song URI and exit"), NULL },
{ "print-song-length", 0, POPT_ARG_NONE, &print_song_length, 0, N_("Print the playing song length in seconds and exit"), NULL },
@@ -328,6 +336,65 @@
grab_focus = FALSE;
}
+ if (print_playing_artist)
+ {
+ GNOME_Rhythmbox_SongInfo *song_info;
+
+ song_info = get_song_info (shell);
+ if (song_info == NULL) {
+ g_print ("\n");
+ } else {
+ g_print ("%s\n", song_info->artist);
+ CORBA_free (song_info);
+ }
+ grab_focus = FALSE;
+ }
+
+ if (print_playing_album)
+ {
+ GNOME_Rhythmbox_SongInfo *song_info;
+
+ song_info = get_song_info (shell);
+ if (song_info == NULL) {
+ g_print ("\n");
+ } else {
+ g_print ("%s\n", song_info->album);
+ CORBA_free (song_info);
+ }
+ grab_focus = FALSE;
+ }
+
+ if (print_playing_track)
+ {
+ GNOME_Rhythmbox_SongInfo *song_info;
+
+ song_info = get_song_info (shell);
+ if (song_info == NULL) {
+ g_print ("\n");
+ } else if(song_info->track_number == -1) {
+ g_print ("Unknown\n");
+ CORBA_free (song_info);
+ } else {
+ g_print ("%d\n", song_info->track_number);
+ CORBA_free (song_info);
+ }
+ grab_focus = FALSE;
+ }
+
+ if (print_playing_genre)
+ {
+ GNOME_Rhythmbox_SongInfo *song_info;
+
+ song_info = get_song_info (shell);
+ if (song_info == NULL) {
+ g_print ("\n");
+ } else {
+ g_print ("%s\n", song_info->genre);
+ CORBA_free (song_info);
+ }
+ grab_focus = FALSE;
+ }
+
if (print_playing_path)
{
GNOME_Rhythmbox_SongInfo *song_info;
Attachment:
signature.asc
Description: This is a digitally signed message part