From 152c67bb38e71c1b189774beac07008cbc4d1631 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 16 Feb 2009 15:11:36 +0100 Subject: Autostart station setting added You may define a station that is played when starting pianobar now. --- src/main.c | 14 ++++++++++++-- src/pianobar.1 | 13 +++++++++++-- src/settings.c | 3 +++ src/settings.h | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 4f63404..c8a91b2 100644 --- a/src/main.c +++ b/src/main.c @@ -110,8 +110,18 @@ int main (int argc, char **argv) { return 0; } - /* select station */ - curStation = BarUiSelectStation (&ph, "Select station: "); + /* try to get autostart station */ + if (settings.autostartStation != NULL) { + curStation = PianoFindStationById (ph.stations, + settings.autostartStation); + if (curStation == NULL) { + BarUiMsg ("Error: Autostart station not found.\n"); + } + } + /* no autostart? ask the user */ + if (curStation == NULL) { + curStation = BarUiSelectStation (&ph, "Select station: "); + } if (curStation != NULL) { printf ("Playing station \"%s\"\n", curStation->name); } diff --git a/src/pianobar.1 b/src/pianobar.1 index 14786da..b0a3194 100644 --- a/src/pianobar.1 +++ b/src/pianobar.1 @@ -113,6 +113,15 @@ Select quickmix stations. Select audio format. aacplus is default if both libraries (faad, mad) are available. +.TP +.B autostart_station = stationid +Play this station when starting up. You can get the +.B stationid +by pressing +.B i +or the key you defined in +.B act_songinfo. + .TP .B control_proxy = host:port Non-american users need a proxy to use pandora.com. Only the xmlrpc interface @@ -132,11 +141,11 @@ If you have problems when loggin in and you know your control proxy definitively works try setting this option to .B 1. It disables the SSL secured login. Beware! -.I Your password will be sent as plain-text! +.I Your password will be send as plain-text! .TP .B lastfm_user = your_username -If you want to send your played song to last.fm set this to your last.fm +If you want to send your played songs to last.fm set this to your last.fm username. .TP diff --git a/src/settings.c b/src/settings.c index 63d5937..bc471f0 100644 --- a/src/settings.c +++ b/src/settings.c @@ -82,6 +82,7 @@ void BarSettingsDestroy (BarSettings_t *settings) { free (settings->password); free (settings->lastfmUser); free (settings->lastfmPassword); + free (settings->autostartStation); memset (settings, 0, sizeof (*settings)); } @@ -229,6 +230,8 @@ void BarSettingsRead (BarSettings_t *settings) { } else if (strcmp (val, "mp3") == 0) { settings->audioFormat = PIANO_AF_MP3; } + } else if (strcmp ("autostart_station", key) == 0) { + settings->autostartStation = strdup (val); } } diff --git a/src/settings.h b/src/settings.h index a1afea1..ef3b93f 100644 --- a/src/settings.h +++ b/src/settings.h @@ -51,6 +51,7 @@ struct BarSettings { struct BarKeyShortcut *next; } *keys; PianoAudioFormat_t audioFormat; + char *autostartStation; }; typedef struct BarSettings BarSettings_t; -- cgit v1.2.3