コード例 #1
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            //ChannelItemResult result;

            _logger.Debug("cat ID : " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetMainMenu(cancellationToken).ConfigureAwait(false);
            }

            var catSplit = query.FolderId.Split('_');

            if (catSplit[0] == "subvideo")
            {
                query.FolderId = catSplit[1];
                return await GetVideos(query, cancellationToken).ConfigureAwait(false);
            }

            if (catSplit[0] == "submenu")
            {
                query.FolderId = catSplit[1];
                return await GetSubMenu(query, cancellationToken).ConfigureAwait(false);
            }

            if (catSplit[0] == "showmenu")
            {
                return await GetShowMenu(cancellationToken).ConfigureAwait(false);
            }

            return null;
        }
コード例 #2
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            
            _logger.Debug("cat ID : " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetChannels(query, cancellationToken).ConfigureAwait(false);
            }

            var catSplit = query.FolderId.Split('_');

            query.FolderId = catSplit[1];
            /*if (catSplit[0] == "channels")
            {
                return await GetChannels(query, cancellationToken).ConfigureAwait(false);
            }*/

            if (catSplit[0] == "videos")
            {
                return await GetVideos(query, cancellationToken).ConfigureAwait(false);
            }

            return null;
        }
コード例 #3
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            if (query.FolderId == null)
            {
                return await GetChannels(cancellationToken).ConfigureAwait(false);
            }

            var catSplit = query.FolderId.Split('_');
            

            if (catSplit[0] == "cat")
            {
                query.FolderId = catSplit[1];
                return await GetTracks(query, cancellationToken).ConfigureAwait(false);
            }
            if (catSplit[0] == "myPlaylists")
            {
                return await GetPlayLists(query, cancellationToken).ConfigureAwait(false);
            }
            if (catSplit[0] == "playlist")
            {
                query.FolderId = catSplit[1];
                return await GetPlayListTracks(Convert.ToInt32(query.FolderId), query, cancellationToken).ConfigureAwait(false);
            }

            return null;
        }
コード例 #4
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            _logger.Debug("cat ID : " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetMainMenu(cancellationToken).ConfigureAwait(false);
            }

            var folderID = query.FolderId.Split(new[] { "!_" }, StringSplitOptions.None);
            query.FolderId = folderID[1];

            if (folderID[0] == "shows")
            {
                return await GetShowList(query, cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "category")
            {
                return await GetCategoryList(query, cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "video")
            {
                return await GetVideoList(query, cancellationToken).ConfigureAwait(false);
            }
            return null;
        }
コード例 #5
0
ファイル: UStreamChannel.cs プロジェクト: algel/Emby.Channels
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            ChannelItemResult result;

            _logger.Debug("cat ID : " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetCategories(cancellationToken).ConfigureAwait(false);
            }
            else
            {
                var folderID = query.FolderId.Split('_');
                query.FolderId = folderID[1];

                if (folderID[0] == "subcat")
                {
                    return await GetSubCategories(query, cancellationToken).ConfigureAwait(false);
                }
                if (folderID[0] == "streams")
                {
                    query.FolderId = folderID[2];
                    return await GetStreams(folderID[1], query, cancellationToken).ConfigureAwait(false);
                }
            }

            return null;
        }
