Răsfoiți Sursa

added IsMuted to playback progress

Luke Pulverenti 11 ani în urmă
părinte
comite
982a303940

+ 4 - 1
MediaBrowser.Api/UserLibrary/UserLibraryService.cs

@@ -265,6 +265,9 @@ namespace MediaBrowser.Api.UserLibrary
 
         [ApiMember(Name = "IsPaused", Description = "Indicates if the player is paused.", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")]
         public bool IsPaused { get; set; }
+
+        [ApiMember(Name = "IsMuted", Description = "Indicates if the player is muted.", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")]
+        public bool IsMuted { get; set; }
     }
 
     /// <summary>
@@ -640,7 +643,7 @@ namespace MediaBrowser.Api.UserLibrary
 
             var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager, user.Id);
 
-            var task = _sessionManager.OnPlaybackProgress(item, request.PositionTicks, request.IsPaused, GetSession().Id);
+            var task = _sessionManager.OnPlaybackProgress(item, request.PositionTicks, request.IsPaused, request.IsMuted, GetSession().Id);
 
             Task.WaitAll(task);
         }

+ 1 - 0
MediaBrowser.Controller/Dto/SessionInfoDtoBuilder.cs

@@ -25,6 +25,7 @@ namespace MediaBrowser.Controller.Dto
                 NowPlayingPositionTicks = session.NowPlayingPositionTicks,
                 SupportsRemoteControl = session.SupportsRemoteControl,
                 IsPaused = session.IsPaused,
+                IsMuted = session.IsMuted,
                 NowViewingContext = session.NowViewingContext,
                 NowViewingItemId = session.NowViewingItemId,
                 NowViewingItemName = session.NowViewingItemName,

+ 1 - 1
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -1211,7 +1211,7 @@ namespace MediaBrowser.Controller.Entities
             else
             {
                 // Check for dupes based on the combination of Name and Type
-                if (!People.Any(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(person.Type, StringComparison.OrdinalIgnoreCase)))
+                if (!People.Any(p => string.Equals(p.Name, person.Name, StringComparison.OrdinalIgnoreCase) && string.Equals(p.Type, person.Type, StringComparison.OrdinalIgnoreCase)))
                 {
                     People.Add(person);
                 }

+ 13 - 0
MediaBrowser.Controller/Entities/Trailer.cs

@@ -1,4 +1,5 @@
 using System.Runtime.Serialization;
+using MediaBrowser.Model.Entities;
 
 namespace MediaBrowser.Controller.Entities
 {
@@ -47,5 +48,17 @@ namespace MediaBrowser.Controller.Entities
         {
             get { return !IsLocalTrailer; }
         }
+
+        public override string GetUserDataKey()
+        {
+            var key = this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tvcom);
+
+            if (!string.IsNullOrWhiteSpace(key))
+            {
+                return key + "-trailer";
+            }
+
+            return base.GetUserDataKey();
+        }
     }
 }

+ 1 - 1
MediaBrowser.Controller/Session/ISessionManager.cs

@@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Session
         /// <param name="sessionId">The session id.</param>
         /// <returns>Task.</returns>
         /// <exception cref="System.ArgumentNullException"></exception>
-        Task OnPlaybackProgress(BaseItem item, long? positionTicks, bool isPaused, Guid sessionId);
+        Task OnPlaybackProgress(BaseItem item, long? positionTicks, bool isPaused, bool isMuted, Guid sessionId);
 
         /// <summary>
         /// Used to report that playback has ended for an item

+ 7 - 1
MediaBrowser.Controller/Session/SessionInfo.cs

@@ -87,8 +87,14 @@ namespace MediaBrowser.Controller.Session
         /// Gets or sets a value indicating whether this instance is paused.
         /// </summary>
         /// <value><c>true</c> if this instance is paused; otherwise, <c>false</c>.</value>
