diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 14 | ||||
-rw-r--r-- | src/pianobar.1 | 13 | ||||
-rw-r--r-- | src/settings.c | 3 | ||||
-rw-r--r-- | src/settings.h | 1 |
4 files changed, 27 insertions, 4 deletions
@@ -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 @@ -114,6 +114,15 @@ 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 will use this proxy. The music is streamed directly. @@ -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; |