コード例 #6
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            _logger.Debug("cat ID : " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetMainMenu(cancellationToken).ConfigureAwait(false);
            }

            var folderID = query.FolderId.Split('_');
            query.FolderId = folderID[1];

            if (folderID[0] == "programs")
            {
                return await GetProgramList(query, cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "episodes")
            {
                query.SortDescending = true;
                query.SortBy = ChannelItemSortField.PremiereDate;
                return await GetEpisodeList(query, cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "genres")
            {
                return await GetGenreList(query, cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "tvchannels")
            {
                return await GetTVChannelList(query, cancellationToken).ConfigureAwait(false);
            }

            return null;
        }
コード例 #7
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(query.CategoryId))
            {
                return await GetCategories(query, cancellationToken).ConfigureAwait(false);
            }

            var catSplit = query.CategoryId.Split('_');
            query.CategoryId = catSplit[1];
            
            if (catSplit[0] == "cat")
            {
                return await GetSubCategories(query, cancellationToken).ConfigureAwait(false);
            } 
            
            if (catSplit[0] == "subcat")
            {
                if (catSplit[1] == "allVideos")
                {
                    query.CategoryId = catSplit[2];
                    return await GetChannelItemsInternal(query, cancellationToken).ConfigureAwait(false);
                }
                return await GetChannels(query, cancellationToken).ConfigureAwait(false);
            }

            return await GetChannelItemsInternal(query, cancellationToken).ConfigureAwait(false);
        }
コード例 #8
0
ファイル: TouTvChannel.cs プロジェクト: algel/Emby.Channels
 public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
 {
     var folderId = FolderId.ParseFolderId(query.FolderId);
     var channelItemInfos = await FindChannelItemInfos(folderId, cancellationToken);
     return new ChannelItemResult
     {
         Items = channelItemInfos.ToList()
     };
 }
コード例 #9
0
 public async Task<RootObject> GetEpisodeList(int offset, InternalChannelItemQuery query, CancellationToken cancellationToken)
 {
     using (var json = await _httpClient.Get(
         String.Format("http://revision3.com/api/getEpisodes.json?api_key=0b1faede6785d04b78735b139ddf2910f34ad601&show_id={0}&offset={1}&limit={2}",
         query.FolderId, offset, query.Limit), CancellationToken.None).ConfigureAwait(false))
     {
         return _jsonSerializer.DeserializeFromStream<RootObject>(json);
     }
 }
コード例 #10
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var items = await GetChannelItems(cancellationToken).ConfigureAwait(false);

            return new ChannelItemResult
            {
                Items = items.ToList(),
                CacheLength = TimeSpan.FromDays(3)
            };
        }
コード例 #11
0
ファイル: StreamsChannel.cs プロジェクト: algel/Emby.Channels
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var folderProvider = _mediaProviderFactory.GetFolderProvider(query.FolderId);
            var channelMediaInfos = await folderProvider.GetFolders(query.FolderId, cancellationToken);

            return new ChannelItemResult
            {
                Items = channelMediaInfos.ToList()
            };
        }
コード例 #12
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var items = await GetChannelItems(cancellationToken).ConfigureAwait(false);

            if (query.SortBy.HasValue)
            {
                if (query.SortDescending)
                {
                    switch (query.SortBy.Value)
                    {
                        case ChannelItemSortField.Runtime:
                            items = items.OrderByDescending(i => i.RunTimeTicks ?? 0);
                            break;
                        case ChannelItemSortField.PremiereDate:
                            items = items.OrderByDescending(i => i.PremiereDate ?? DateTime.MinValue);
                            break;
                        case ChannelItemSortField.DateCreated:
                            items = items.OrderByDescending(i => i.DateCreated ?? DateTime.MinValue);
                            break;
                        case ChannelItemSortField.CommunityRating:
                            items = items.OrderByDescending(i => i.CommunityRating ?? 0);
                            break;
                        default:
                            items = items.OrderByDescending(i => i.Name);
                            break;
                    }
                }
                else
                {
                    switch (query.SortBy.Value)
                    {
                        case ChannelItemSortField.Runtime:
                            items = items.OrderBy(i => i.RunTimeTicks ?? 0);
                            break;
                        case ChannelItemSortField.PremiereDate:
                            items = items.OrderBy(i => i.PremiereDate ?? DateTime.MinValue);
                            break;
                        case ChannelItemSortField.DateCreated:
                            items = items.OrderBy(i => i.DateCreated ?? DateTime.MinValue);
                            break;
                        case ChannelItemSortField.CommunityRating:
                            items = items.OrderBy(i => i.CommunityRating ?? 0);
                            break;
                        default:
                            items = items.OrderBy(i => i.Name);
                            break;
                    }
                }
            }

            return new ChannelItemResult
            {
                Items = items.ToList()
            };
        }
