mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-05 21:33:02 +02:00
enable sync for channels that allow downloading
This commit is contained in:
parent
d68a826833
commit
13004d2541
|
@ -31,6 +31,8 @@ namespace MediaBrowser.Controller.Channels
|
|||
/// <returns>ChannelFeatures.</returns>
|
||||
ChannelFeatures GetChannelFeatures(string id);
|
||||
|
||||
bool SupportsSync(string channelId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all channel features.
|
||||
/// </summary>
|
||||
|
|
|
@ -530,6 +530,19 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
return GetChannelFeaturesDto(channel, channelProvider, channelProvider.GetChannelFeatures());
|
||||
}
|
||||
|
||||
public bool SupportsSync(string channelId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(channelId))
|
||||
{
|
||||
throw new ArgumentNullException("channelId");
|
||||
}
|
||||
|
||||
//var channel = GetChannel(channelId);
|
||||
var channelProvider = GetChannelProvider(channelId);
|
||||
|
||||
return channelProvider.GetChannelFeatures().SupportsContentDownloading;
|
||||
}
|
||||
|
||||
public ChannelFeatures GetChannelFeaturesDto(Channel channel,
|
||||
IChannel provider,
|
||||
InternalChannelFeatures features)
|
||||
|
@ -1450,6 +1463,24 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||
return result;
|
||||
}
|
||||
|
||||
internal IChannel GetChannelProvider(string internalChannelId)
|
||||
{
|
||||
if (internalChannelId == null)
|
||||
{
|
||||
throw new ArgumentNullException("internalChannelId");
|
||||
}
|
||||
|
||||
var result = GetAllChannels()
|
||||
.FirstOrDefault(i => string.Equals(GetInternalChannelId(i.Name).ToString("N"), internalChannelId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new ResourceNotFoundException("No channel provider found for channel id " + internalChannelId);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private IEnumerable<BaseItem> ApplyFilters(IEnumerable<BaseItem> items, IEnumerable<ItemFilter> filters, User user)
|
||||
{
|
||||
foreach (var filter in filters.OrderByDescending(f => (int)f))
|
||||
|
|
|
@ -541,6 +541,11 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
return true;
|
||||
}
|
||||
|
||||
if (item.SourceType == SourceType.Channel)
|
||||
{
|
||||
return BaseItem.ChannelManager.SupportsSync(item.ChannelId);
|
||||
}
|
||||
|
||||
return item.LocationType == LocationType.FileSystem || item is Season;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue