예제 #1
0
        public async Task <bool> LrcAutoSearch()
        {
            LrcMissing        = false;
            LrcSearchBusy     = true;
            _presenter.Lyrics = null;
            var _ttitle  = _title;
            var _tartist = _artist;

            LrcCandidates = new ObservableCollection <ExternalLrcInfo>();
            ParsedLrc lrc = null;

            try
            {
                lrc = await LyricsAgent.FetchLyricsAsync(
                    _title, _artist, _candidates,
                    LyricsAgent.BuildLyricsFilename(_title, _artist));
            }
            catch
            {
            }
            if (_ttitle == _title && _tartist == _artist)
            {
                _presenter.Lyrics = lrc;
                LrcSearchBusy     = false;
                LrcMissing        = lrc == null || lrc.Sentences.Count == 0;
                return(true);
            }
            return(false);
        }
 public LyricManualSelectionViewModel(string title, string artist, IList <ExternalLrcInfo> candidates)
 {
     SearchCommand   = new RelayCommand(Search);
     LyricCandidates = new ObservableCollection <ExternalLrcInfo>();
     _cacheName      = LyricsAgent.BuildLyricsFilename(title, artist);
     _originalTitle  = title;
     _originalArtist = artist;
     Title           = title;
     Artist          = artist;
     LoadData(candidates);
 }
        public async Task <ParsedLrc> DownloadAsync()
        {
            var candidate = LyricCandidates[SelectedIndex];

            return(await LyricsAgent.FetchLyricsAsync(candidate, LyricsAgent.BuildLyricsFilename(_originalTitle, _originalArtist)));
        }