コード例 #13
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            _logger.Debug("cat ID : " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetChannels(cancellationToken).ConfigureAwait(false);
            }

            return await GetChannelItemsInternal(query, cancellationToken).ConfigureAwait(false);
        }
コード例 #14
0
        public async Task<Channels> GetVimeoChannelList(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            int? page = null;

            if (query.StartIndex.HasValue && query.Limit.HasValue)
            {
                page = 1 + (query.StartIndex.Value / query.Limit.Value) % query.Limit.Value;
            }

            var channels = Plugin.vc.vimeo_categories_getRelatedChannels(query.CategoryId,page: page, per_page: query.Limit);
            return channels;
        }
コード例 #15
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            _logger.Debug("Category ID " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetMainMenu(cancellationToken).ConfigureAwait(false);
            }

            var channel = query.FolderId.Split('_');

            if (channel[0] == "videos")
            {
                return await GetVideoArtistSubMenu("video", "nogenre", cancellationToken);
            }

            if (channel[0] == "genres")
            {
                return await AllGenresMenu(cancellationToken);
            }
            if (channel[0] == "genre")
            {
                return await GenresSubMenu(channel[1], cancellationToken);
            }

            if (channel[0] == "artists")
            {
                return await GetVideoArtistSubMenu("artistList", "nogenre", cancellationToken);
            }
            if (channel[0] == "artistList")
            {
                return await GetArtistListing(channel[1], channel[2], query, cancellationToken);
            }


            if (channel[0] == "artist" || channel[0] == "video")
            {
                var i = 
                    await
                        GetVideoListing((channel[0] == "artist" ? "artist" : "video"), channel[1], channel[2], query,
                            cancellationToken).ConfigureAwait(false);
                return new ChannelItemResult
                {
                    Items = i.ToList(),
                    TotalRecordCount = i.Count()
                };
            }

            return null;
        }
コード例 #16
0
        public async Task<RootObject> GetEpisodeList(int offset, InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var options = new HttpRequestOptions
            {
                Url = String.Format("http://revision3.com/api/getEpisodes.json?api_key=0b1faede6785d04b78735b139ddf2910f34ad601&show_id={0}&offset={1}&limit={2}", query.FolderId, offset, query.Limit),
                CancellationToken = cancellationToken,
                // Seeing errors about block length with this enabled
                EnableHttpCompression = false
            };

            using (var json = await _httpClient.SendAsync(options, "GET").ConfigureAwait(false))
            {
                return _jsonSerializer.DeserializeFromStream<RootObject>(json.Content);
            }
        }
コード例 #17
0
ファイル: TuneInChannel.cs プロジェクト: algel/Emby.Channels
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var items = new List<ChannelItemInfo>();

            _logger.Debug("Category ID " + query.FolderId);

            if (query.FolderId == null)
            {
                items = await GetMenu("", query, cancellationToken).ConfigureAwait(false);
                
                if (Plugin.Instance.Configuration.Username != null)
                {
                    items.Add(new ChannelItemInfo
                    {
                        Name = "My Favorites",
                        Id = "preset_",
                        Type = ChannelItemType.Folder,
                        ImageUrl = GetDefaultImages("My Favorites")
                    });
                }
            }
            else
            {
                var channelID = query.FolderId.Split('_');


                if (channelID[0] == "preset")
                {
                    items = await GetPresets(query, cancellationToken);
                }
                else
                {
                    query.FolderId = channelID[1].Replace("&amp;", "&");

                    if (channelID.Count() > 2)
                    {
                        items = await GetMenu(channelID[2], query, cancellationToken).ConfigureAwait(false);
                    }
                    else
                        items = await GetMenu("", query, cancellationToken).ConfigureAwait(false);
                }
            }

            return new ChannelItemResult()
            {
                Items = items
            };
        }
