diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities/Audio/Audio.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Audio/Audio.cs | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 766f1e5ed..4c66a6562 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; } @@ -153,6 +157,31 @@ namespace MediaBrowser.Controller.Entities.Audio /// <returns>System.String.</returns> protected override string CreateUserDataKey() { + if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys) + { + var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty; + + + if (ParentIndexNumber.HasValue) + { + songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey; + } + songKey+= Name; + + if (!string.IsNullOrWhiteSpace(Album)) + { + songKey = Album + "-" + songKey; + } + + var albumArtist = AlbumArtists.FirstOrDefault(); + if (!string.IsNullOrWhiteSpace(albumArtist)) + { + songKey = albumArtist + "-" + songKey; + } + + return songKey; + } + var parent = AlbumEntity; if (parent != null) @@ -173,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() @@ -189,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) |
