private async Task <IEnumerable <ChannelItemInfo> > FindChannelItemInfos(FolderId folderId, CancellationToken cancellationToken) { switch (folderId.FolderIdType) { case FolderIdType.Home: return(await _touTvProvider.GetTypesOfMedia(cancellationToken)); case FolderIdType.Section: return(await _touTvProvider.GetShows(folderId.Id, cancellationToken)); case FolderIdType.Show: return(await _touTvProvider.GetShowEpisodes(folderId.Id, cancellationToken)); default: _logger.Error("Unknown FolderIdType" + folderId.FolderIdType); return(Enumerable.Empty <ChannelItemInfo>()); } }
private ChannelItemInfo CreateChannelItemInfo(EmissionDTO show) { var folderId = FolderId.CreateShowFolderId(show.Id); return(new ChannelItemInfo { FolderType = ChannelFolderType.Container, Genres = new List <string> { show.Genre.Title }, Id = folderId.ToString(), ImageUrl = GetShowImageUrl(show.CategoryURL), Name = show.Title, Overview = show.Description, ProductionYear = Convert.ToInt32(show.Year), Type = ChannelItemType.Folder, }); }
public static FolderId ParseFolderId(string folderId) { if (string.IsNullOrEmpty(folderId)) { return new FolderId(FolderIdType.Home); } var match = Regex.Match(folderId, "(?<type>.*?)-(?<id>.*)?"); if (match.Success) { FolderIdType type; if (Enum.TryParse(match.Groups["type"].Value, out type)) { var result = new FolderId(type); var id = match.Groups["id"]; if (id != null) { result.Id = id.Value; } return result; } } throw new ArgumentException("Argument format is not recognized. Only pass string which have been returned by FolderId.ToString().", "folderId"); }
public static FolderId ParseFolderId(string folderId) { if (string.IsNullOrEmpty(folderId)) { return(new FolderId(FolderIdType.Home)); } var match = Regex.Match(folderId, "(?<type>.*?)-(?<id>.*)?"); if (match.Success) { FolderIdType type; if (Enum.TryParse(match.Groups["type"].Value, out type)) { var result = new FolderId(type); var id = match.Groups["id"]; if (id != null) { result.Id = id.Value; } return(result); } } throw new ArgumentException("Argument format is not recognized. Only pass string which have been returned by FolderId.ToString().", "folderId"); }
private async Task <IEnumerable <ChannelItemInfo> > FindChannelItemInfos(FolderId folderId) { switch (folderId.FolderIdType) { case FolderIdType.Home: return(CreateHomeFolders()); case FolderIdType.Genres: return(await _touTvProvider.GetGenres()); case FolderIdType.Genre: return(await _touTvProvider.GetGenreShows(folderId.Id)); case FolderIdType.Shows: return(await _touTvProvider.GetShows()); case FolderIdType.Show: return(await _touTvProvider.GetShowEpisodes(folderId.Id)); default: _logger.Error("Unknown FolderIdType" + folderId.FolderIdType); return(Enumerable.Empty <ChannelItemInfo>()); } }
private async Task<IEnumerable<ChannelItemInfo>> FindChannelItemInfos(FolderId folderId, CancellationToken cancellationToken) { switch (folderId.FolderIdType) { case FolderIdType.Home: return await _touTvProvider.GetTypesOfMedia(cancellationToken); case FolderIdType.Section: return await _touTvProvider.GetShows(folderId.Id, cancellationToken); case FolderIdType.Show: return await _touTvProvider.GetShowEpisodes(folderId.Id, cancellationToken); default: _logger.Error("Unknown FolderIdType" + folderId.FolderIdType); return Enumerable.Empty<ChannelItemInfo>(); } }
private static ChannelItemInfo CreateFolderChannelItemInfo(string name, string imageUrl, FolderId folderId) { return(new ChannelItemInfo { FolderType = ChannelFolderType.Container, Id = folderId.ToString(), ImageUrl = imageUrl, Name = name, Type = ChannelItemType.Folder }); }