Beispiel #1
0
        public async Task <IEnumerable <ChannelItemInfo> > GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken)
        {
            var downloader = new SoundCloudListingDownloader(_logger, _jsonSerializer, _httpClient);
            var songs      = await downloader.GetTrackList(new InternalChannelItemQuery { FolderId = "latest", Limit = 6 }, cancellationToken).ConfigureAwait(false);

            return(songs.Select(i => new ChannelItemInfo
            {
                ContentType = ChannelMediaContentType.Song,
                ImageUrl = i.artwork_url,
                IsInfiniteStream = false,
                MediaType = ChannelMediaType.Audio,
                Name = i.title,
                Type = ChannelItemType.Media,
                Id = i.id.ToString(),
                RunTimeTicks = TimeSpan.FromMilliseconds(i.duration).Ticks,
                DateCreated = DateTime.Parse(i.created_at),

                MediaSources = new List <ChannelMediaInfo>
                {
                    new ChannelMediaInfo
                    {
                        Path = i.stream_url + "?client_id=78fd88dde7ebf8fdcad08106f6d56ab6"
                    }
                }
            }).OrderByDescending(i => i.DateCreated ?? DateTime.MinValue));
        }
        public async Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken)
        {
            var downloader = new SoundCloudListingDownloader(_logger, _jsonSerializer, _httpClient);
            var songs = await downloader.GetTrackList(new InternalChannelItemQuery {FolderId = "latest", Limit = 6}, cancellationToken).ConfigureAwait(false);

            return songs.Select(i => new ChannelItemInfo
            {
                ContentType = ChannelMediaContentType.Song,
                ImageUrl = i.artwork_url,
                IsInfiniteStream = false,
                MediaType = ChannelMediaType.Audio,
                Name = i.title,
                Type = ChannelItemType.Media,
                Id = i.id.ToString(),
                RunTimeTicks = TimeSpan.FromMilliseconds(i.duration).Ticks,
                DateCreated = DateTime.Parse(i.created_at),

                MediaSources = new List<ChannelMediaInfo>
                {
                    new ChannelMediaInfo
                    {
                        Path = i.stream_url + "?client_id=78fd88dde7ebf8fdcad08106f6d56ab6"
                    }
                }
            }).OrderByDescending(i => i.DateCreated ?? DateTime.MinValue);
        }