Ejemplo n.º 1
0
 private void ScrobbleCurrentTrack()
 {
     if (CanScrobbleCurrentTrack())
     {
         _scrobbler.ScrobbleAsync(_currentTrack, _currentDateTime.Get());
     }
 }
Ejemplo n.º 2
0
        public void Play(Track track)
        {
            if (_currentTrack != null)
            {
                if (CanScrobbleTrack(_playProgress.PreviousDuration, _playProgress.PreviousSecondsPlayed))
                {
                    _scrobbler.ScrobbleAsync(_currentTrack, _currentDateTime.Get());
                }
            }

            if (track != null)
            {
                _scrobbler.UpdateNowPlayingAsync(track, _playProgress.CurrentSecondsRemaining);
            }
            else
            {
                _scrobbler.UpdateNowPlayingAsync(_currentTrack, _scrobblingRules.MinimumUpdateNowPlayingDuration);
            }

            _currentTrack = track;
        }
Ejemplo n.º 3
0
        public async Task <bool> ScrobbleAsync(Track track, DateTime timePlayed)
        {
            if (!_userSettings.Scrobbling)
            {
                return(true);
            }

            var success = await _asyncMethodInterceptor.TryMethod(
                _scrobbler.ScrobbleAsync(track, timePlayed),
                false,
                WebServiceType.LastFm,
                "ScrobbleAsync (Track: " + track.Title + " by " + track.Artist.Name + ")");

            if (!success)
            {
                _scrobbleCacher.Cache(track, timePlayed);
            }
            else
            {
                await ScrobbleCachedTracks();
            }

            return(success);
        }