Esempio n. 1
0
        public async Task <SongResult> GetNowPlaying(bool lastFM)
        {
            ConnectIfNotConnected();

            var song   = GetCurrentSong();
            var status = GetStatus();

            using (var lastFMService = new LastFMService())
            {
                var result = new SongResult()
                {
                    Album           = song.Album,
                    AlbumUri        = null,
                    Artist          = song.Artist,
                    DurationSeconds = status.TimeTotal,
                    Loved           = false,
                    PlayedSeconds   = status.TimeElapsed,
                    Song            = song.Title,
                    Genre           = song.Genre
                };

                if (lastFM)
                {
                    result.Loved    = (await lastFMService.GetSongInfo(result.Artist, result.Song))?.IsLoved ?? false;
                    result.AlbumUri = (await lastFMService.GetAlbumInfo(result.Artist, result.Album))?.Images?.Large?.ToString();
                }

                return(result);
            }
        }
Esempio n. 2
0
        public async Task <PandoraResult> GetNowPlaying(bool lastFM)
        {
            ConnectIfNotConnected();

            var song   = GetCurrentSong();
            var status = GetStatus();

            var lastFMService = new LastFMService();

            var result = new PandoraResult
            {
                Album           = song.Album,
                AlbumUri        = null,
                Artist          = song.Artist,
                DurationSeconds = status.TimeTotal,
                Loved           = false,
                Song            = song.Title,
                Radio           = song.Genre
            };

            if (lastFM)
            {
                result.Loved    = (await lastFMService.GetSongInfo(result.Artist, result.Song))?.IsLoved ?? false;
                result.AlbumUri = (await lastFMService.GetAlbumInfo(result.Artist, result.Album))?.ImageUrl?.ToString();
            }

            return(result);
        }