Ejemplo n.º 1
0
        private async Task PrepareTrackAsync(Track track)
        {
            switch (track.Status)
            {
            case TrackStatus.Matching:
                throw new AppException("Track is still matching.");

            case TrackStatus.NoMatch:
                throw new AppException("No match found for track, try manual matching it.");

            case TrackStatus.NotAvailable:
                throw new AppException("The audio file is not available.");
            }

            if (track.Type == TrackType.Stream &&
                track.AudioWebUri == null)
            {
                using (var blocker = new UiBlocker())
                {
                    blocker.UpdateProgress("Matching...");
                    var uri = await _matchEngineService.GetLinkAsync(track.Title, track.DisplayArtist);

                    if (uri == null)
                    {
                        throw new AppException("Problem matching the song, try saving and manual matching it.");
                    }
                    track.AudioWebUri = uri.ToString();
                }
            }
        }
Ejemplo n.º 2
0
        private async Task <Track> ConvertToTrackAsync(WebSong webSong)
        {
            var track = webSong.PreviousConversion as Track;

            if (track == null)
            {
                using (var blocker = new UiBlocker())
                {
                    blocker.UpdateProgress("Getting data...");
                    track = await _webSongConverter.ConvertAsync(webSong);
                }
            }
            return(track);
        }