[Rhythmbox-devel] Add --print-playing-extended
- From: Gawain Lynch <gawain lynch bigpond com>
- To: rhythmbox-devel gnome org
- Subject: [Rhythmbox-devel] Add --print-playing-extended
- Date: Wed, 22 Sep 2004 14:09:39 +1000
Hi All,
Attached are tiny patches I would love to have considered for inclusion.
One against 0.8.6 and the other against 0.9--patch-136.
They add a --print-playing-extended option that literally:
"Print the playing song in the format: \"artist - album - track number -
song\" and exit"
I see that there has been an update in 0.9 that allows for doing this
with several calls to Rhythmbox, but this does it in one.
Take care,
Gawain
--- rhythmbox-0.8.6/shell/main.c.playext 2004-09-22 12:41:12.655438040 +1000
+++ rhythmbox-0.8.6/shell/main.c 2004-09-22 12:41:43.945681200 +1000
@@ -68,6 +68,7 @@
static gboolean dry_run = FALSE;
static char *rhythmdb_file = NULL;
static gboolean print_playing = FALSE;
+static gboolean print_playing_extended = FALSE;
static gboolean print_playing_path = FALSE;
static gboolean playpause = FALSE;
static gboolean focus = FALSE;
@@ -94,6 +95,7 @@
struct poptOption popt_options[] =
{
{ "print-playing", 0, POPT_ARG_NONE, &print_playing, 0, N_("Print the playing song and exit"), NULL },
+ { "print-playing-extended", 0, POPT_ARG_NONE, &print_playing_ext, 0, N_("Print the playing song in the format: \"artist - album - track number - song\" 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 },
@@ -383,6 +385,24 @@
}
grab_focus = FALSE;
}
+
+ if (print_playing_extended)
+ {
+ GNOME_Rhythmbox_SongInfo *song_info;
+
+ song_info = get_song_info (shell);
+ if (song_info == NULL) {
+ g_print ("\n");
+ } else {
+ g_print ("%s - %s - %d - %s\n", song_info->artist,
+ song_info->album,
+ song_info->track_number,
+ song_info->title);
+ CORBA_free (song_info);
+ }
+ grab_focus = FALSE;
+ }
+
if (print_playing_path)
{
--- rhythmbox--main--0.9--patch-136/shell/main.c.playext 2004-09-22 13:43:57.607078392 +1000
+++ rhythmbox--main--0.9--patch-136/shell/main.c 2004-09-22 13:52:45.956757032 +1000
@@ -69,6 +69,7 @@
static gboolean dry_run = FALSE;
static char *rhythmdb_file = NULL;
static gboolean print_playing = FALSE;
+static gboolean print_playing_extended = FALSE;
static gboolean print_playing_artist = FALSE;
static gboolean print_playing_album = FALSE;
static gboolean print_playing_track = FALSE;
@@ -106,6 +107,7 @@
struct poptOption popt_options[] =
{
{ "print-playing", 0, POPT_ARG_NONE, &print_playing, 0, N_("Print the playing song and exit"), NULL },
+ { "print-playing-extended", 0, POPT_ARG_NONE, &print_playing_extended, 0, N_("Print the playing song in the format: \"artist - album - track number - 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 and exit"), NULL },
{ "print-playing-track", 0, POPT_ARG_NONE, &print_playing_track, 0, N_("Print the playing song track and exit"), NULL },
@@ -301,6 +303,7 @@
song = NULL;
if (print_playing
+ || print_playing_extended
|| print_playing_artist
|| print_playing_album
|| print_playing_track
@@ -314,7 +317,11 @@
if (print_playing)
g_print ("%s\n", song ? song->title : "");
-
+ if (print_playing_extended)
+ g_print ("%s - %s - %d - %s\n", song ? song_info->artist,
+ song_info->album,
+ song_info->track_number,
+ song_info->title : "", "", "", "");
if (print_playing_artist)
g_print ("%s\n", song ? song->artist : "");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]