aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-03-19 16:23:33 -0400
committerLuke <luke.pulverenti@gmail.com>2016-03-19 16:23:33 -0400
commit3ab212d070384c0a0000e255307aa58d15cbd0ae (patch)
tree6ca899cd7be8685771b56b0074c5b3022faa789a /MediaBrowser.Controller
parentfd0d50ad978801164728f7f6bd067430aa090c5f (diff)
parentdb1bf5b1b55c8012e9ca3393fd59b9469ee5aeaf (diff)
Merge pull request #1563 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Channels/Channel.cs15
-rw-r--r--MediaBrowser.Controller/Channels/ChannelAudioItem.cs2
-rw-r--r--MediaBrowser.Controller/Channels/ChannelFolderItem.cs2
-rw-r--r--MediaBrowser.Controller/Channels/ChannelVideoItem.cs18
-rw-r--r--MediaBrowser.Controller/Channels/IChannelItem.cs11
-rw-r--r--MediaBrowser.Controller/Channels/IChannelManager.cs4
-rw-r--r--MediaBrowser.Controller/Channels/IChannelMediaItem.cs18
-rw-r--r--MediaBrowser.Controller/Entities/Audio/Audio.cs36
-rw-r--r--MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs12
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs45
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs32
-rw-r--r--MediaBrowser.Controller/Entities/InternalItemsQuery.cs8
-rw-r--r--MediaBrowser.Controller/Entities/SourceType.cs10
-rw-r--r--MediaBrowser.Controller/Entities/Trailer.cs60
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs60
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs7
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvChannel.cs7
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvProgram.cs7
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs7
-rw-r--r--MediaBrowser.Controller/LiveTv/RecordingGroup.cs10
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj9
-rw-r--r--MediaBrowser.Controller/Providers/ChannelItemLookupInfo.cs11
-rw-r--r--MediaBrowser.Controller/Providers/TrailerInfo.cs2
23 files changed, 309 insertions, 84 deletions
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs
index 839b7d68f5..43f7b66374 100644
--- a/MediaBrowser.Controller/Channels/Channel.cs
+++ b/MediaBrowser.Controller/Channels/Channel.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Querying;
using System;
using System.Linq;
+using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
@@ -30,6 +31,13 @@ namespace MediaBrowser.Controller.Channels
return base.IsVisible(user);
}
+ [IgnoreDataMember]
+ public override SourceType SourceType
+ {
+ get { return SourceType.Channel; }
+ set { }
+ }
+
public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
try
@@ -75,5 +83,12 @@ namespace MediaBrowser.Controller.Channels
{
return false;
}
+
+ internal static bool IsChannelVisible(BaseItem channelItem, User user)
+ {
+ var channel = ChannelManager.GetChannel(channelItem.ChannelId);
+
+ return channel.IsVisible(user);
+ }
}
}
diff --git a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
index 17dcf138bf..bcb2dc2347 100644
--- a/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelAudioItem.cs
@@ -12,7 +12,7 @@ using System.Threading;
namespace MediaBrowser.Controller.Channels
{
- public class ChannelAudioItem : Audio, IChannelMediaItem
+ public class ChannelAudioItem : Audio
{
public ChannelMediaContentType ContentType { get; set; }
diff --git a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
index f662020bbf..174cd282af 100644
--- a/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelFolderItem.cs
@@ -11,7 +11,7 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Channels
{
- public class ChannelFolderItem : Folder, IChannelItem
+ public class ChannelFolderItem : Folder
{
public ChannelFolderType ChannelFolderType { get; set; }
diff --git a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
index 79ad4b36b1..e12a84ba27 100644
--- a/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
+++ b/MediaBrowser.Controller/Channels/ChannelVideoItem.cs
@@ -13,7 +13,7 @@ using System.Threading;
namespace MediaBrowser.Controller.Channels
{
- public class ChannelVideoItem : Video, IChannelMediaItem, IHasLookupInfo<ChannelItemLookupInfo>
+ public class ChannelVideoItem : Video
{
public ChannelMediaContentType ContentType { get; set; }
@@ -103,20 +103,6 @@ namespace MediaBrowser.Controller.Channels
return list;
}
- public ChannelItemLookupInfo GetLookupInfo()
- {
- var info = GetItemLookupInfo<ChannelItemLookupInfo>();
-
- info.ContentType = ContentType;
-
- if (ExtraType.HasValue)
- {
- info.ExtraType = ExtraType.Value;
- }
-
- return info;
- }
-
protected override string GetInternalMetadataPath(string basePath)
{
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
@@ -132,7 +118,7 @@ namespace MediaBrowser.Controller.Channels
return IsVisibleStandaloneInternal(user, false) && IsChannelVisible(this, user);
}
- internal static bool IsChannelVisible(IChannelItem item, User user)
+ internal static bool IsChannelVisible(BaseItem item, User user)
{
var channel = ChannelManager.GetChannel(item.ChannelId);
diff --git a/MediaBrowser.Controller/Channels/IChannelItem.cs b/MediaBrowser.Controller/Channels/IChannelItem.cs
deleted file mode 100644
index 9b5f0359bd..0000000000
--- a/MediaBrowser.Controller/Channels/IChannelItem.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using MediaBrowser.Controller.Entities;
-
-namespace MediaBrowser.Controller.Channels
-{
- public interface IChannelItem : IHasImages, IHasTags
- {
- string ChannelId { get; set; }
-
- string ExternalId { get; set; }
- }
-}
diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs
index fec550df8b..e3d2d04404 100644
--- a/MediaBrowser.Controller/Channels/IChannelManager.cs
+++ b/MediaBrowser.Controller/Channels/IChannelManager.cs
@@ -116,7 +116,7 @@ namespace MediaBrowser.Controller.Channels
/// <param name="includeCachedVersions">if set to <c>true</c> [include cached versions].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <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>
/// Gets the channel folder.
@@ -141,6 +141,6 @@ namespace MediaBrowser.Controller.Channels
/// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <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);
}
}
diff --git a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs b/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
deleted file mode 100644
index 60a29da90b..0000000000
--- a/MediaBrowser.Controller/Channels/IChannelMediaItem.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using MediaBrowser.Model.Channels;
-using MediaBrowser.Model.Entities;
-using System.Collections.Generic;
-
-namespace MediaBrowser.Controller.Channels
-{
- public interface IChannelMediaItem : IChannelItem
- {
- long? RunTimeTicks { get; set; }
- string MediaType { get; }
-
- ChannelMediaContentType ContentType { get; set; }
-
- ExtraType? ExtraType { get; set; }
-
- List<ChannelMediaInfo> ChannelMediaSources { get; set; }
- }
-} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index dc37dcceab..4c66a6562a 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -8,6 +8,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
+using System.Threading;
+using MediaBrowser.Controller.Channels;
namespace MediaBrowser.Controller.Entities.Audio
{
@@ -24,6 +26,8 @@ namespace MediaBrowser.Controller.Entities.Audio
IThemeMedia,
IArchivable
{
+ public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
+
public long? Size { get; set; }
public string Container { get; set; }
public int? TotalBitrate { get; set; }
@@ -198,7 +202,11 @@ namespace MediaBrowser.Controller.Entities.Audio
public override UnratedItem GetBlockUnratedType()
{
- return UnratedItem.Music;
+ if (SourceType == SourceType.Library)
+ {
+ return UnratedItem.Music;
+ }
+ return base.GetBlockUnratedType();
}
public SongInfo GetLookupInfo()
@@ -214,6 +222,32 @@ namespace MediaBrowser.Controller.Entities.Audio
public virtual IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
+ if (SourceType == SourceType.Channel)
+ {
+ var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
+ .Result.ToList();
+
+ if (sources.Count > 0)
+ {
+ return sources;
+ }
+
+ var list = new List<MediaSourceInfo>
+ {
+ GetVersionInfo(this, enablePathSubstitution)
+ };
+
+ foreach (var mediaSource in list)
+ {
+ if (string.IsNullOrWhiteSpace(mediaSource.Path))
+ {
+ mediaSource.Type = MediaSourceType.Placeholder;
+ }
+ }
+
+ return list;
+ }
+
var result = new List<MediaSourceInfo>
{
GetVersionInfo(this, enablePathSubstitution)
diff --git a/MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs b/MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs
new file mode 100644
index 0000000000..983cc0100f
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Controller.Entities.Audio
+{
+ public class AudioPodcast : Audio
+ {
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 4106c71975..22f688c424 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -169,6 +169,9 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember]
public bool IsOffline { get; set; }
+ [IgnoreDataMember]
+ public virtual SourceType SourceType { get; set; }
+
/// <summary>
/// Returns the folder containing the item.
/// If the item is a folder, it returns the folder itself
@@ -255,6 +258,11 @@ namespace MediaBrowser.Controller.Entities
{
get
{
+ if (SourceType == SourceType.Channel)
+ {
+ return false;
+ }
+
var locationType = LocationType;
return locationType != LocationType.Remote && locationType != LocationType.Virtual;
@@ -301,6 +309,11 @@ namespace MediaBrowser.Controller.Entities
public virtual bool CanDelete()
{
+ if (SourceType == SourceType.Channel)
+ {
+ return false;
+ }
+
var locationType = LocationType;
return locationType != LocationType.Remote &&
locationType != LocationType.Virtual;
@@ -460,6 +473,11 @@ namespace MediaBrowser.Controller.Entities
protected virtual string GetInternalMetadataPath(string basePath)
{
+ if (SourceType == SourceType.Channel)
+ {
+ return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
+ }
+
var idString = Id.ToString("N");
basePath = System.IO.Path.Combine(basePath, "library");
@@ -1032,6 +1050,13 @@ namespace MediaBrowser.Controller.Entities
protected virtual string CreateUserDataKey()
{
+ if (SourceType == SourceType.Channel)
+ {
+ if (!string.IsNullOrWhiteSpace(ExternalId))
+ {
+ return ExternalId;
+ }
+ }
return Id.ToString();
}
@@ -1110,6 +1135,11 @@ namespace MediaBrowser.Controller.Entities
public virtual bool IsSaveLocalMetadataEnabled()
{
+ if (SourceType == SourceType.Channel)
+ {
+ return false;
+ }
+
return ConfigurationManager.Configuration.SaveLocalMeta;
}
@@ -1225,6 +1255,11 @@ namespace MediaBrowser.Controller.Entities
public virtual UnratedItem GetBlockUnratedType()
{
+ if (SourceType == SourceType.Channel)
+ {
+ return UnratedItem.ChannelContent;
+ }
+
return UnratedItem.Other;
}
@@ -1268,6 +1303,11 @@ namespace MediaBrowser.Controller.Entities
public virtual bool IsVisibleStandalone(User user)
{
+ if (SourceType == SourceType.Channel)
+ {
+ return IsVisibleStandaloneInternal(user, false) && Channel.IsChannelVisible(this, user);
+ }
+
return IsVisibleStandaloneInternal(user, true);
}
@@ -1319,6 +1359,11 @@ namespace MediaBrowser.Controller.Entities
public virtual string GetClientTypeName()
{
+ if (IsFolder && SourceType == SourceType.Channel)
+ {
+ return "ChannelFolderItem";
+ }
+
return GetType().Name;
}
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 824a067ad3..e6db695aa7 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -15,6 +15,7 @@ using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO;
+using MediaBrowser.Model.Channels;
namespace MediaBrowser.Controller.Entities
{
@@ -794,8 +795,35 @@ namespace MediaBrowser.Controller.Entities
return item;
}
- public virtual Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
+ public virtual async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
+ if (SourceType == SourceType.Channel)
+ {
+ try
+ {
+ // Don't blow up here because it could cause parent screens with other content to fail
+ return await ChannelManager.GetChannelItemsInternal(new ChannelItemQuery
+ {
+ ChannelId = ChannelId,
+ FolderId = Id.ToString("N"),
+ Limit = query.Limit,
+ StartIndex = query.StartIndex,
+ UserId = query.User.Id.ToString("N"),
+ SortBy = query.SortBy,
+ SortOrder = query.SortOrder
+
+ }, new Progress<double>(), CancellationToken.None);
+ }
+ catch
+ {
+ // Already logged at lower levels
+ return new QueryResult<BaseItem>
+ {
+
+ };
+ }
+ }
+
var user = query.User;
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
@@ -817,7 +845,7 @@ namespace MediaBrowser.Controller.Entities
var result = PostFilterAndSort(items, query);
- return Task.FromResult(result);
+ return result;
}
protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query)
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index 8b623d64ee..7b3e51cadd 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -115,6 +115,10 @@ namespace MediaBrowser.Controller.Entities
public LocationType[] ExcludeLocationTypes { get; set; }
public string[] PresetViews { get; set; }
+ public SourceType[] SourceTypes { get; set; }
+ public SourceType[] ExcludeSourceTypes { get; set; }
+ public TrailerType[] TrailerTypes { get; set; }
+ public TrailerType[] ExcludeTrailerTypes { get; set; }
public InternalItemsQuery()
{
@@ -141,6 +145,10 @@ namespace MediaBrowser.Controller.Entities
ExcludeTags = new string[] { };
ExcludeLocationTypes = new LocationType[] { };
PresetViews = new string[] { };
+ SourceTypes = new SourceType[] { };
+ ExcludeSourceTypes = new SourceType[] { };
+ TrailerTypes = new TrailerType[] { };
+ ExcludeTrailerTypes = new TrailerType[] { };
}
public InternalItemsQuery(User user)
diff --git a/MediaBrowser.Controller/Entities/SourceType.cs b/MediaBrowser.Controller/Entities/SourceType.cs
new file mode 100644
index 0000000000..92976344c5
--- /dev/null
+++ b/MediaBrowser.Controller/Entities/SourceType.cs
@@ -0,0 +1,10 @@
+
+namespace MediaBrowser.Controller.Entities
+{
+ public enum SourceType
+ {
+ Library = 1,
+ Channel = 2,
+ LiveTV = 3
+ }
+}
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index 3bff5bc64f..a4ac345453 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -24,8 +24,11 @@ namespace MediaBrowser.Controller.Entities
Taglines = new List<string>();
Keywords = new List<string>();
ProductionLocations = new List<string>();
+ TrailerTypes = new List<TrailerType>();
}
+ public List<TrailerType> TrailerTypes { get; set; }
+
public float? Metascore { get; set; }
public List<MediaUrl> RemoteTrailers { get; set; }
@@ -62,20 +65,6 @@ namespace MediaBrowser.Controller.Entities
/// <value>The critic rating summary.</value>
public string CriticRatingSummary { get; set; }
- /// <summary>
- /// Gets a value indicating whether this instance is local trailer.
- /// </summary>
- /// <value><c>true</c> if this instance is local trailer; otherwise, <c>false</c>.</value>
- [IgnoreDataMember]
- public bool IsLocalTrailer
- {
- get
- {
- // Local trailers are not part of children
- return GetParent() == null;
- }
- }
-
protected override string CreateUserDataKey()
{
var key = Movie.GetMovieUserDataKey(this);
@@ -105,9 +94,50 @@ namespace MediaBrowser.Controller.Entities
{
var info = GetItemLookupInfo<TrailerInfo>();
- info.IsLocalTrailer = IsLocalTrailer;
+ info.IsLocalTrailer = TrailerTypes.Contains(TrailerType.LocalTrailer);
+
+ if (!IsInMixedFolder)
+ {
+ info.Name = System.IO.Path.GetFileName(ContainingFolderPath);
+ }
return info;
}
+
+ public override bool BeforeMetadataRefresh()
+ {
+ var hasChanges = base.BeforeMetadataRefresh();
+
+ if (!ProductionYear.HasValue)
+ {
+ var info = LibraryManager.ParseName(Name);
+
+ var yearInName = info.Year;
+
+ if (yearInName.HasValue)
+ {
+ ProductionYear = yearInName;
+ hasChanges = true;
+ }
+ else
+ {
+ // Try to get the year from the folder name
+ if (!IsInMixedFolder)
+ {
+ info = LibraryManager.ParseName(System.IO.Path.GetFileName(ContainingFolderPath));
+
+ yearInName = info.Year;
+
+ if (yearInName.HasValue)
+ {
+ ProductionYear = yearInName;
+ hasChanges = true;
+ }
+ }
+ }
+ }
+
+ return hasChanges;
+ }
}
}
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 1972226692..3b1da85b55 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -6,13 +6,16 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
+using System.Net.Mime;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO;
+using MediaBrowser.Controller.Channels;
namespace MediaBrowser.Controller.Entities
{
@@ -33,6 +36,7 @@ namespace MediaBrowser.Controller.Entities
public List<string> AdditionalParts { get; set; }
public List<string> LocalAlternateVersions { get; set; }
public List<LinkedChild> LinkedAlternateVersions { get; set; }
+ public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
[IgnoreDataMember]
public bool IsThemeMedia
@@ -79,6 +83,23 @@ namespace MediaBrowser.Controller.Entities
}
[IgnoreDataMember]
+ public override LocationType LocationType
+ {
+ get
+ {
+ if (SourceType == SourceType.Channel)
+ {
+ if (string.IsNullOrEmpty(Path))
+ {
+ return LocationType.Remote;
+ }
+ }
+
+ return base.LocationType;
+ }
+ }
+
+ [IgnoreDataMember]
public override bool SupportsAddingToPlaylist
{
get { return LocationType == LocationType.FileSystem && RunTimeTicks.HasValue; }
@@ -130,6 +151,29 @@ namespace MediaBrowser.Controller.Entities
return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
}
+ protected override string CreateUserDataKey()
+ {
+ if (ExtraType.HasValue)
+ {
+ var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb);
+
+ if (!string.IsNullOrWhiteSpace(key))
+ {
+ key = key + "-" + ExtraType.ToString().ToLower();
+
+ // Make sure different trailers have their own data.
+ if (RunTimeTicks.HasValue)
+ {
+ key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture);
+ }
+
+ return key;
+ }
+ }
+
+ return base.CreateUserDataKey();
+ }
+
/// <summary>
/// Gets the linked children.
/// </summary>
@@ -441,6 +485,22 @@ namespace MediaBrowser.Controller.Entities
public virtual IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
{
+ if (SourceType == SourceType.Channel)
+ {
+ var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
+ .Result.ToList();
+
+ if (sources.Count > 0)
+ {
+ return sources;
+ }
+
+ return new List<MediaSourceInfo>
+ {
+ GetVersionInfo(enablePathSubstitution, this, MediaSourceType.Placeholder)
+ };
+ }
+
var item = this;
var result = item.GetAlternateVersions()
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
index 6f72ae1fb3..04e19c92a8 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
@@ -39,6 +39,13 @@ namespace MediaBrowser.Controller.LiveTv
[IgnoreDataMember]
public bool IsPremiere { get; set; }
+ [IgnoreDataMember]
+ public override SourceType SourceType
+ {
+ get { return SourceType.LiveTV; }
+ set { }
+ }
+
/// <summary>
/// Gets the user data key.
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
index 8c4ee92cda..bc0b40b30c 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
@@ -40,6 +40,13 @@ namespace MediaBrowser.Controller.LiveTv
}
}
+ [IgnoreDataMember]
+ public override SourceType SourceType
+ {
+ get { return SourceType.LiveTV; }
+ set { }
+ }
+
/// <summary>
/// Gets or sets the number.
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
index fcd065e79f..c01df74642 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
@@ -46,6 +46,13 @@ namespace MediaBrowser.Controller.LiveTv
[IgnoreDataMember]
public string ServiceName { get; set; }
+ [IgnoreDataMember]
+ public override SourceType SourceType
+ {
+ get { return SourceType.LiveTV; }
+ set { }
+ }
+
/// <summary>
/// The start date of the program, in UTC.
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
index ce0c69dee3..f298e89b70 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
@@ -39,6 +39,13 @@ namespace MediaBrowser.Controller.LiveTv
[IgnoreDataMember]
public bool IsPremiere { get; set; }
+ [IgnoreDataMember]
+ public override SourceType SourceType
+ {
+ get { return SourceType.LiveTV; }
+ set { }
+ }
+
/// <summary>
/// Gets the user data key.
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/RecordingGroup.cs b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
index 2d58ef67f7..5c86de08b8 100644
--- a/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
+++ b/MediaBrowser.Controller/LiveTv/RecordingGroup.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller.Entities;
+using System.Runtime.Serialization;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Users;
@@ -24,5 +25,12 @@ namespace MediaBrowser.Controller.LiveTv
return false;
}
}
+
+ [IgnoreDataMember]
+ public override SourceType SourceType
+ {
+ get { return SourceType.LiveTV; }
+ set { }
+ }
}
}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index f74d82caaa..be041281ff 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -75,6 +75,7 @@
</Compile>
<Compile Include="Activity\IActivityManager.cs" />
<Compile Include="Activity\IActivityRepository.cs" />
+ <Compile Include="Channels\ChannelAudioItem.cs" />
<Compile Include="Channels\ChannelFolderItem.cs" />
<Compile Include="Channels\ChannelItemInfo.cs" />
<Compile Include="Channels\ChannelItemResult.cs" />
@@ -82,13 +83,10 @@
<Compile Include="Channels\ChannelMediaInfo.cs" />
<Compile Include="Channels\ChannelParentalRating.cs" />
<Compile Include="Channels\ChannelSearchInfo.cs" />
+ <Compile Include="Channels\ChannelVideoItem.cs" />
<Compile Include="Channels\IChannel.cs" />
<Compile Include="Channels\IChannelManager.cs" />
- <Compile Include="Channels\IChannelItem.cs" />
- <Compile Include="Channels\ChannelAudioItem.cs" />
- <Compile Include="Channels\ChannelVideoItem.cs" />
<Compile Include="Channels\Channel.cs" />
- <Compile Include="Channels\IChannelMediaItem.cs" />
<Compile Include="Channels\IHasCacheKey.cs" />
<Compile Include="Channels\IIndexableChannel.cs" />
<Compile Include="Channels\InternalAllChannelMediaQuery.cs" />
@@ -128,6 +126,7 @@
<Compile Include="Drawing\ImageStream.cs" />
<Compile Include="Dto\DtoOptions.cs" />
<Compile Include="Dto\IDtoService.cs" />
+ <Compile Include="Entities\Audio\AudioPodcast.cs" />
<Compile Include="Entities\Audio\IHasAlbumArtist.cs" />
<Compile Include="Entities\Audio\IHasMusicGenres.cs" />
<Compile Include="Entities\Book.cs" />
@@ -180,6 +179,7 @@
<Compile Include="Entities\Photo.cs" />
<Compile Include="Entities\PhotoAlbum.cs" />
<Compile Include="Entities\Share.cs" />
+ <Compile Include="Entities\SourceType.cs" />
<Compile Include="Entities\UserView.cs" />
<Compile Include="Entities\UserViewBuilder.cs" />
<Compile Include="FileOrganization\IFileOrganizationService.cs" />
@@ -271,7 +271,6 @@
<Compile Include="Providers\ArtistInfo.cs" />
<Compile Include="Providers\BookInfo.cs" />
<Compile Include="Providers\BoxSetInfo.cs" />
- <Compile Include="Providers\ChannelItemLookupInfo.cs" />
<Compile Include="Providers\DirectoryService.cs" />
<Compile Include="Providers\DynamicImageInfo.cs" />
<Compile Include="Providers\DynamicImageResponse.cs" />
diff --git a/MediaBrowser.Controller/Providers/ChannelItemLookupInfo.cs b/MediaBrowser.Controller/Providers/ChannelItemLookupInfo.cs
deleted file mode 100644
index 6c972f3bf5..0000000000
--- a/MediaBrowser.Controller/Providers/ChannelItemLookupInfo.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using MediaBrowser.Model.Channels;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Controller.Providers
-{
- public class ChannelItemLookupInfo : ItemLookupInfo
- {
- public ChannelMediaContentType ContentType { get; set; }
- public ExtraType ExtraType { get; set; }
- }
-} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Providers/TrailerInfo.cs b/MediaBrowser.Controller/Providers/TrailerInfo.cs
index fe26ec43ec..65ddc2d1e6 100644
--- a/MediaBrowser.Controller/Providers/TrailerInfo.cs
+++ b/MediaBrowser.Controller/Providers/TrailerInfo.cs
@@ -1,3 +1,5 @@
+using MediaBrowser.Model.Entities;
+
namespace MediaBrowser.Controller.Providers
{
public class TrailerInfo : ItemLookupInfo