コード例 #18
0
        public async Task<Channels> GetPersonalChannelList(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
             int? page = null;

            if (query.StartIndex.HasValue && query.Limit.HasValue)
            {
                page = 1 + (query.StartIndex.Value / query.Limit.Value) % query.Limit.Value;
            }

            var pChannels = Plugin.vc.vimeo_people_getSubscriptions(false, false, false, true, false);
            
            var channels = new Channels();
            channels.AddRange(from pchan in pChannels where pchan.subject_id != "778" && pchan.subject_id != "927" select Plugin.vc.vimeo_channels_getInfo(pchan.subject_id));

            return channels;
        }
コード例 #19
0
        public async Task<List<RootObject>> GetTrackList(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            // need to get this working. Its not returning a limit or a start index value? ...
            var url = "";
            var offset = query.StartIndex.GetValueOrDefault();

            var limit = query.Limit.HasValue ? query.Limit.Value : 50;

            if (query.FolderId == "hot")
                url = "http://api.soundcloud.com/tracks.json?client_id=78fd88dde7ebf8fdcad08106f6d56ab6&filter=streamable&limit=" + limit + "&order=hotness&offset=" + offset;
            if (query.FolderId == "latest")
                url = "http://api.soundcloud.com/tracks.json?client_id=78fd88dde7ebf8fdcad08106f6d56ab6&filter=streamable&limit=" + limit + "&order=created_at&offset=" + offset;

            using (var json = await _httpClient.Get(url, CancellationToken.None).ConfigureAwait(false))
            {
                return _jsonSerializer.DeserializeFromStream<List<RootObject>>(json);
            }
        }
コード例 #20
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            _logger.Debug("Category ID " + query.FolderId);

            if (query.FolderId == null)
            {
                return await GetMenu("", query, cancellationToken).ConfigureAwait(false);
            }

            var channelID = query.FolderId.Split('_');
            
            query.FolderId = channelID[1].Replace("&amp;", "&");
            
            if (channelID.Count() > 2)
            {
                return await GetMenu(channelID[2], query, cancellationToken).ConfigureAwait(false);
            }
                    
            return await GetMenu("", query, cancellationToken).ConfigureAwait(false); 
        }
コード例 #21
0
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            IEnumerable<ChannelItemInfo> items;

            _logger.Debug("cat ID : " + query.CategoryId);

            if (query.CategoryId == null)
            {
                items = await GetChannels(cancellationToken).ConfigureAwait(false);
            }
            else
            {
                items = await GetChannelItems(query.CategoryId, cancellationToken).ConfigureAwait(false);
            }

            return new ChannelItemResult
            {
                Items = items.ToList(),
                CacheLength = TimeSpan.FromDays(3)
            };
        }
コード例 #22
0
        private async Task<ChannelItemResult> GetChannelsInternal(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var offset = query.StartIndex.GetValueOrDefault();
            var downloader = new TwitchChannelDownloader(_logger, _jsonSerializer, _httpClient);
            var channels = await downloader.GetTwitchChannelList(offset, cancellationToken);

            var items = channels.top.OrderByDescending(x => x.viewers)
                .Select(i => new ChannelItemInfo
            {
                Type = ChannelItemType.Folder,
                ImageUrl = i.game.box.large,
                Name = i.game.name,
                Id = i.game.name,
                CommunityRating = Convert.ToSingle(i.viewers),
            });

            return new ChannelItemResult
            {
                Items = items.ToList(),
                TotalRecordCount = channels._total
            };
        }
