Exemple #1
0
        public async Task <ChannelItemResult> GetAllMedia(InternalAllChannelMediaQuery query, CancellationToken cancellationToken)
        {
            var items = await GetAllItems(false, cancellationToken).ConfigureAwait(false);

            if (query.ContentTypes.Length > 0)
            {
                items = items.Where(i => query.ContentTypes.Contains(i.ContentType));
            }
            if (query.ExtraTypes.Length > 0)
            {
                items = items.Where(i => query.ExtraTypes.Contains(i.ExtraType));
            }
            if (query.TrailerTypes.Length > 0)
            {
                items = items.Where(i => i.TrailerTypes.Any(t => query.TrailerTypes.Contains(t)));
            }

            var list = items.ToList();

            return(new ChannelItemResult
            {
                Items = list,
                TotalRecordCount = list.Count
            });
        }
Exemple #2
0
        private async Task <ChannelItemResult> GetAllMedia(InternalAllChannelMediaQuery query, CancellationToken cancellationToken)
        {
            if (query.ContentTypes.Length > 0 && !query.ContentTypes.Contains(ChannelMediaContentType.Podcast))
            {
                return(new ChannelItemResult());
            }

            string[] urls =
            {
                "http://www.jupiterbroadcasting.com/feeds/FauxShowHD.xml",
                "http://feeds.feedburner.com/scibytehd",
                "http://www.jupiterbroadcasting.com/feeds/unfilterHD.xml",
                "http://feeds.feedburner.com/techsnaphd",
                "http://feeds.feedburner.com/HowtoLinuxHd",
                "http://feeds.feedburner.com/BsdNowHd",
                "http://feeds.feedburner.com/linuxashd",
                "http://feeds.feedburner.com/linuxunvid",
                "http://feeds.feedburner.com/coderradiovideo",
                "http://feedpress.me/t3mob",
                "http://feeds.feedburner.com/wtrmobile"
            };

            var tasks = urls.Select(async i =>
            {
                try
                {
                    return(await GetChannelItemsInternal(i, cancellationToken).ConfigureAwait(false));
                }
                catch (Exception ex)
                {
                    _logger.Info("Failed to fetch the latest episodes: " + ex);
                    return(new List <ChannelItemInfo>());
                }
            });

            var items = (await Task.WhenAll(tasks).ConfigureAwait(false))
                        .SelectMany(i => i);

            if (query.ContentTypes.Length > 0)
            {
                items = items.Where(i => query.ContentTypes.Contains(i.ContentType));
            }

            var all = items.ToList();

            return(new ChannelItemResult
            {
                Items = all,
                TotalRecordCount = all.Count
            });
        }
Exemple #3
0
        public async Task <ChannelItemResult> GetAllMedia(InternalAllChannelMediaQuery query, CancellationToken cancellationToken)
        {
            if (query.ContentTypes.Length > 0 && !query.ContentTypes.Contains(ChannelMediaContentType.Podcast))
            {
                return(new ChannelItemResult());
            }

            var tasks = Plugin.Instance.Configuration.Feeds.Select(async i =>
            {
                try
                {
                    return(await GetChannelItemsInternal(i, cancellationToken).ConfigureAwait(false));
                }
                catch (Exception ex)
                {
                    _notificationManager.SendNotification(new NotificationRequest
                    {
                        Description    = "Error getting channel items" + ex,
                        Date           = DateTime.Now,
                        Level          = NotificationLevel.Error,
                        SendToUserMode = SendToUserType.Admins
                    }, cancellationToken);

                    Plugin.Logger.ErrorException("Error getting channel items", ex);

                    return(new List <ChannelItemInfo>());
                }
            });

            var items = (await Task.WhenAll(tasks).ConfigureAwait(false))
                        .SelectMany(i => i);

            if (query.ContentTypes.Length > 0)
            {
                items = items.Where(i => query.ContentTypes.Contains(i.ContentType));
            }

            var all = items.ToList();

            return(new ChannelItemResult
            {
                Items = all,
                TotalRecordCount = all.Count
            });
        }
Exemple #4
0
        public async Task <ChannelItemResult> GetAllMedia(InternalAllChannelMediaQuery query, CancellationToken cancellationToken)
        {
            var playlists = _libraryManager.GetUserRootFolder().RecursiveChildren.OfType <VodPlaylist>().ToList();

            var items = new List <ChannelItemInfo>();

            foreach (var playlist in playlists)
            {
                var result = GetPlaylistItems(playlist, cancellationToken);
                items.AddRange(result.Items);
            }

            return(new ChannelItemResult()
            {
                Items = items,
                TotalRecordCount = items.Count
            });
        }