-        public bool? IsPaused { get; set; }
+        public bool IsPaused { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance is muted.
+        /// </summary>
+        /// <value><c>true</c> if this instance is muted; otherwise, <c>false</c>.</value>
+        public bool IsMuted { get; set; }
+        
         /// <summary>
         /// Gets or sets the device id.
         /// </summary>

+ 2 - 2
MediaBrowser.Model/ApiClient/IApiClient.cs

@@ -467,7 +467,7 @@ namespace MediaBrowser.Model.ApiClient
         /// <param name="isPaused">if set to <c>true</c> [is paused].</param>
         /// <returns>Task{UserItemDataDto}.</returns>
         /// <exception cref="ArgumentNullException">itemId</exception>
-        Task ReportPlaybackProgressAsync(string itemId, string userId, long? positionTicks, bool isPaused);
+        Task ReportPlaybackProgressAsync(string itemId, string userId, long? positionTicks, bool isPaused, bool isMuted);
 
         /// <summary>
         /// Reports to the server that the user has stopped playing an item
@@ -588,7 +588,7 @@ namespace MediaBrowser.Model.ApiClient
         /// <param name="displayPreferences">The display preferences.</param>
         /// <returns>Task{DisplayPreferences}.</returns>
         /// <exception cref="System.ArgumentNullException">userId</exception>
-        Task UpdateDisplayPreferencesAsync(DisplayPreferences displayPreferences, string userId, string client);
+        Task UpdateDisplayPreferencesAsync(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken);
 
         /// <summary>
         /// Posts a set of data to a url, and deserializes the return stream into T

+ 7 - 1
MediaBrowser.Model/Session/SessionInfoDto.cs

@@ -75,8 +75,14 @@ namespace MediaBrowser.Model.Session
         /// Gets or sets a value indicating whether this instance is paused.
         /// </summary>
         /// <value><c>true</c> if this instance is paused; otherwise, <c>false</c>.</value>
-        public bool? IsPaused { get; set; }
+        public bool IsPaused { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance is muted.
+        /// </summary>
+        /// <value><c>true</c> if this instance is muted; otherwise, <c>false</c>.</value>
+        public bool IsMuted { get; set; }
+        
         /// <summary>
         /// Gets or sets the now playing item.
         /// </summary>

+ 2 - 0
MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs

@@ -108,6 +108,8 @@ namespace MediaBrowser.Providers.MediaInfo
 
             if (!audio.LockedFields.Contains(MetadataFields.Cast))
             {
+                audio.People.Clear();
+
                 var composer = GetDictionaryValue(tags, "composer");
 
                 if (!string.IsNullOrWhiteSpace(composer))

+ 5 - 5
MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs

@@ -106,14 +106,14 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
                     return FindMovie<AdultVideo>(args.Path, args.FileSystemChildren);
                 }
 
-                if (!string.IsNullOrEmpty(collectionType) &&
-                    !string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) &&
-                    !string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
+                if (string.IsNullOrEmpty(collectionType) ||
+                    string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) ||
+                    string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase))
                 {
-                    return null;
+                    return FindMovie<Movie>(args.Path, args.FileSystemChildren);
                 }
 
-                return FindMovie<Movie>(args.Path, args.FileSystemChildren);
+                return null;
             }
 
             // Find movies that are mixed in the same folder

+ 6 - 5
MediaBrowser.Server.Implementations/Session/SessionManager.cs

@@ -159,8 +159,9 @@ namespace MediaBrowser.Server.Implementations.Session
         /// <param name="item">The item.</param>
         /// <param name="isPaused">if set to <c>true</c> [is paused].</param>
         /// <param name="currentPositionTicks">The current position ticks.</param>
-        private void UpdateNowPlayingItem(SessionInfo session, BaseItem item, bool isPaused, long? currentPositionTicks = null)
+        private void UpdateNowPlayingItem(SessionInfo session, BaseItem item, bool isPaused, bool isMuted, long? currentPositionTicks = null)
         {
+            session.IsMuted = isMuted;
             session.IsPaused = isPaused;
             session.NowPlayingPositionTicks = currentPositionTicks;
             session.NowPlayingItem = item;
@@ -178,7 +179,7 @@ namespace MediaBrowser.Server.Implementations.Session
             {
                 session.NowPlayingItem = null;
                 session.NowPlayingPositionTicks = null;
-                session.IsPaused = null;
+                session.IsPaused = false;
             }
         }
 
@@ -225,7 +226,7 @@ namespace MediaBrowser.Server.Implementations.Session
 
             var session = Sessions.First(i => i.Id.Equals(sessionId));
 
-            UpdateNowPlayingItem(session, item, false);
+            UpdateNowPlayingItem(session, item, false, false);
 
             var key = item.GetUserDataKey();
 
@@ -262,7 +263,7 @@ namespace MediaBrowser.Server.Implementations.Session
         /// <returns>Task.</returns>
         /// <exception cref="System.ArgumentNullException"></exception>
         /// <exception cref="System.ArgumentOutOfRangeException">positionTicks</exception>