コード例 #23
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var menu = new MenuSystem(_httpClient, _jsonSerializer, _logger);

            _logger.Debug("cat ID : " + query.FolderId);

            if (query.FolderId == null)
            {
                return await menu.GetMainMenu(cancellationToken).ConfigureAwait(false);
            }
            
            var folderID = query.FolderId.Split('_');
            query.FolderId = folderID[1];

            if (folderID[0] == "video")
            {
                return await GetVideos(query, cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "tvChannels")
            {
                return await menu.GetTVChannels(cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "categories")
            {
                return await menu.GetCategories("", "", cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "category")
            {

                return await menu.GetCategory(query.FolderId, "", cancellationToken).ConfigureAwait(false);
            }
            if (folderID[0] == "a-z")
            {
                return await menu.GetAToZ(cancellationToken).ConfigureAwait(false);
            }
            

            return null;
        }
コード例 #24
0
        private async Task<ChannelItemResult> GetChannelItemsInternal(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var offset = query.StartIndex.GetValueOrDefault();
            var downloader = new TwitchListingDownloader(_logger, _jsonSerializer, _httpClient);
            var videos = await downloader.GetStreamList(query.FolderId, offset, cancellationToken)
                .ConfigureAwait(false);

            var items = videos.streams.OrderByDescending(x => x.viewers)
                .Select(i => new ChannelItemInfo
            {
                ContentType = ChannelMediaContentType.Clip,
                ImageUrl = i.preview.large,
                IsInfiniteStream = true,
                MediaType = ChannelMediaType.Video,
                Name = i.channel.name,
                Id = i.channel.name,
                Type = ChannelItemType.Media,
                CommunityRating = Convert.ToSingle(i.viewers),
                DateCreated = !String.IsNullOrEmpty(i.channel.created_at) ? 
                    Convert.ToDateTime(i.channel.created_at) : (DateTime?)null,
                Overview = i.channel.status,
            });

            return new ChannelItemResult
            {
                Items = items.ToList(),
                TotalRecordCount = videos._total
            };
        }
コード例 #25
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        // Add when more menus needed
        /*private async Task<ChannelItemResult> GetMainMenu(CancellationToken cancellationToken)
        {
            var items = new List<ChannelItemInfo>
            {
                new ChannelItemInfo
                {
                    Name = "Featured Channels",
                    Id = "channels_" + "https://api.vineapp.com/channels/featured",
                    Type = ChannelItemType.Folder
                }
            };

            return new ChannelItemResult
            {
                Items = items.ToList()
            };
        }*/

        private async Task<ChannelItemResult> GetChannels(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var items = new List<ChannelItemInfo>();

            using (var site = await _httpClient.Get("https://api.vineapp.com/channels/featured", CancellationToken.None).ConfigureAwait(false))
            {
                var channelList = _jsonSerializer.DeserializeFromStream<ChannelList>(site);

                foreach (var c in channelList.data.records)
                {
                    items.Add(new ChannelItemInfo
                    {
                        Name = c.channel,
                        Id = "videos_" + c.channelId,
                        ImageUrl = c.exploreIconFullUrl,
                        Type = ChannelItemType.Folder
                    });
                }
            }

            return new ChannelItemResult
            {
                Items = items.ToList()
            };
        }
コード例 #26
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        private async Task<ChannelItemResult> GetEpisodeList(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var page = new HtmlDocument();
            var items = new List<ChannelItemInfo>();

            using (var site = await _httpClient.Get(query.FolderId, CancellationToken.None).ConfigureAwait(false))
            {
                page.Load(site);

                var nodes = page.DocumentNode.SelectNodes("//div[@class='view-content']/div[@class='views-row']");

                // Cant find multiple episodes so means only one episode in program so look at main video on page
                if (nodes == null)
                    nodes = page.DocumentNode.SelectNodes("//div[@class='hero']");

                if (nodes != null)
                {
                    foreach (var node in nodes)
                    {
                        var id = query.FolderId;
                        if (node.SelectSingleNode(".//div[contains(@class, 'node-episode')]/a[1]") != null)
                            id = node.SelectSingleNode(".//div[contains(@class, 'node-episode')]/a[1]").Attributes["href"].Value;
                        else if (node.SelectSingleNode("./a") != null)
                            id = node.SelectSingleNode("./a[1]").Attributes["href"].Value;

                        var title = "Unknown";
                        if (node.SelectSingleNode("//h2[@class='title episode-title']") != null)
                            title = node.SelectSingleNode("//h2[@class='title episode-title']").InnerText.Replace("&#039;", "'");
                        else if (node.SelectSingleNode(".//div[@class='programme-title']//text()") != null)
                            title = node.SelectSingleNode(".//div[@class='programme-title']//text()").InnerText.Replace("&#039;", "'");
                      
                        var seasonNumber = "";
                        if (node.SelectSingleNode(".//div[contains(@class, 'field-name-field-season-number')]//text()") != null)
                            seasonNumber = node.SelectSingleNode(".//div[contains(@class, 'field-name-field-season-number')]//text()").InnerText;
                       
                        var episodeNumber = "";
                        if (node.SelectSingleNode(".//div[contains(@class, 'field-name-field-episode-number')]//text()") != null)
                            episodeNumber = node.SelectSingleNode(".//div[contains(@class, 'field-name-field-episode-number')]//text()").InnerText;

                        var overview = "";
                        if (node.SelectSingleNode(".//div[contains(@class,'field-name-field-short-synopsis')]//text()") != null)
                            overview = node.SelectSingleNode(".//div[contains(@class,'field-name-field-short-synopsis')]//text()").InnerText;

                        var thumb = "";
                        if (node.SelectSingleNode(".//div[contains(@class,'field-name-field-image')]//img") != null)
                            thumb = node.SelectSingleNode(".//div[contains(@class,'field-name-field-image')]//img").Attributes["src"].Value;
                        else if (node.SelectSingleNode(".//param[@name='poster']") != null)
                            thumb = node.SelectSingleNode(".//param[@name='poster']").Attributes["value"].Value;

                        var date = "";
                        if (node.SelectSingleNode(".//span[contains(@class,'date-display-single')]") != null)
                            date = node.SelectSingleNode(".//span[contains(@class,'date-display-single')]").Attributes["content"].Value;
                        
                        // TODO : FIX ME !
                        var durText = node.SelectSingleNode(".//div[contains(@class,'field-name-field-duration')]//div[contains(@class, 'field-item')]").InnerText;

                        var hour = 0;
                        var hourNode = Regex.Match(durText, "([1-9][0-9]*) hour");
                        if (hourNode.Success)
                        {
                            hour = Convert.ToInt16(hourNode.Groups[0].Value.Replace(" hour", "")) * 60;
                        }

                        var minute = 0;
                        var minuteNode = Regex.Match(durText, "([1-9][0-9]*) minute");
                        if (minuteNode.Success)
                        {
                            minute = Convert.ToInt16(minuteNode.Groups[0].Value.Replace(" minute", ""));
                        }

                        items.Add(new ChannelItemInfo
                        {
                            Name = title + " (Season: " + seasonNumber + ", Ep: " + episodeNumber + ")",

                            ImageUrl = thumb != "" ? thumb.Replace("player_image_thumb_standard", "posterframe") : "",
                            Id = "http://www.itv.com" + id,
                            Overview = overview,
                            Type = ChannelItemType.Media,
                            ContentType = ChannelMediaContentType.Episode,
                            IsInfiniteStream = false,
                            MediaType = ChannelMediaType.Video,
                            PremiereDate = date != "" ? DateTime.Parse(date) : DateTime.MinValue,
                            RunTimeTicks = TimeSpan.FromMinutes(hour + minute).Ticks
                        });
                    }

                    items = items.OrderByDescending(i => i.PremiereDate).ToList();
                }
                else
                {
                    // No Episodes Found! Return Error
                }

            }

            return new ChannelItemResult
            {
                Items = items.ToList()
            };
        }
コード例 #27
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        private async Task<ChannelItemResult> GetVideos(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var items = new List<ChannelItemInfo>();
            TimelineList timelineList;
            using (var site = await _httpClient.Get(String.Format("https://api.vineapp.com/timelines/channels/{0}/popular?size={1}", query.FolderId, query.Limit), CancellationToken.None).ConfigureAwait(false))
            {
                timelineList = _jsonSerializer.DeserializeFromStream<TimelineList>(site);

                foreach (var c in timelineList.data.records)
                {
                    items.Add(new ChannelItemInfo
                    {
                        Name = c.description,
                        Id = c.postId.ToString(),
                        ImageUrl = c.thumbnailUrl,
                        MediaType = ChannelMediaType.Video,
                        ContentType = ChannelMediaContentType.Clip,
                        Type = ChannelItemType.Media,

                        MediaSources = new List<ChannelMediaInfo>
                        {
                            new ChannelMediaInfo
                            {
                                Path = c.videoUrl,
                                Container = Container.MP4
                            },
                            new ChannelMediaInfo
                            {
                                Path = c.videoLowURL,
                                Container = Container.MP4
                            },
                        }
                    });
                }
            }

            items = items.OrderByDescending(i => i.DateCreated).ToList();

            return new ChannelItemResult
            {
                Items = items.ToList()
            };
        }
コード例 #28
0
ファイル: SvtPlayChannel.cs プロジェクト: algel/Emby.Channels
        public async Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, System.Threading.CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(query.FolderId))
            {
                var menu = await GetMenu("/");
                return new ChannelItemResult { Items = menu, TotalRecordCount = menu.Count };
            }
            else
            {
                _logger.Info("Received query:{0}", query.FolderId);
                var properties = query.FolderId.Split('_');


                List<ChannelItemInfo> items = new List<ChannelItemInfo>();
                if (properties.Length == 1)
                {
                    items = await GetMenu(properties[0]);
                }
                else
                {
                    items = await GetChildren(properties[0], properties[1], cancellationToken);
                }
                var total = items.Count;

                if (query.StartIndex > 0 && query.StartIndex < items.Count)
                {
                    items.RemoveRange(0, query.StartIndex.Value);
                }

                if (query.Limit.HasValue && items.Count > query.Limit)
                {
                    int toMany = items.Count - query.Limit.Value;
                    items.RemoveRange(query.Limit.Value, toMany - 1);
                }

                return new ChannelItemResult { Items = items, TotalRecordCount = total };
            }
        }
