Exemple #1
0
        public Task <ZanmaiSongInfo> ConvertToZanmaiSongInfoAsync(ISongSearchResult songSearchResult, CancellationToken cancellationToken = default)
        {
            if (songSearchResult is ZanmaiSongSearchResult zanmaiSongSearchResult)
            {
                var result = zanmaiSongSearchResult.SongListItem.SongInfo;
                return(Task.FromResult(result));
            }

            throw new ArgumentException($"Unsupported result type.", nameof(songSearchResult));
        }
Exemple #2
0
        public Task <ZanmaiSongInfo> ConvertToZanmaiSongInfoAsync(ISongSearchResult songSearchResult, CancellationToken cancellationToken = default)
        {
            if (songSearchResult == null)
            {
                throw new ArgumentNullException(nameof(songSearchResult));
            }

            return(this.Providers.TryGetValue(songSearchResult.ProviderId, out var provider)
                                ? provider.ConvertToZanmaiSongInfoAsync(songSearchResult, cancellationToken)
                                : throw new ArgumentException("Unsupported provider ID.", nameof(songSearchResult)));
        }
Exemple #3
0
        public override async Task <ZanmaiSongInfo> ConvertToZanmaiSongInfoAsync(
            ISongSearchResult songSearchResult,
            CancellationToken cancellationToken = default)
        {
            if (songSearchResult is AnisonDbNameSongSearchResult result)
            {
                var info = new ZanmaiSongInfo
                {
                    Title    = result.Title,
                    Series   = result.Series,
                    Genre    = result.Genre,
                    Artists  = result.Artists,
                    SongType = this.CheckSeries ? await this.FindActualSongTypeAsync(result, cancellationToken).ConfigureAwait(false) : result.SongType
                };

                return(this.SongInfoConverter.Convert(info));
            }
            else
            {
                throw new ArgumentException("unsupported result type.", nameof(songSearchResult));
            }
        }
 public abstract Task <ZanmaiSongInfo> ConvertToZanmaiSongInfoAsync(ISongSearchResult songSearchResult, CancellationToken cancellationToken = default);