public ChannelFeatures() { MediaTypes = new ChannelMediaType[] { }; ContentTypes = new ChannelMediaContentType[] { }; DefaultSortFields = new ChannelItemSortField[] { }; }
public async Task <IEnumerable <ChannelItemInfo> > GetChannelItems(ChannelMediaContentType contentType, ExtraType extraType, TrailerType trailerType, CancellationToken cancellationToken) { var items = await GetAllItems(false, cancellationToken).ConfigureAwait(false); return(items .Where(i => i.ContentType == contentType && i.ExtraType == extraType && i.TrailerTypes.Contains(trailerType))); }
public AllChannelMediaQuery() { ChannelIds = new string[] { }; ContentTypes = new ChannelMediaContentType[] { }; ExtraTypes = new ExtraType[] { }; TrailerTypes = new TrailerType[] { }; Filters = new ItemFilter[] { }; Fields = new ItemFields[] { }; }
public AllChannelMediaQuery() { ChannelIds = new string[] { }; ContentTypes = new ChannelMediaContentType[] { }; ExtraTypes = new ExtraType[] { }; TrailerTypes = new TrailerType[] { }; Filters = new ItemFilter[] { }; Fields = new List<ItemFields>(); }
public ChannelItemResult GetCategories(ChannelMediaContentType contentType) { var list = new List <ChannelItemInfo>(); //list.Add(new ChannelItemInfo //{ // FolderType = ChannelFolderType.Container, // Name = "New and coming soon to theaters", // Type = ChannelItemType.Folder, // MediaType = ChannelMediaType.Video, // Id = contentType.ToString().ToLower() + "|" + "TrailerComingSoonToTheaters", // ImageUrl = "https://raw.githubusercontent.com/MediaBrowser/MediaBrowser.Channels/master/MediaBrowser.Plugins.Trailers/Images/thumb.jpg" //}); //list.Add(new ChannelItemInfo //{ // FolderType = ChannelFolderType.Container, // Name = "New and coming soon to Dvd", // Type = ChannelItemType.Folder, // MediaType = ChannelMediaType.Video, // Id = contentType.ToString().ToLower() + "|" + "TrailerComingSoonToDvd", // ImageUrl = "https://raw.githubusercontent.com/MediaBrowser/MediaBrowser.Channels/master/MediaBrowser.Plugins.Trailers/Images/bluray.jpg" //}); //list.Add(new ChannelItemInfo //{ // FolderType = ChannelFolderType.Container, // Name = "Archive", // Type = ChannelItemType.Folder, // MediaType = ChannelMediaType.Video, // Id = contentType.ToString().ToLower() + "|" + "TrailerArchive", // ImageUrl = "https://raw.githubusercontent.com/MediaBrowser/MediaBrowser.Channels/master/MediaBrowser.Plugins.Trailers/Images/reel.jpg" //}); return(new ChannelItemResult { Items = list, TotalRecordCount = list.Count }); }
/// <summary> /// Downloads the trailer for item. /// </summary> /// <param name="item">The item.</param> /// <param name="contentType">Type of the content.</param> /// <param name="providersToMatch">The providers to match.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> public async Task DownloadTrailerForItem(BaseItem item, ChannelMediaContentType contentType, List<MetadataProviders> providersToMatch, CancellationToken cancellationToken) { var providerValues = providersToMatch.Select(item.GetProviderId) .ToList(); if (providerValues.All(string.IsNullOrWhiteSpace)) { return; } var channelTrailers = await _channelManager.GetAllMediaInternal(new AllChannelMediaQuery { ContentTypes = new[] { contentType }, ExtraTypes = new[] { ExtraType.Trailer } }, CancellationToken.None); var channelItem = channelTrailers .Items .OfType<IChannelMediaItem>() .FirstOrDefault(i => { var currentProviderValues = providersToMatch.Select(i.GetProviderId).ToList(); var index = 0; foreach (var val in providerValues) { if (!string.IsNullOrWhiteSpace(val) && string.Equals(currentProviderValues[index], val, StringComparison.OrdinalIgnoreCase)) { return true; } index++; } return false; }); if (channelItem == null) { return; } var destination = Directory.Exists(item.Path) ? Path.Combine(item.Path, Path.GetFileName(item.Path) + "-trailer") : Path.Combine(Path.GetDirectoryName(item.Path), Path.GetFileNameWithoutExtension(item.Path) + "-trailer"); _libraryMonitor.ReportFileSystemChangeBeginning(Path.GetDirectoryName(destination)); try { await _channelManager.DownloadChannelItem(channelItem, destination, new Progress<double>(), cancellationToken) .ConfigureAwait(false); } catch (OperationCanceledException) { } catch (ChannelDownloadException) { // Logged at lower levels } catch (Exception ex) { _logger.ErrorException("Error downloading channel content for {0}", ex, item.Name); } finally { _libraryMonitor.ReportFileSystemChangeComplete(Path.GetDirectoryName(destination), true); } }
/// <summary> /// Downloads the trailer for item. /// </summary> /// <param name="item">The item.</param> /// <param name="contentType">Type of the content.</param> /// <param name="providersToMatch">The providers to match.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> public async Task DownloadTrailerForItem(BaseItem item, ChannelMediaContentType contentType, List <MetadataProviders> providersToMatch, CancellationToken cancellationToken) { var providerValues = providersToMatch.Select(item.GetProviderId) .ToList(); if (providerValues.All(string.IsNullOrWhiteSpace)) { return; } var channelTrailers = await _channelManager.GetAllMediaInternal(new AllChannelMediaQuery { ContentTypes = new[] { contentType }, ExtraTypes = new[] { ExtraType.Trailer } }, CancellationToken.None); var channelItem = channelTrailers .Items .OfType <IChannelMediaItem>() .FirstOrDefault(i => { var currentProviderValues = providersToMatch.Select(i.GetProviderId).ToList(); var index = 0; foreach (var val in providerValues) { if (!string.IsNullOrWhiteSpace(val) && string.Equals(currentProviderValues[index], val, StringComparison.OrdinalIgnoreCase)) { return(true); } index++; } return(false); }); if (channelItem == null) { return; } var destination = Directory.Exists(item.Path) ? Path.Combine(item.Path, Path.GetFileName(item.Path) + "-trailer") : Path.Combine(Path.GetDirectoryName(item.Path), Path.GetFileNameWithoutExtension(item.Path) + "-trailer"); _libraryMonitor.ReportFileSystemChangeBeginning(Path.GetDirectoryName(destination)); try { await _channelManager.DownloadChannelItem(channelItem, destination, new Progress <double>(), cancellationToken) .ConfigureAwait(false); } catch (OperationCanceledException) { } catch (ChannelDownloadException) { // Logged at lower levels } catch (Exception ex) { _logger.ErrorException("Error downloading channel content for {0}", ex, item.Name); } finally { _libraryMonitor.ReportFileSystemChangeComplete(Path.GetDirectoryName(destination), true); } }
public ChannelItemResult GetCategories(ChannelMediaContentType contentType) { var list = new List<ChannelItemInfo>(); //list.Add(new ChannelItemInfo //{ // FolderType = ChannelFolderType.Container, // Name = "New and coming soon to theaters", // Type = ChannelItemType.Folder, // MediaType = ChannelMediaType.Video, // Id = contentType.ToString().ToLower() + "|" + "TrailerComingSoonToTheaters", // ImageUrl = "https://raw.githubusercontent.com/MediaBrowser/MediaBrowser.Channels/master/MediaBrowser.Plugins.Trailers/Images/thumb.jpg" //}); //list.Add(new ChannelItemInfo //{ // FolderType = ChannelFolderType.Container, // Name = "New and coming soon to Dvd", // Type = ChannelItemType.Folder, // MediaType = ChannelMediaType.Video, // Id = contentType.ToString().ToLower() + "|" + "TrailerComingSoonToDvd", // ImageUrl = "https://raw.githubusercontent.com/MediaBrowser/MediaBrowser.Channels/master/MediaBrowser.Plugins.Trailers/Images/bluray.jpg" //}); //list.Add(new ChannelItemInfo //{ // FolderType = ChannelFolderType.Container, // Name = "Archive", // Type = ChannelItemType.Folder, // MediaType = ChannelMediaType.Video, // Id = contentType.ToString().ToLower() + "|" + "TrailerArchive", // ImageUrl = "https://raw.githubusercontent.com/MediaBrowser/MediaBrowser.Channels/master/MediaBrowser.Plugins.Trailers/Images/reel.jpg" //}); return new ChannelItemResult { Items = list, TotalRecordCount = list.Count }; }
public async Task<IEnumerable<ChannelItemInfo>> GetChannelItems(ChannelMediaContentType contentType, ExtraType extraType, TrailerType trailerType, CancellationToken cancellationToken) { var items = await GetAllItems(false, cancellationToken).ConfigureAwait(false); return items .Where(i => i.ContentType == contentType && i.ExtraType == extraType && i.TrailerTypes.Contains(trailerType)); }
public InternalAllChannelMediaQuery() { ContentTypes = new ChannelMediaContentType[] { }; ExtraTypes = new ExtraType[] { }; TrailerTypes = new TrailerType[] { }; }