-        public async Task OnPlaybackProgress(BaseItem item, long? positionTicks, bool isPaused, Guid sessionId)
+        public async Task OnPlaybackProgress(BaseItem item, long? positionTicks, bool isPaused, bool isMuted, Guid sessionId)
         {
             if (item == null)
             {
@@ -276,7 +277,7 @@ namespace MediaBrowser.Server.Implementations.Session
 
             var session = Sessions.First(i => i.Id.Equals(sessionId));
 
-            UpdateNowPlayingItem(session, item, isPaused, positionTicks);
+            UpdateNowPlayingItem(session, item, isPaused, isMuted, positionTicks);
 
             var key = item.GetUserDataKey();
 

+ 2 - 1
MediaBrowser.Server.Implementations/Session/SessionWebSocketListener.cs

@@ -137,8 +137,9 @@ namespace MediaBrowser.Server.Implementations.Session
                     }
 
                     var isPaused = vals.Length > 2 && string.Equals(vals[2], "true", StringComparison.OrdinalIgnoreCase);
+                    var isMuted = vals.Length > 3 && string.Equals(vals[3], "true", StringComparison.OrdinalIgnoreCase);
 
-                    _sessionManager.OnPlaybackProgress(item, positionTicks, isPaused, session.Id);
+                    _sessionManager.OnPlaybackProgress(item, positionTicks, isPaused, isMuted, session.Id);
                 }
             }
             else if (string.Equals(message.MessageType, "PlaybackStopped", StringComparison.OrdinalIgnoreCase))

+ 6 - 2
MediaBrowser.WebDashboard/ApiClient.js

@@ -3354,7 +3354,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
          * @param {String} userId
          * @param {String} itemId
          */
-        self.reportPlaybackProgress = function (userId, itemId, positionTicks, isPaused) {
+        self.reportPlaybackProgress = function (userId, itemId, positionTicks, isPaused, isMuted) {
 
             if (!userId) {
                 throw new Error("null userId");
@@ -3368,13 +3368,17 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
 
                 var deferred = $.Deferred();
 
-                self.sendWebSocketMessage("PlaybackProgress", itemId + "|" + (positionTicks == null ? "" : positionTicks) + "|" + (isPaused == null ? "" : isPaused));
+                var  msgData = itemId + "|" + (positionTicks == null ? "" : positionTicks) + "|" + (isPaused == null ? "" : isPaused) + "|" + (isMuted == null ? "" : isMuted);
+
+                self.sendWebSocketMessage("PlaybackProgress", msgData;);
 
                 deferred.resolveWith(null, []);
                 return deferred.promise();
             }
 
             var params = {
+                isPaused: isPaused,
+                isMuted: isMuted
             };
 
             if (positionTicks) {

+ 1 - 1
MediaBrowser.WebDashboard/packages.config

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="MediaBrowser.ApiClient.Javascript" version="3.0.165" targetFramework="net45" />
+  <package id="MediaBrowser.ApiClient.Javascript" version="3.0.166" targetFramework="net45" />
   <package id="ServiceStack.Common" version="3.9.58" targetFramework="net45" />
   <package id="ServiceStack.Text" version="3.9.58" targetFramework="net45" />
 </packages>

+ 2 - 2
Nuget/MediaBrowser.Common.Internal.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common.Internal</id>
-        <version>3.0.187</version>
+        <version>3.0.188</version>
         <title>MediaBrowser.Common.Internal</title>
         <authors>Luke</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.187" />
+            <dependency id="MediaBrowser.Common" version="3.0.188" />
             <dependency id="NLog" version="2.0.1.2" />
             <dependency id="ServiceStack.Text" version="3.9.55" />
             <dependency id="SimpleInjector" version="2.3.0" />

+ 1 - 1
Nuget/MediaBrowser.Common.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Common</id>
-        <version>3.0.187</version>
+        <version>3.0.188</version>
         <title>MediaBrowser.Common</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>

+ 2 - 2
Nuget/MediaBrowser.Server.Core.nuspec

@@ -2,7 +2,7 @@
 <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
     <metadata>
         <id>MediaBrowser.Server.Core</id>
-        <version>3.0.187</version>
+        <version>3.0.188</version>
         <title>Media Browser.Server.Core</title>
         <authors>Media Browser Team</authors>
         <owners>ebr,Luke,scottisafool</owners>
@@ -12,7 +12,7 @@
         <description>Contains core components required to build plugins for Media Browser Server.</description>
         <copyright>Copyright © Media Browser 2013</copyright>
         <dependencies>
-            <dependency id="MediaBrowser.Common" version="3.0.187" />
+            <dependency id="MediaBrowser.Common" version="3.0.188" />
         </dependencies>
     </metadata>
     <files>