Exemplo n.º 1
0
        private static string GetResponseMessage(
            string lastfmUsername,
            LastfmScrobble lastfmScrobble,
            string spotifyUrl)
        {
            string response;
            string encodedUsername = HttpUtility.HtmlEncode(lastfmUsername);

            if (lastfmScrobble.IsNowPlaying)
            {
                response = $"<i>{encodedUsername} is currently playing</i>\n";
            }
            else
            {
                response = $"<i>{encodedUsername} played</i>\n";
            }

            int?userPlayCount = lastfmScrobble.LastfmTrack.UserPlayCount;

            response += ResponseHelper.GetResponseForTrack(
                lastfmScrobble.LastfmTrack,
                spotifyUrl,
                userPlayCount);

            response += "\n";

            if (!lastfmScrobble.IsNowPlaying)
            {
                response += $"<i>on {GetTimePlayed(lastfmScrobble)}</i>";
            }

            return(response);
        }
Exemplo n.º 2
0
 private static string GetTimePlayed(LastfmScrobble track)
 => track.TimePlayed?.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss");