Ejemplo n.º 1
0
/*	Print list of songs
 *	@param pianobar settings
 *	@param linked list of songs
 *	@param artist/song filter string
 *	@return # of songs
 */
size_t BarUiListSongs (const BarSettings_t *settings,
		const PianoSong_t *song, const char *filter) {
	size_t i = 0;
	char digits[4];

	while (song != NULL) {
		if (filter == NULL ||
				(filter != NULL && (BarStrCaseStr (song->artist, filter) != NULL ||
				BarStrCaseStr (song->title, filter) != NULL))) {
			char outstr[512];
			const char *vals[] = {digits, song->artist, song->title,
					(song->rating == PIANO_RATE_LOVE) ? settings->loveIcon :
					((song->rating == PIANO_RATE_BAN) ? settings->banIcon : "")};

			snprintf (digits, sizeof (digits) / sizeof (*digits), "%2zu", i);
			BarUiCustomFormat (outstr, sizeof (outstr), settings->listSongFormat,
					"iatr", vals);
			BarUiAppendNewline (outstr, sizeof (outstr));
			BarUiMsg (settings, MSG_LIST, "%s", outstr);
		}
		i++;
		song = song->next;
	}

	return i;
}
Ejemplo n.º 2
0
/*	Print song infos (artist, title, album, loved)
 *	@param pianobar settings
 *	@param the song
 *	@param alternative station info (show real station for quickmix, e.g.)
 */
void BarUiPrintSong (const BarSettings_t *settings,
		const PianoSong_t *song, const PianoStation_t *station) {
	char outstr[512];
	const char *vals[] = {song->title, song->artist, song->album,
			(song->rating == PIANO_RATE_LOVE) ? settings->loveIcon : "",
			station != NULL ? settings->atIcon : "",
			station != NULL ? station->name : "",
			song->detailUrl};

	BarUiCustomFormat (outstr, sizeof (outstr), settings->npSongFormat,
			"talr@su", vals);
	BarUiAppendNewline (outstr, sizeof (outstr));
	BarUiMsg (settings, MSG_PLAYING, "%s", outstr);

	BarUiCustomFormat(outstr, sizeof(outstr), settings->titleFormat,
		"talr@su", vals);
	BarConsoleSetTitle(outstr);
}
Ejemplo n.º 3
0
/*	Print customizeable station infos
 *	@param pianobar settings
 *	@param the station
 */
inline void BarUiPrintStation (const BarSettings_t *settings,
		PianoStation_t *station) {
	char outstr[512];
	const char *vals[] = {station->name, station->id};

	BarUiCustomFormat (outstr, sizeof (outstr), settings->npStationFormat,
			"ni", vals);
	BarUiAppendNewline (outstr, sizeof (outstr));
	BarUiMsg (settings, MSG_PLAYING, "%s", outstr);
}