diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-11-20 13:02:59 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-20 13:02:59 -0500 |
| commit | 8f78652398ad4e9e9af53a1bd065afe4b9d9260e (patch) | |
| tree | 32bc4144212d7f6ee3941c9c2471b56ab9c5d3e2 /MediaBrowser.Controller/Entities | |
| parent | 7d15b140cfe4f761e03f661f82cf946f327863f5 (diff) | |
| parent | 71ff88284be60fb39a7389e0c4990c94f2207ed4 (diff) | |
Merge pull request #3032 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Controller/Entities')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 15 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Video.cs | 78 |
4 files changed, 39 insertions, 73 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 5b4cd59001..f6a8f1d5a4 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1376,11 +1376,6 @@ namespace MediaBrowser.Controller.Entities return list; } - internal virtual bool IsValidFromResolver(BaseItem newItem) - { - return true; - } - internal virtual ItemUpdateType UpdateFromResolvedItem(BaseItem newItem) { var updateType = ItemUpdateType.None; @@ -2045,7 +2040,7 @@ namespace MediaBrowser.Controller.Entities .Where(i => i.IsLocalFile) .Select(i => FileSystem.GetDirectoryName(i.Path)) .Distinct(StringComparer.OrdinalIgnoreCase) - .SelectMany(i => FileSystem.GetFilePaths(i)) + .SelectMany(i => directoryService.GetFilePaths(i)) .ToList(); var deletedImages = ImageInfos diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 5fb9e517c8..03fca60c89 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -265,21 +265,6 @@ namespace MediaBrowser.Controller.Entities return changed; } - internal override bool IsValidFromResolver(BaseItem newItem) - { - var newCollectionFolder = newItem as CollectionFolder; - - if (newCollectionFolder != null) - { - if (!string.Equals(CollectionType, newCollectionFolder.CollectionType, StringComparison.OrdinalIgnoreCase)) - { - return false; - } - } - - return base.IsValidFromResolver(newItem); - } - private ItemResolveArgs CreateResolveArgs(IDirectoryService directoryService, bool setPhysicalLocations) { var path = ContainingFolderPath; diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 12183aec2f..504d03a276 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -416,7 +416,7 @@ namespace MediaBrowser.Controller.Entities { BaseItem currentChild; - if (currentChildren.TryGetValue(child.Id, out currentChild) && currentChild.IsValidFromResolver(child)) + if (currentChildren.TryGetValue(child.Id, out currentChild)) { validChildren.Add(currentChild); @@ -1421,6 +1421,16 @@ namespace MediaBrowser.Controller.Entities // Sweep through recursively and update status foreach (var item in itemsResult) { + if (item.IsVirtualItem) + { + // The querying doesn't support virtual unaired + var episode = item as Episode; + if (episode != null && episode.IsUnaired) + { + continue; + } + } + item.MarkPlayed(user, datePlayed, resetPosition); } } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 52f1dd0514..dca1cfd01b 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -84,6 +84,20 @@ namespace MediaBrowser.Controller.Entities } } + public void SetPrimaryVersionId(string id) + { + if (string.IsNullOrWhiteSpace(id)) + { + PrimaryVersionId = null; + } + else + { + PrimaryVersionId = id; + } + + PresentationUniqueKey = CreatePresentationUniqueKey(); + } + public override string CreatePresentationUniqueKey() { if (!string.IsNullOrWhiteSpace(PrimaryVersionId)) @@ -667,8 +681,6 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentNullException("media"); } - var mediaStreams = MediaSourceManager.GetMediaStreams(media.Id); - var locationType = media.LocationType; var info = new MediaSourceInfo @@ -676,8 +688,8 @@ namespace MediaBrowser.Controller.Entities Id = media.Id.ToString("N"), IsoType = media.IsoType, Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File, - MediaStreams = mediaStreams, - Name = GetMediaSourceName(media, mediaStreams), + MediaStreams = MediaSourceManager.GetMediaStreams(media.Id), + Name = GetMediaSourceName(media), Path = enablePathSubstitution ? GetMappedPath(media, media.Path, locationType) : media.Path, RunTimeTicks = media.RunTimeTicks, Video3DFormat = media.Video3DFormat, @@ -740,12 +752,20 @@ namespace MediaBrowser.Controller.Entities return info; } - private static string GetMediaSourceName(Video video, List<MediaStream> mediaStreams) + private static string GetMediaSourceName(Video video) { var terms = new List<string>(); - var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video); - var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio); + var locationType = video.LocationType; + var path = video.Path; + if ((locationType == LocationType.FileSystem || locationType == LocationType.Offline) && !string.IsNullOrWhiteSpace(path)) + { + terms.Add(System.IO.Path.GetFileName(path)); + } + else + { + terms.Add(video.Name); + } if (video.Video3DFormat.HasValue) { @@ -779,50 +799,6 @@ namespace MediaBrowser.Controller.Entities } } - if (videoStream != null) - { - if (videoStream.Width.HasValue) - { - if (videoStream.Width.Value >= 3800) - { - terms.Add("4K"); - } - else if (videoStream.Width.Value >= 1900) - { - terms.Add("1080P"); - } - else if (videoStream.Width.Value >= 1270) - { - terms.Add("720P"); - } - else if (videoStream.Width.Value >= 700) - { - terms.Add("480P"); - } - else - { - terms.Add("SD"); - } - } - } - - if (videoStream != null && !string.IsNullOrWhiteSpace(videoStream.Codec)) - { - terms.Add(videoStream.Codec.ToUpper()); - } - - if (audioStream != null) - { - var audioCodec = string.Equals(audioStream.Codec, "dca", StringComparison.OrdinalIgnoreCase) - ? audioStream.Profile - : audioStream.Codec; - - if (!string.IsNullOrEmpty(audioCodec)) - { - terms.Add(audioCodec.ToUpper()); - } - } - return string.Join("/", terms.ToArray(terms.Count)); } |
