2014-05-18 12:58:42 -07:00
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
2014-05-19 12:51:56 -07:00
|
|
|
|
using MediaBrowser.Model.Channels;
|
2014-05-02 21:20:04 -07:00
|
|
|
|
using MediaBrowser.Model.Configuration;
|
2014-10-07 18:37:45 -07:00
|
|
|
|
using MediaBrowser.Model.Dto;
|
2014-05-18 12:58:42 -07:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2014-10-07 18:37:45 -07:00
|
|
|
|
using System.Threading;
|
2014-03-17 18:45:41 -07:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Channels
|
|
|
|
|
{
|
2014-03-18 18:35:40 -07:00
|
|
|
|
public class ChannelAudioItem : Audio, IChannelMediaItem
|
2014-03-17 18:45:41 -07:00
|
|
|
|
{
|
|
|
|
|
public string ExternalId { get; set; }
|
|
|
|
|
|
2014-05-04 17:46:52 -07:00
|
|
|
|
public string ChannelId { get; set; }
|
2014-09-28 08:27:26 -07:00
|
|
|
|
public string DataVersion { get; set; }
|
2014-05-19 12:51:56 -07:00
|
|
|
|
|
2014-03-17 18:45:41 -07:00
|
|
|
|
public ChannelItemType ChannelItemType { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool IsInfiniteStream { get; set; }
|
|
|
|
|
|
|
|
|
|
public ChannelMediaContentType ContentType { get; set; }
|
|
|
|
|
|
|
|
|
|
public string OriginalImageUrl { get; set; }
|
2014-05-02 21:20:04 -07:00
|
|
|
|
|
2014-05-18 12:58:42 -07:00
|
|
|
|
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
|
|
|
|
|
2014-05-02 21:20:04 -07:00
|
|
|
|
protected override bool GetBlockUnratedValue(UserConfiguration config)
|
|
|
|
|
{
|
|
|
|
|
return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-02 12:32:41 -07:00
|
|
|
|
public override string GetUserDataKey()
|
|
|
|
|
{
|
|
|
|
|
return ExternalId;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-02 21:20:04 -07:00
|
|
|
|
public override bool SupportsLocalMetadata
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-18 12:58:42 -07:00
|
|
|
|
|
2014-09-28 08:27:26 -07:00
|
|
|
|
public override bool IsSaveLocalMetadataEnabled()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-18 12:58:42 -07:00
|
|
|
|
public ChannelAudioItem()
|
|
|
|
|
{
|
|
|
|
|
ChannelMediaSources = new List<ChannelMediaInfo>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override LocationType LocationType
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(Path))
|
|
|
|
|
{
|
|
|
|
|
return LocationType.Remote;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.LocationType;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-09-28 08:27:26 -07:00
|
|
|
|
|
|
|
|
|
protected override string GetInternalMetadataPath(string basePath)
|
|
|
|
|
{
|
|
|
|
|
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
|
|
|
|
|
}
|
2014-10-07 18:37:45 -07:00
|
|
|
|
|
|
|
|
|
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
|
|
|
|
|
{
|
|
|
|
|
var list = base.GetMediaSources(enablePathSubstitution).ToList();
|
|
|
|
|
|
|
|
|
|
var sources = ChannelManager.GetChannelItemMediaSources(Id.ToString("N"), false, CancellationToken.None)
|
|
|
|
|
.Result.ToList();
|
|
|
|
|
|
|
|
|
|
if (sources.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
return sources;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list.InsertRange(0, sources);
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
2014-03-17 18:45:41 -07:00
|
|
|
|
}
|
|
|
|
|
}
|