mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
remove IChannelMediaItem interface
This commit is contained in:
parent
9e495d3886
commit
cbac67b5ae
@ -12,7 +12,7 @@ using System.Threading;
|
|||||||
|
|
||||||
namespace MediaBrowser.Controller.Channels
|
namespace MediaBrowser.Controller.Channels
|
||||||
{
|
{
|
||||||
public class ChannelAudioItem : Audio, IChannelMediaItem
|
public class ChannelAudioItem : Audio
|
||||||
{
|
{
|
||||||
public ChannelMediaContentType ContentType { get; set; }
|
public ChannelMediaContentType ContentType { get; set; }
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ using System.Threading;
|
|||||||
|
|
||||||
namespace MediaBrowser.Controller.Channels
|
namespace MediaBrowser.Controller.Channels
|
||||||
{
|
{
|
||||||
public class ChannelVideoItem : Video, IChannelMediaItem, IHasLookupInfo<ChannelItemLookupInfo>
|
public class ChannelVideoItem : Video, IHasLookupInfo<ChannelItemLookupInfo>
|
||||||
{
|
{
|
||||||
public ChannelMediaContentType ContentType { get; set; }
|
public ChannelMediaContentType ContentType { get; set; }
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
/// <param name="includeCachedVersions">if set to <c>true</c> [include cached versions].</param>
|
/// <param name="includeCachedVersions">if set to <c>true</c> [include cached versions].</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
|
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
|
||||||
Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(IChannelMediaItem item, bool includeCachedVersions, CancellationToken cancellationToken);
|
Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channel folder.
|
/// Gets the channel folder.
|
||||||
@ -141,6 +141,6 @@ namespace MediaBrowser.Controller.Channels
|
|||||||
/// <param name="progress">The progress.</param>
|
/// <param name="progress">The progress.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task DownloadChannelItem(IChannelMediaItem item, string destinationPath, IProgress<double> progress, CancellationToken cancellationToken);
|
Task DownloadChannelItem(BaseItem item, string destinationPath, IProgress<double> progress, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
using System;
|
|
||||||
using MediaBrowser.Model.Channels;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Channels
|
|
||||||
{
|
|
||||||
public interface IChannelMediaItem
|
|
||||||
{
|
|
||||||
string ChannelId { get; set; }
|
|
||||||
Guid Id { get; set; }
|
|
||||||
string ExternalId { get; set; }
|
|
||||||
|
|
||||||
long? RunTimeTicks { get; set; }
|
|
||||||
string MediaType { get; }
|
|
||||||
|
|
||||||
ChannelMediaContentType ContentType { get; set; }
|
|
||||||
|
|
||||||
ExtraType? ExtraType { get; set; }
|
|
||||||
|
|
||||||
List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -87,7 +87,6 @@
|
|||||||
<Compile Include="Channels\ChannelAudioItem.cs" />
|
<Compile Include="Channels\ChannelAudioItem.cs" />
|
||||||
<Compile Include="Channels\ChannelVideoItem.cs" />
|
<Compile Include="Channels\ChannelVideoItem.cs" />
|
||||||
<Compile Include="Channels\Channel.cs" />
|
<Compile Include="Channels\Channel.cs" />
|
||||||
<Compile Include="Channels\IChannelMediaItem.cs" />
|
|
||||||
<Compile Include="Channels\IHasCacheKey.cs" />
|
<Compile Include="Channels\IHasCacheKey.cs" />
|
||||||
<Compile Include="Channels\IIndexableChannel.cs" />
|
<Compile Include="Channels\IIndexableChannel.cs" />
|
||||||
<Compile Include="Channels\InternalAllChannelMediaQuery.cs" />
|
<Compile Include="Channels\InternalAllChannelMediaQuery.cs" />
|
||||||
|
@ -42,7 +42,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
public bool Supports(IHasImages item)
|
public bool Supports(IHasImages item)
|
||||||
{
|
{
|
||||||
var channelItem = item as IChannelMediaItem;
|
var channelItem = item as ChannelVideoItem;
|
||||||
|
|
||||||
if (channelItem != null)
|
if (channelItem != null)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ namespace MediaBrowser.Providers.Omdb
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var channelItem = item as IChannelMediaItem;
|
var channelItem = item as ChannelVideoItem;
|
||||||
|
|
||||||
if (channelItem != null)
|
if (channelItem != null)
|
||||||
{
|
{
|
||||||
|
@ -20,11 +20,11 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
|
|
||||||
public Task<IEnumerable<MediaSourceInfo>> GetMediaSources(IHasMediaSources item, CancellationToken cancellationToken)
|
public Task<IEnumerable<MediaSourceInfo>> GetMediaSources(IHasMediaSources item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var channelItem = item as IChannelMediaItem;
|
var baseItem = (BaseItem) item;
|
||||||
|
|
||||||
if (channelItem != null)
|
if (baseItem.SourceType == SourceType.Channel)
|
||||||
{
|
{
|
||||||
return _channelManager.GetDynamicMediaSources(channelItem, cancellationToken);
|
return _channelManager.GetDynamicMediaSources(baseItem, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult<IEnumerable<MediaSourceInfo>>(new List<MediaSourceInfo>());
|
return Task.FromResult<IEnumerable<MediaSourceInfo>>(new List<MediaSourceInfo>());
|
||||||
|
@ -248,9 +248,19 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(IChannelMediaItem item, bool includeCachedVersions, CancellationToken cancellationToken)
|
public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
IEnumerable<ChannelMediaInfo> results = item.ChannelMediaSources;
|
IEnumerable<ChannelMediaInfo> results = new List<ChannelMediaInfo>();
|
||||||
|
var video = item as ChannelVideoItem;
|
||||||
|
if (video != null)
|
||||||
|
{
|
||||||
|
results = video.ChannelMediaSources;
|
||||||
|
}
|
||||||
|
var audio = item as ChannelAudioItem;
|
||||||
|
if (audio != null)
|
||||||
|
{
|
||||||
|
results = audio.ChannelMediaSources;
|
||||||
|
}
|
||||||
|
|
||||||
var sources = SortMediaInfoResults(results)
|
var sources = SortMediaInfoResults(results)
|
||||||
.Select(i => GetMediaSource(item, i))
|
.Select(i => GetMediaSource(item, i))
|
||||||
@ -265,7 +275,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
return sources;
|
return sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(IChannelMediaItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var channel = GetChannel(item.ChannelId);
|
var channel = GetChannel(item.ChannelId);
|
||||||
var channelPlugin = GetChannelProvider(channel);
|
var channelPlugin = GetChannelProvider(channel);
|
||||||
@ -319,7 +329,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<MediaSourceInfo> GetCachedChannelItemMediaSources(IChannelMediaItem item)
|
private IEnumerable<MediaSourceInfo> GetCachedChannelItemMediaSources(BaseItem item)
|
||||||
{
|
{
|
||||||
var filenamePrefix = item.Id.ToString("N");
|
var filenamePrefix = item.Id.ToString("N");
|
||||||
var parentPath = Path.Combine(ChannelDownloadPath, item.ChannelId);
|
var parentPath = Path.Combine(ChannelDownloadPath, item.ChannelId);
|
||||||
@ -368,7 +378,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
return new List<MediaSourceInfo>();
|
return new List<MediaSourceInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MediaSourceInfo GetMediaSource(IChannelMediaItem item, ChannelMediaInfo info)
|
private MediaSourceInfo GetMediaSource(BaseItem item, ChannelMediaInfo info)
|
||||||
{
|
{
|
||||||
var source = info.ToMediaSource();
|
var source = info.ToMediaSource();
|
||||||
|
|
||||||
@ -1277,16 +1287,25 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
}
|
}
|
||||||
item.ExternalId = info.Id;
|
item.ExternalId = info.Id;
|
||||||
|
|
||||||
var channelMediaItem = item as IChannelMediaItem;
|
var channelAudioItem = item as ChannelAudioItem;
|
||||||
|
if (channelAudioItem != null)
|
||||||
if (channelMediaItem != null)
|
|
||||||
{
|
{
|
||||||
channelMediaItem.ContentType = info.ContentType;
|
channelAudioItem.ContentType = info.ContentType;
|
||||||
channelMediaItem.ExtraType = info.ExtraType;
|
channelAudioItem.ExtraType = info.ExtraType;
|
||||||
channelMediaItem.ChannelMediaSources = info.MediaSources;
|
channelAudioItem.ChannelMediaSources = info.MediaSources;
|
||||||
|
|
||||||
var mediaSource = info.MediaSources.FirstOrDefault();
|
var mediaSource = info.MediaSources.FirstOrDefault();
|
||||||
|
item.Path = mediaSource == null ? null : mediaSource.Path;
|
||||||
|
}
|
||||||
|
|
||||||
|
var channelVideoItem = item as ChannelVideoItem;
|
||||||
|
if (channelVideoItem != null)
|
||||||
|
{
|
||||||
|
channelVideoItem.ContentType = info.ContentType;
|
||||||
|
channelVideoItem.ExtraType = info.ExtraType;
|
||||||
|
channelVideoItem.ChannelMediaSources = info.MediaSources;
|
||||||
|
|
||||||
|
var mediaSource = info.MediaSources.FirstOrDefault();
|
||||||
item.Path = mediaSource == null ? null : mediaSource.Path;
|
item.Path = mediaSource == null ? null : mediaSource.Path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1439,7 +1458,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
return await _libraryManager.GetNamedView(name, "channels", "zz_" + name, cancellationToken).ConfigureAwait(false);
|
return await _libraryManager.GetNamedView(name, "channels", "zz_" + name, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DownloadChannelItem(IChannelMediaItem item, string destination,
|
public async Task DownloadChannelItem(BaseItem item, string destination,
|
||||||
IProgress<double> progress, CancellationToken cancellationToken)
|
IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var sources = await GetDynamicMediaSources(item, cancellationToken)
|
var sources = await GetDynamicMediaSources(item, cancellationToken)
|
||||||
@ -1455,7 +1474,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task TryDownloadChannelItem(MediaSourceInfo source,
|
private async Task TryDownloadChannelItem(MediaSourceInfo source,
|
||||||
IChannelMediaItem item,
|
BaseItem item,
|
||||||
string destination,
|
string destination,
|
||||||
IProgress<double> progress,
|
IProgress<double> progress,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
|
@ -1250,6 +1250,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
if (audio != null)
|
if (audio != null)
|
||||||
{
|
{
|
||||||
dto.Album = audio.Album;
|
dto.Album = audio.Album;
|
||||||
|
dto.ExtraType = audio.ExtraType;
|
||||||
|
|
||||||
var albumParent = audio.AlbumEntity;
|
var albumParent = audio.AlbumEntity;
|
||||||
|
|
||||||
@ -1352,6 +1353,8 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
{
|
{
|
||||||
dto.Chapters = GetChapterInfoDtos(item);
|
dto.Chapters = GetChapterInfoDtos(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dto.ExtraType = video.ExtraType;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fields.Contains(ItemFields.MediaStreams))
|
if (fields.Contains(ItemFields.MediaStreams))
|
||||||
@ -1535,12 +1538,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||||||
{
|
{
|
||||||
dto.ChannelName = _channelManagerFactory().GetChannel(item.ChannelId).Name;
|
dto.ChannelName = _channelManagerFactory().GetChannel(item.ChannelId).Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
var channelMediaItem = item as IChannelMediaItem;
|
|
||||||
if (channelMediaItem != null)
|
|
||||||
{
|
|
||||||
dto.ExtraType = channelMediaItem.ExtraType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AttachLinkedChildImages(BaseItemDto dto, Folder folder, User user, DtoOptions options)
|
private void AttachLinkedChildImages(BaseItemDto dto, Folder folder, User user, DtoOptions options)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user