Skip to content

Commit

Permalink
Configureable %@ format string
Browse files Browse the repository at this point in the history
  • Loading branch information
PromyLOPh committed Jul 27, 2011
1 parent 0728b6a commit 948a79b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion contrib/pianobar.1
Expand Up @@ -144,6 +144,10 @@ Decrease volume.
.B act_volup = )
Increase volume.

.TP
.B at_icon = @
Replacement for %@ in station format string. It's " @ " by default.

.TP
.B audio_format = {aacplus,mp3,mp3-hifi}
Select audio format. aacplus is default if both libraries (faad, mad) are
Expand Down Expand Up @@ -189,7 +193,8 @@ Album name
Rating icon (only love icon)

.B %@
@-sign if station is quickmix
.B at_icon
if station is quickmix, empty otherwise.

.B %s
Real station name if quickmix
Expand Down
5 changes: 5 additions & 0 deletions src/settings.c
Expand Up @@ -88,6 +88,7 @@ void BarSettingsDestroy (BarSettings_t *settings) {
free (settings->eventCmd);
free (settings->loveIcon);
free (settings->banIcon);
free (settings->atIcon);
free (settings->npSongFormat);
free (settings->npStationFormat);
for (size_t i = 0; i < MSG_COUNT; i++) {
Expand Down Expand Up @@ -122,6 +123,7 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->sortOrder = BAR_SORT_NAME_AZ;
settings->loveIcon = strdup (" <3");
settings->banIcon = strdup (" </3");
settings->atIcon = strdup (" @ ");
settings->npSongFormat = strdup ("\"%t\" by \"%a\" on \"%l\"%r%@%s");
settings->npStationFormat = strdup ("Station \"%n\" (%i)");

Expand Down Expand Up @@ -214,6 +216,9 @@ void BarSettingsRead (BarSettings_t *settings) {
} else if (streq ("ban_icon", key)) {
free (settings->banIcon);
settings->banIcon = strdup (val);
} else if (streq ("at_icon", key)) {
free (settings->atIcon);
settings->atIcon = strdup (val);
} else if (streq ("volume", key)) {
settings->volume = atoi (val);
} else if (streq ("format_nowplaying_song", key)) {
Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Expand Up @@ -91,6 +91,7 @@ typedef struct {
char *eventCmd;
char *loveIcon;
char *banIcon;
char *atIcon;
char *npSongFormat;
char *npStationFormat;
BarMsgFormatStr_t msgFormat[MSG_COUNT];
Expand Down
2 changes: 1 addition & 1 deletion src/ui.c
Expand Up @@ -713,7 +713,7 @@ inline void BarUiPrintSong (const BarSettings_t *settings,
char outstr[512];
const char *vals[] = {song->title, song->artist, song->album,
(song->rating == PIANO_RATE_LOVE) ? settings->loveIcon : "",
station != NULL ? " @ " : "",
station != NULL ? settings->atIcon : "",
station != NULL ? station->name : "",
song->detailUrl};

Expand Down

0 comments on commit 948a79b

Please sign in to comment.