コード例 #29
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        private async Task<ChannelItemResult> GetDateList(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var items = new List<ChannelItemInfo>
            {
                new ChannelItemInfo
                {
                    Name = "Today",
                    Id = "date_" + "https://www.itv.com/itvplayer/by-day/today",
                    Type = ChannelItemType.Folder
                },
                new ChannelItemInfo
                {
                    Name = "Yesturday",
                    Id = "date_" + "https://www.itv.com/itvplayer/by-day/yesturday",
                    Type = ChannelItemType.Folder
                }
            };

            var today = DateTime.Now;

            for (int i = 0; i < 31; i++)
            {
                var d = today.AddDays(-i);
                items.Add(new ChannelItemInfo
                {
                    Name = d.ToString("ddd, d MMM yyyy"),
                    Id = "date_" + "https://www.itv.com/itvplayer/by-day/" + d.ToString("d-MMM-yyyy"),
                    Type = ChannelItemType.Folder
                });
            }

            return new ChannelItemResult
            {
                Items = items.ToList()
            };
        }
コード例 #30
0
ファイル: Channel.cs プロジェクト: algel/Emby.Channels
        private async Task<ChannelItemResult> GetTVChannelList(InternalChannelItemQuery query, CancellationToken cancellationToken)
        {
            var data = new Data();
            var items = new List<ChannelItemInfo>();

            foreach (var channel in data.TVChannel)
            {
                items.Add(new ChannelItemInfo
                {
                    Name = channel.name,
                    ImageUrl = channel.thumb,
                    Id = "programs_" + "https://www.itv.com/itvplayer/categories/" + channel.fname + "/popular/catch-up",
                    Type = ChannelItemType.Folder
                });
            }

            return new ChannelItemResult
            {
                Items = items.ToList()
            };
        }