コード例 #1
0
        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>());
            }
        }
コード例 #2
0
        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,
            });
        }
コード例 #3
0
ファイル: FolderId.cs プロジェクト: algel/Emby.Channels
 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");
 }
コード例 #4
0
        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");
        }
コード例 #5
0
        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>());
            }
        }
コード例 #6
0
ファイル: TouTvChannel.cs プロジェクト: algel/Emby.Channels
 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>();
     }
 }
コード例 #7
0
 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
     });
 }