jellyfin/MediaBrowser.Controller/Channels/ChannelAudioItem.cs

103 lines
2.7 KiB
C#
Raw Normal View History

2015-04-06 03:47:01 +00:00
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Channels;
2014-05-03 04:20:04 +00:00
using MediaBrowser.Model.Configuration;
2014-10-08 01:37:45 +00:00
using MediaBrowser.Model.Dto;
2014-05-18 19:58:42 +00:00
using MediaBrowser.Model.Entities;
2015-02-06 05:39:07 +00:00
using MediaBrowser.Model.Users;
2014-05-18 19:58:42 +00:00
using System.Collections.Generic;
using System.Linq;
2015-10-04 18:10:50 +00:00
using System.Runtime.Serialization;
2014-10-08 01:37:45 +00:00
using System.Threading;
2014-03-18 01:45:41 +00:00
namespace MediaBrowser.Controller.Channels
{
2014-03-19 01:35:40 +00:00
public class ChannelAudioItem : Audio, IChannelMediaItem
2014-03-18 01:45:41 +00:00
{
public ChannelMediaContentType ContentType { get; set; }
2014-05-18 19:58:42 +00:00
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
2014-12-20 06:06:27 +00:00
2015-11-06 15:02:22 +00:00
public override UnratedItem GetBlockUnratedType()
2014-05-03 04:20:04 +00:00
{
2015-11-06 15:02:22 +00:00
return UnratedItem.ChannelContent;
2014-05-03 04:20:04 +00:00
}
2015-01-24 22:33:26 +00:00
protected override string CreateUserDataKey()
2014-06-02 19:32:41 +00:00
{
return ExternalId;
}
2015-10-04 18:10:50 +00:00
[IgnoreDataMember]
2014-05-03 04:20:04 +00:00
public override bool SupportsLocalMetadata
{
get
{
return false;
}
}
2014-05-18 19:58:42 +00:00
2014-09-28 15:27:26 +00:00
public override bool IsSaveLocalMetadataEnabled()
{
return false;
}
2014-05-18 19:58:42 +00:00
public ChannelAudioItem()
{
ChannelMediaSources = new List<ChannelMediaInfo>();
}
2015-10-04 18:10:50 +00:00
[IgnoreDataMember]
2014-05-18 19:58:42 +00:00
public override LocationType LocationType
{
get
{
if (string.IsNullOrEmpty(Path))
{
return LocationType.Remote;
}
return base.LocationType;
}
}
2014-09-28 15:27:26 +00:00
protected override string GetInternalMetadataPath(string basePath)
{
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
}
2014-10-08 01:37:45 +00:00
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
2015-03-28 20:22:27 +00:00
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
.Result.ToList();
2014-10-08 01:37:45 +00:00
if (sources.Count > 0)
{
return sources;
}
2015-03-28 20:22:27 +00:00
var list = base.GetMediaSources(enablePathSubstitution).ToList();
foreach (var mediaSource in list)
{
if (string.IsNullOrWhiteSpace(mediaSource.Path))
{
mediaSource.Type = MediaSourceType.Placeholder;
}
}
2014-10-08 01:37:45 +00:00
return list;
}
2015-02-06 05:39:07 +00:00
public override bool CanDelete()
{
return false;
}
2015-04-06 03:47:01 +00:00
public override bool IsVisibleStandalone(User user)
{
2015-04-10 14:49:03 +00:00
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
2015-04-06 03:47:01 +00:00
}
2014-03-18 01:45:41 +00:00
}
}