add short overview
This commit is contained in:
parent
a55d156fd6
commit
22fc0b442a
|
@ -88,9 +88,14 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
var auth = AuthorizationRequestFilterAttribute.GetAuthorization(Request);
|
var auth = AuthorizationRequestFilterAttribute.GetAuthorization(Request);
|
||||||
|
|
||||||
return sessionManager.Sessions.First(i => string.Equals(i.DeviceId, auth.DeviceId) &&
|
var session = sessionManager.GetSession(auth.DeviceId, auth.Client, auth.Version);
|
||||||
string.Equals(i.Client, auth.Client) &&
|
|
||||||
string.Equals(i.ApplicationVersion, auth.Version));
|
if (session == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Session not found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -285,7 +285,7 @@ namespace MediaBrowser.Api
|
||||||
SeekPositionTicks = request.SeekPositionTicks
|
SeekPositionTicks = request.SeekPositionTicks
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendPlaystateCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendPlaystateCommand(GetSession(_sessionManager).Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ namespace MediaBrowser.Api
|
||||||
ItemType = request.ItemType
|
ItemType = request.ItemType
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendBrowseCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendBrowseCommand(GetSession(_sessionManager).Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
if (Enum.TryParse(request.Command, true, out commandType))
|
if (Enum.TryParse(request.Command, true, out commandType))
|
||||||
{
|
{
|
||||||
var currentSession = GetSession();
|
var currentSession = GetSession(_sessionManager);
|
||||||
|
|
||||||
var command = new GeneralCommand
|
var command = new GeneralCommand
|
||||||
{
|
{
|
||||||
|
@ -345,7 +345,7 @@ namespace MediaBrowser.Api
|
||||||
Text = request.Text
|
Text = request.Text
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendMessageCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendMessageCommand(GetSession(_sessionManager).Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
|
@ -364,14 +364,14 @@ namespace MediaBrowser.Api
|
||||||
StartPositionTicks = request.StartPositionTicks
|
StartPositionTicks = request.StartPositionTicks
|
||||||
};
|
};
|
||||||
|
|
||||||
var task = _sessionManager.SendPlayCommand(GetSession().Id, request.Id, command, CancellationToken.None);
|
var task = _sessionManager.SendPlayCommand(GetSession(_sessionManager).Id, request.Id, command, CancellationToken.None);
|
||||||
|
|
||||||
Task.WaitAll(task);
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Post(SendGeneralCommand request)
|
public void Post(SendGeneralCommand request)
|
||||||
{
|
{
|
||||||
var currentSession = GetSession();
|
var currentSession = GetSession(_sessionManager);
|
||||||
|
|
||||||
var command = new GeneralCommand
|
var command = new GeneralCommand
|
||||||
{
|
{
|
||||||
|
@ -386,7 +386,7 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
public void Post(SendFullGeneralCommand request)
|
public void Post(SendFullGeneralCommand request)
|
||||||
{
|
{
|
||||||
var currentSession = GetSession();
|
var currentSession = GetSession(_sessionManager);
|
||||||
|
|
||||||
request.ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null;
|
request.ControllingUserId = currentSession.UserId.HasValue ? currentSession.UserId.Value.ToString("N") : null;
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(request.Id))
|
if (string.IsNullOrWhiteSpace(request.Id))
|
||||||
{
|
{
|
||||||
request.Id = GetSession().Id;
|
request.Id = GetSession(_sessionManager).Id;
|
||||||
}
|
}
|
||||||
_sessionManager.ReportCapabilities(request.Id, new SessionCapabilities
|
_sessionManager.ReportCapabilities(request.Id, new SessionCapabilities
|
||||||
{
|
{
|
||||||
|
@ -422,14 +422,5 @@ namespace MediaBrowser.Api
|
||||||
MessageCallbackUrl = request.MessageCallbackUrl
|
MessageCallbackUrl = request.MessageCallbackUrl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private SessionInfo GetSession()
|
|
||||||
{
|
|
||||||
var auth = AuthorizationRequestFilterAttribute.GetAuthorization(Request);
|
|
||||||
|
|
||||||
return _sessionManager.Sessions.First(i => string.Equals(i.DeviceId, auth.DeviceId) &&
|
|
||||||
string.Equals(i.Client, auth.Client) &&
|
|
||||||
string.Equals(i.ApplicationVersion, auth.Version));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -239,5 +239,14 @@ namespace MediaBrowser.Controller.Session
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceId">The device identifier.</param>
|
/// <param name="deviceId">The device identifier.</param>
|
||||||
void ClearTranscodingInfo(string deviceId);
|
void ClearTranscodingInfo(string deviceId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the session.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceId">The device identifier.</param>
|
||||||
|
/// <param name="client">The client.</param>
|
||||||
|
/// <param name="version">The version.</param>
|
||||||
|
/// <returns>SessionInfo.</returns>
|
||||||
|
SessionInfo GetSession(string deviceId, string client, string version);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -146,34 +146,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
return string.Format(CommandBase, action.Name, xmlNamesapce, stateString);
|
return string.Format(CommandBase, action.Name, xmlNamesapce, stateString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string BuildSearchPost(ServiceAction action, string xmlNamesapce, object value, string commandParameter = "")
|
|
||||||
{
|
|
||||||
var stateString = string.Empty;
|
|
||||||
|
|
||||||
foreach (var arg in action.ArgumentList)
|
|
||||||
{
|
|
||||||
if (arg.Direction == "out")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (arg.Name == "ObjectID")
|
|
||||||
stateString += BuildArgumentXml(arg, value.ToString());
|
|
||||||
else if (arg.Name == "Filter")
|
|
||||||
stateString += BuildArgumentXml(arg, "*");
|
|
||||||
else if (arg.Name == "StartingIndex")
|
|
||||||
stateString += BuildArgumentXml(arg, "0");
|
|
||||||
else if (arg.Name == "RequestedCount")
|
|
||||||
stateString += BuildArgumentXml(arg, "200");
|
|
||||||
else if (arg.Name == "BrowseFlag")
|
|
||||||
stateString += BuildArgumentXml(arg, null, "BrowseDirectChildren");
|
|
||||||
else if (arg.Name == "SortCriteria")
|
|
||||||
stateString += BuildArgumentXml(arg, "");
|
|
||||||
else
|
|
||||||
stateString += BuildArgumentXml(arg, value.ToString(), commandParameter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format(CommandBase, action.Name, xmlNamesapce, stateString);
|
|
||||||
}
|
|
||||||
|
|
||||||
public string BuildPost(ServiceAction action, string xmlNamesapce, object value, Dictionary<string, string> dictionary)
|
public string BuildPost(ServiceAction action, string xmlNamesapce, object value, Dictionary<string, string> dictionary)
|
||||||
{
|
{
|
||||||
var stateString = string.Empty;
|
var stateString = string.Empty;
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
"MusicbrainzId",
|
"MusicbrainzId",
|
||||||
|
|
||||||
"Overview",
|
"Overview",
|
||||||
|
"ShortOverview",
|
||||||
"Persons",
|
"Persons",
|
||||||
"PlotKeywords",
|
"PlotKeywords",
|
||||||
"PremiereDate",
|
"PremiereDate",
|
||||||
|
@ -257,6 +258,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(item.Overview))
|
||||||
|
{
|
||||||
|
builder.Append("<Overview><![CDATA[" + item.Overview + "]]></Overview>");
|
||||||
|
}
|
||||||
|
|
||||||
var hasShortOverview = item as IHasShortOverview;
|
var hasShortOverview = item as IHasShortOverview;
|
||||||
if (hasShortOverview != null)
|
if (hasShortOverview != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,32 +67,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||||
/// <returns><c>true</c> if [is music album] [the specified data]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is music album] [the specified data]; otherwise, <c>false</c>.</returns>
|
||||||
public static bool IsMusicAlbum(string path, IDirectoryService directoryService)
|
public static bool IsMusicAlbum(string path, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
// If list contains at least 2 audio files or at least one and no video files consider it to contain music
|
return ContainsMusic(directoryService.GetFileSystemEntries(path));
|
||||||
var foundAudio = 0;
|
|
||||||
|
|
||||||
foreach (var file in directoryService.GetFiles(path))
|
|
||||||
{
|
|
||||||
var fullName = file.FullName;
|
|
||||||
|
|
||||||
if (EntityResolutionHelper.IsAudioFile(fullName))
|
|
||||||
{
|
|
||||||
// Don't resolve these into audio files
|
|
||||||
if (string.Equals(Path.GetFileNameWithoutExtension(fullName), BaseItem.ThemeSongFilename) && EntityResolutionHelper.IsAudioFile(fullName))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foundAudio++;
|
|
||||||
}
|
|
||||||
if (foundAudio >= 2)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (EntityResolutionHelper.IsVideoFile(fullName)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// or a single audio file and no video files
|
|
||||||
return foundAudio > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -122,15 +97,31 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||||
// If list contains at least 2 audio files or at least one and no video files consider it to contain music
|
// If list contains at least 2 audio files or at least one and no video files consider it to contain music
|
||||||
var foundAudio = 0;
|
var foundAudio = 0;
|
||||||
|
|
||||||
foreach (var file in list)
|
foreach (var fileSystemInfo in list)
|
||||||
{
|
{
|
||||||
var fullName = file.FullName;
|
// TODO: Support disc 1, disc 2, etc
|
||||||
|
if ((fileSystemInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (EntityResolutionHelper.IsAudioFile(fullName)) foundAudio++;
|
var fullName = fileSystemInfo.FullName;
|
||||||
|
|
||||||
|
if (EntityResolutionHelper.IsAudioFile(fullName))
|
||||||
|
{
|
||||||
|
// Don't resolve these into audio files
|
||||||
|
if (string.Equals(Path.GetFileNameWithoutExtension(fullName), BaseItem.ThemeSongFilename) && EntityResolutionHelper.IsAudioFile(fullName))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foundAudio++;
|
||||||
|
}
|
||||||
if (foundAudio >= 2)
|
if (foundAudio >= 2)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EntityResolutionHelper.IsVideoFile(fullName)) return false;
|
if (EntityResolutionHelper.IsVideoFile(fullName)) return false;
|
||||||
if (EntityResolutionHelper.IsVideoPlaceHolder(fullName)) return false;
|
if (EntityResolutionHelper.IsVideoPlaceHolder(fullName)) return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1516,5 +1516,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
ReportTranscodingInfo(deviceId, null);
|
ReportTranscodingInfo(deviceId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SessionInfo GetSession(string deviceId, string client, string version)
|
||||||
|
{
|
||||||
|
return Sessions.FirstOrDefault(i => string.Equals(i.DeviceId, deviceId) &&
|
||||||
|
string.Equals(i.Client, client));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -113,21 +113,13 @@ namespace MediaBrowser.Server.Implementations.Session
|
||||||
var version = vals[2];
|
var version = vals[2];
|
||||||
var deviceName = vals.Length > 3 ? vals[3] : string.Empty;
|
var deviceName = vals.Length > 3 ? vals[3] : string.Empty;
|
||||||
|
|
||||||
var session = _sessionManager.Sessions
|
var session = _sessionManager.GetSession(deviceId, client, version);
|
||||||
.FirstOrDefault(i => string.Equals(i.DeviceId, deviceId) &&
|
|
||||||
string.Equals(i.Client, client) &&
|
|
||||||
string.Equals(i.ApplicationVersion, version));
|
|
||||||
|
|
||||||
if (session == null && !string.IsNullOrEmpty(deviceName))
|
if (session == null && !string.IsNullOrEmpty(deviceName))
|
||||||
{
|
{
|
||||||
_logger.Debug("Logging session activity");
|
_logger.Debug("Logging session activity");
|
||||||
|
|
||||||
await _sessionManager.LogSessionActivity(client, version, deviceId, deviceName, message.Connection.RemoteEndPoint, null).ConfigureAwait(false);
|
session = await _sessionManager.LogSessionActivity(client, version, deviceId, deviceName, message.Connection.RemoteEndPoint, null).ConfigureAwait(false);
|
||||||
|
|
||||||
session = _sessionManager.Sessions
|
|
||||||
.FirstOrDefault(i => string.Equals(i.DeviceId, deviceId) &&
|
|
||||||
string.Equals(i.Client, client) &&
|
|
||||||
string.Equals(i.ApplicationVersion, version));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session != null)
|
if (session != null)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user