Example #1
0
static void
song_changed(const struct mpd_song *song)
{
	g_assert(song != NULL);

	if (mpd_song_get_tag(song, MPD_TAG_ARTIST, 0) == NULL ||
			mpd_song_get_tag(song, MPD_TAG_TITLE, 0) == NULL) {
		g_message("New song detected with tags missing (%s)",
				mpd_song_get_uri(song));
		g_timer_start(timer);
		return;
	}
	g_timer_start(timer);

	g_debug("New song detected (%s - %s), id: %u, pos: %u",
			mpd_song_get_tag(song, MPD_TAG_ARTIST, 0),
			mpd_song_get_tag(song, MPD_TAG_TITLE, 0),
			mpd_song_get_id(song), mpd_song_get_pos(song));

	as_now_playing(mpd_song_get_tag(song, MPD_TAG_ARTIST, 0),
			mpd_song_get_tag(song, MPD_TAG_TITLE, 0),
			mpd_song_get_tag(song, MPD_TAG_ALBUM, 0),
			mpd_song_get_tag(song, MPD_TAG_MUSICBRAINZ_TRACKID, 0),
			mpd_song_get_duration(song));
}
Example #2
0
static void song_changed(const struct mpd_song *song)
{
    g_message("new song detected (%s - %s), id: %u, pos: %u\n",
              mpd_song_get_tag(song, MPD_TAG_ARTIST, 0),
              mpd_song_get_tag(song, MPD_TAG_TITLE, 0),
              mpd_song_get_id(song), mpd_song_get_pos(song));

    g_timer_start(timer);

    as_now_playing(mpd_song_get_tag(song, MPD_TAG_ARTIST, 0),
                   mpd_song_get_tag(song, MPD_TAG_TITLE, 0),
                   mpd_song_get_tag(song, MPD_TAG_ALBUM, 0),
                   mpd_song_get_tag(song, MPD_TAG_TRACK, 0),
                   mpd_song_get_tag(song, MPD_TAG_MUSICBRAINZ_TRACKID, 0),
                   mpd_song_get_duration(song));
}