aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Channels/Channel.cs2
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs11
-rw-r--r--MediaBrowser.Controller/Entities/User.cs2
-rw-r--r--MediaBrowser.Controller/IServerApplicationPaths.cs6
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs7
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvChannel.cs5
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvProgram.cs5
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs5
-rw-r--r--MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs12
-rw-r--r--MediaBrowser.Controller/Session/ISessionController.cs10
-rw-r--r--MediaBrowser.Controller/Session/ISessionManager.cs11
-rw-r--r--MediaBrowser.Controller/Session/SessionInfo.cs5
12 files changed, 63 insertions, 18 deletions
diff --git a/MediaBrowser.Controller/Channels/Channel.cs b/MediaBrowser.Controller/Channels/Channel.cs
index 5a9fc3322..6ee6fe006 100644
--- a/MediaBrowser.Controller/Channels/Channel.cs
+++ b/MediaBrowser.Controller/Channels/Channel.cs
@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Channels
public override bool IsVisible(User user)
{
- if (user.Policy.BlockedChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
+ if (!user.Policy.EnableAllChannels && !user.Policy.EnabledChannels.Contains(Id.ToString("N"), StringComparer.OrdinalIgnoreCase))
{
return false;
}
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index ee562d8b4..6a30df7fe 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -379,7 +379,14 @@ namespace MediaBrowser.Controller.Entities
public string GetInternalMetadataPath()
{
- return GetInternalMetadataPath(ConfigurationManager.ApplicationPaths.InternalMetadataPath);
+ var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
+
+ if (ConfigurationManager.Configuration.EnableLibraryMetadataSubFolder)
+ {
+ basePath = System.IO.Path.Combine(basePath, "library");
+ }
+
+ return GetInternalMetadataPath(basePath);
}
protected virtual string GetInternalMetadataPath(string basePath)
@@ -1458,7 +1465,7 @@ namespace MediaBrowser.Controller.Entities
currentFile.Attributes &= ~FileAttributes.Hidden;
}
- currentFile.Delete();
+ FileSystem.DeleteFile(currentFile.FullName);
}
return UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
index 626afcfdf..869c30ba8 100644
--- a/MediaBrowser.Controller/Entities/User.cs
+++ b/MediaBrowser.Controller/Entities/User.cs
@@ -177,7 +177,7 @@ namespace MediaBrowser.Controller.Entities
// Exceptions will be thrown if these paths already exist
if (Directory.Exists(newConfigDirectory))
{
- Directory.Delete(newConfigDirectory, true);
+ FileSystem.DeleteDirectory(newConfigDirectory, true);
}
if (Directory.Exists(oldConfigurationDirectory))
diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs
index e3438c3d2..c07934d0b 100644
--- a/MediaBrowser.Controller/IServerApplicationPaths.cs
+++ b/MediaBrowser.Controller/IServerApplicationPaths.cs
@@ -60,12 +60,6 @@ namespace MediaBrowser.Controller
string GameGenrePath { get; }
/// <summary>
- /// Gets the artists path.
- /// </summary>
- /// <value>The artists path.</value>
- string ArtistsPath { get; }
-
- /// <summary>
/// Gets the path to the Studio directory
/// </summary>
/// <value>The studio path.</value>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
index b95d67ad8..f29204689 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs
@@ -1,8 +1,8 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
-using System.Linq;
using MediaBrowser.Model.Users;
+using System.Linq;
namespace MediaBrowser.Controller.LiveTv
{
@@ -83,5 +83,10 @@ namespace MediaBrowser.Controller.LiveTv
{
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
+ }
}
}
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
index de72accff..459ead16c 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs
@@ -145,5 +145,10 @@ namespace MediaBrowser.Controller.LiveTv
return list;
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"), "metadata");
+ }
}
}
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
index 29b23a551..74cf950d4 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
@@ -204,5 +204,10 @@ namespace MediaBrowser.Controller.LiveTv
{
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
+ }
}
}
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
index 6fc985643..91edc06c1 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs
@@ -83,5 +83,10 @@ namespace MediaBrowser.Controller.LiveTv
{
return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
}
+
+ protected override string GetInternalMetadataPath(string basePath)
+ {
+ return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
+ }
}
}
diff --git a/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs b/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs
index 4a807df7a..b18651a68 100644
--- a/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs
+++ b/MediaBrowser.Controller/MediaEncoding/MediaStreamSelector.cs
@@ -38,7 +38,8 @@ namespace MediaBrowser.Controller.MediaEncoding
SubtitlePlaybackMode mode,
string audioTrackLanguage)
{
- streams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages).ToList();
+ streams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages)
+ .ToList();
var full = streams.Where(s => !s.IsForced);
@@ -81,11 +82,9 @@ namespace MediaBrowser.Controller.MediaEncoding
private static IEnumerable<MediaStream> GetSortedStreams(IEnumerable<MediaStream> streams, MediaStreamType type, List<string> languagePreferences)
{
- var orderStreams = streams
- .Where(i => i.Type == type);
-
// Give some preferance to external text subs for better performance
- return orderStreams.OrderBy(i =>
+ return streams.Where(i => i.Type == type)
+ .OrderBy(i =>
{
var index = languagePreferences.FindIndex(l => string.Equals(i.Language, l, StringComparison.OrdinalIgnoreCase));
@@ -94,8 +93,7 @@ namespace MediaBrowser.Controller.MediaEncoding
.ThenBy(i => i.IsDefault)
.ThenBy(i => i.IsTextSubtitleStream)
.ThenBy(i => i.IsExternal)
- .ThenBy(i => i.Index)
- .ToList();
+ .ThenBy(i => i.Index);
}
}
}
diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs
index d6dd7698e..a4badee47 100644
--- a/MediaBrowser.Controller/Session/ISessionController.cs
+++ b/MediaBrowser.Controller/Session/ISessionController.cs
@@ -105,5 +105,15 @@ namespace MediaBrowser.Controller.Session
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendServerRestartNotification(CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Sends the message.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="name">The name.</param>
+ /// <param name="data">The data.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendMessage<T>(string name, T data, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Controller/Session/ISessionManager.cs b/MediaBrowser.Controller/Session/ISessionManager.cs
index f0272b335..1f273a3ee 100644
--- a/MediaBrowser.Controller/Session/ISessionManager.cs
+++ b/MediaBrowser.Controller/Session/ISessionManager.cs
@@ -171,6 +171,17 @@ namespace MediaBrowser.Controller.Session
Task SendPlaystateCommand(string controllingSessionId, string sessionId, PlaystateRequest command, CancellationToken cancellationToken);
/// <summary>
+ /// Sends the message to user sessions.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="userId">The user identifier.</param>
+ /// <param name="name">The name.</param>
+ /// <param name="data">The data.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendMessageToUserSessions<T>(string userId, string name, T data, CancellationToken cancellationToken);
+
+ /// <summary>
/// Sends the restart required message.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs
index d8a2464d6..078d4d70f 100644
--- a/MediaBrowser.Controller/Session/SessionInfo.cs
+++ b/MediaBrowser.Controller/Session/SessionInfo.cs
@@ -160,6 +160,11 @@ namespace MediaBrowser.Controller.Session
}
}
+ public bool ContainsUser(string userId)
+ {
+ return ContainsUser(new Guid(userId));
+ }
+
public bool ContainsUser(Guid userId)
{
return (UserId ?? Guid.Empty) == userId || AdditionalUsers.Any(i => userId == new Guid(i.UserId));