aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2013-09-25 14:32:36 -0400
committerEric Reed <ebr@mediabrowser3.com>2013-09-25 14:32:36 -0400
commitc02c0db35af078e1a78897aecdade2efe57d3f06 (patch)
treeaf9ef64305efd2e353a202c27b188d2c44cd9b5b /MediaBrowser.Controller
parentc6e57c6448c04998bcae5a906e7a064300542e75 (diff)
parent2d9b48d00fd31aaa96676c82a054b2794493fbf9 (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs29
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj18
-rw-r--r--MediaBrowser.Controller/Providers/BaseMetadataProvider.cs2
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs60
-rw-r--r--MediaBrowser.Controller/Session/ISessionRemoteController.cs61
-rw-r--r--MediaBrowser.Controller/Session/PlaybackInfo.cs38
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs19
7 files changed, 210 insertions, 17 deletions
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 0d91a2e86..0f090f587 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -16,7 +16,6 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
-using MoreLinq;
namespace MediaBrowser.Controller.Entities
{
@@ -171,6 +170,25 @@ namespace MediaBrowser.Controller.Entities
return ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken);
}
+ /// <summary>
+ /// Clears the children.
+ /// </summary>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ public Task ClearChildren(CancellationToken cancellationToken)
+ {
+ var items = ActualChildren.ToList();
+
+ ClearChildrenInternal();
+
+ foreach (var item in items)
+ {
+ LibraryManager.ReportItemRemoved(item);
+ }
+
+ return ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken);
+ }
+
#region Indexing
/// <summary>
@@ -671,7 +689,7 @@ namespace MediaBrowser.Controller.Entities
var options = new ParallelOptions
{
- MaxDegreeOfParallelism = 20
+ MaxDegreeOfParallelism = 10
};
Parallel.ForEach(nonCachedChildren, options, child =>
@@ -733,6 +751,11 @@ namespace MediaBrowser.Controller.Entities
if (actualRemovals.Count > 0)
{
RemoveChildrenInternal(actualRemovals);
+
+ foreach (var item in actualRemovals)
+ {
+ LibraryManager.ReportItemRemoved(item);
+ }
}
await LibraryManager.CreateItems(newItems, cancellationToken).ConfigureAwait(false);
@@ -781,7 +804,7 @@ namespace MediaBrowser.Controller.Entities
foreach (var tuple in list)
{
- if (tasks.Count > 8)
+ if (tasks.Count > 5)
{
await Task.WhenAll(tasks).ConfigureAwait(false);
}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index f49bd8cf0..0b27a350b 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -13,6 +13,8 @@
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
+ <ProductVersion>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -42,6 +44,8 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
+ <Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
@@ -51,12 +55,9 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="MoreLinq, Version=1.0.16006.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\morelinq.1.0.16006\lib\net35\MoreLinq.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
@@ -66,6 +67,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
+ <Reference Include="MoreLinq">
+ <HintPath>..\packages\morelinq.1.0.16006\lib\net35\MoreLinq.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedVersion.cs">
@@ -165,6 +169,8 @@
<Compile Include="Kernel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Providers\BaseMetadataProvider.cs" />
+ <Compile Include="Session\ISessionRemoteController.cs" />
+ <Compile Include="Session\PlaybackInfo.cs" />
<Compile Include="Session\SessionInfo.cs" />
<Compile Include="Sorting\IBaseItemComparer.cs" />
<Compile Include="Sorting\IUserBaseItemComparer.cs" />
@@ -172,11 +178,11 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
- <Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
+ <Project>{9142EEFA-7570-41E1-BFCC-468BB571AF2F}</Project>
<Name>MediaBrowser.Common</Name>
</ProjectReference>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
- <Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
+ <Project>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</Project>
<Name>MediaBrowser.Model</Name>
</ProjectReference>
</ItemGroup>
diff --git a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
index a8dc8788f..2364debed 100644
--- a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
+++ b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
@@ -385,7 +385,7 @@ namespace MediaBrowser.Controller.Providers
var sb = new StringBuilder();
var extensions = FileStampExtensionsDictionary;
- var numExtensions = extensions.Count;
+ var numExtensions = FilestampExtensions.Length;
// Record the name of each file
// Need to sort these because accoring to msdn docs, our i/o methods are not guaranteed in any order
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index 1976c653a..0932ee52d 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -1,7 +1,9 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
+using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Session
@@ -12,6 +14,12 @@ namespace MediaBrowser.Controller.Session
public interface ISessionManager
{
/// <summary>
+ /// Adds the parts.
+ /// </summary>
+ /// <param name="remoteControllers">The remote controllers.</param>
+ void AddParts(IEnumerable<ISessionRemoteController> remoteControllers);
+
+ /// <summary>
/// Occurs when [playback start].
/// </summary>
event EventHandler<PlaybackProgressEventArgs> PlaybackStart;
@@ -47,11 +55,9 @@ namespace MediaBrowser.Controller.Session
/// <summary>
/// Used to report that playback has started for an item
/// </summary>
- /// <param name="item">The item.</param>
- /// <param name="sessionId">The session id.</param>
+ /// <param name="info">The info.</param>
/// <returns>Task.</returns>
- /// <exception cref="System.ArgumentNullException"></exception>
- Task OnPlaybackStart(BaseItem item, Guid sessionId);
+ Task OnPlaybackStart(PlaybackInfo info);
/// <summary>
/// Used to report playback progress for an item
@@ -59,6 +65,7 @@ namespace MediaBrowser.Controller.Session
/// <param name="item">The item.</param>
/// <param name="positionTicks">The position ticks.</param>
/// <param name="isPaused">if set to <c>true</c> [is paused].</param>
+ /// <param name="isMuted">if set to <c>true</c> [is muted].</param>
/// <param name="sessionId">The session id.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
@@ -73,5 +80,50 @@ namespace MediaBrowser.Controller.Session
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
Task OnPlaybackStopped(BaseItem item, long? positionTicks, Guid sessionId);
+
+ /// <summary>
+ /// Sends the system command.
+ /// </summary>
+ /// <param name="sessionId">The session id.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendSystemCommand(Guid sessionId, SystemCommand command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the message command.
+ /// </summary>
+ /// <param name="sessionId">The session id.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendMessageCommand(Guid sessionId, MessageCommand command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the play command.
+ /// </summary>
+ /// <param name="sessionId">The session id.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendPlayCommand(Guid sessionId, PlayRequest command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the browse command.
+ /// </summary>
+ /// <param name="sessionId">The session id.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendBrowseCommand(Guid sessionId, BrowseRequest command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the playstate command.
+ /// </summary>
+ /// <param name="sessionId">The session id.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendPlaystateCommand(Guid sessionId, PlaystateRequest command, CancellationToken cancellationToken);
}
} \ No newline at end of file
diff --git a/MediaBrowser.Controller/Session/ISessionRemoteController.cs b/MediaBrowser.Controller/Session/ISessionRemoteController.cs
new file mode 100644
index 000000000..9ba5c983d
--- /dev/null
+++ b/MediaBrowser.Controller/Session/ISessionRemoteController.cs
@@ -0,0 +1,61 @@
+using MediaBrowser.Model.Session;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Controller.Session
+{
+ public interface ISessionRemoteController
+ {
+ /// <summary>
+ /// Supportses the specified session.
+ /// </summary>
+ /// <param name="session">The session.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
+ bool Supports(SessionInfo session);
+
+ /// <summary>
+ /// Sends the system command.
+ /// </summary>
+ /// <param name="session">The session.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendSystemCommand(SessionInfo session, SystemCommand command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the message command.
+ /// </summary>
+ /// <param name="session">The session.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendMessageCommand(SessionInfo session, MessageCommand command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the play command.
+ /// </summary>
+ /// <param name="session">The session.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendPlayCommand(SessionInfo session, PlayRequest command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the browse command.
+ /// </summary>
+ /// <param name="session">The session.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendBrowseCommand(SessionInfo session, BrowseRequest command, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the playstate command.
+ /// </summary>
+ /// <param name="session">The session.</param>
+ /// <param name="command">The command.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendPlaystateCommand(SessionInfo session, PlaystateRequest command, CancellationToken cancellationToken);
+ }
+}
diff --git a/MediaBrowser.Controller/Session/PlaybackInfo.cs b/MediaBrowser.Controller/Session/PlaybackInfo.cs
new file mode 100644
index 000000000..ab3111e76
--- /dev/null
+++ b/MediaBrowser.Controller/Session/PlaybackInfo.cs
@@ -0,0 +1,38 @@
+using MediaBrowser.Controller.Entities;
+using System;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Controller.Session
+{
+ public class PlaybackInfo
+ {
+ public PlaybackInfo()
+ {
+ QueueableMediaTypes = new List<string>();
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance can seek.
+ /// </summary>
+ /// <value><c>true</c> if this instance can seek; otherwise, <c>false</c>.</value>
+ public bool CanSeek { get; set; }
+
+ /// <summary>
+ /// Gets or sets the queueable media types.
+ /// </summary>
+ /// <value>The queueable media types.</value>
+ public List<string> QueueableMediaTypes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the item.
+ /// </summary>
+ /// <value>The item.</value>
+ public BaseItem Item { get; set; }
+
+ /// <summary>
+ /// Gets or sets the session id.
+ /// </summary>
+ /// <value>The session id.</value>
+ public Guid SessionId { get; set; }
+ }
+}
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index 6c0f1a085..dc934b70a 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -15,9 +15,22 @@ namespace MediaBrowser.Controller.Session
public SessionInfo()
{
WebSockets = new List<IWebSocketConnection>();
+ QueueableMediaTypes = new List<string>();
}
/// <summary>
+ /// Gets or sets a value indicating whether this instance can seek.
+ /// </summary>
+ /// <value><c>true</c> if this instance can seek; otherwise, <c>false</c>.</value>
+ public bool CanSeek { get; set; }
+
+ /// <summary>
+ /// Gets or sets the queueable media types.
+ /// </summary>
+ /// <value>The queueable media types.</value>
+ public List<string> QueueableMediaTypes { get; set; }
+
+ /// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
@@ -70,7 +83,7 @@ namespace MediaBrowser.Controller.Session
/// </summary>
/// <value>The name of the now viewing item.</value>
public string NowViewingItemName { get; set; }
-
+
/// <summary>
/// Gets or sets the now playing item.
/// </summary>
@@ -94,7 +107,7 @@ namespace MediaBrowser.Controller.Session
/// </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>
@@ -126,7 +139,7 @@ namespace MediaBrowser.Controller.Session
return WebSockets.Any(i => i.State == WebSocketState.Open);
}
- return (DateTime.UtcNow - LastActivityDate).TotalMinutes <= 5;
+ return (DateTime.UtcNow - LastActivityDate).TotalMinutes <= 10;
}
}