updated mono build

This commit is contained in:
Luke Pulverenti
2014-05-10 13:28:03 -04:00
parent b9a2af1fd5
commit 4e81655239
23 changed files with 280 additions and 102 deletions

View File

@@ -6,6 +6,7 @@ using MediaBrowser.Common.Updates;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Controller.Plugins;
@@ -257,7 +258,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
NotificationType = NotificationType.NewLibraryContent.ToString()
};
notification.Variables["Name"] = item.Name;
notification.Variables["Name"] = GetItemName(item);
await SendNotification(notification).ConfigureAwait(false);
}
@@ -274,6 +275,31 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
}
}
private string GetItemName(BaseItem item)
{
var name = item.Name;
var hasSeries = item as IHasSeries;
if (hasSeries != null)
{
name = hasSeries.SeriesName + " - " + name;
}
var hasArtist = item as IHasArtist;
if (hasArtist != null)
{
var artists = hasArtist.AllArtists;
if (artists.Count > 0)
{
name = hasArtist.AllArtists[0] + " - " + name;
}
}
return name;
}
async void _userManager_UserCreated(object sender, GenericEventArgs<User> e)
{
var notification = new NotificationRequest
@@ -286,9 +312,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
await SendNotification(notification).ConfigureAwait(false);
}
async void _taskManager_TaskCompleted(object sender, GenericEventArgs<TaskResult> e)
async void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e)
{
var result = e.Argument;
var result = e.Result;
if (result.Status == TaskCompletionStatus.Failed)
{
@@ -301,8 +327,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
NotificationType = type
};
notification.Variables["Name"] = e.Argument.Name;
notification.Variables["ErrorMessage"] = e.Argument.ErrorMessage;
notification.Variables["Name"] = result.Name;
notification.Variables["ErrorMessage"] = result.ErrorMessage;
await SendNotification(notification).ConfigureAwait(false);
}

View File

@@ -106,9 +106,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_serverManager.SendWebSocketMessage("PackageInstallationFailed", e.InstallationInfo);
}
void _taskManager_TaskCompleted(object sender, GenericEventArgs<TaskResult> e)
void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e)
{
_serverManager.SendWebSocketMessage("ScheduledTaskEnded", e.Argument);
_serverManager.SendWebSocketMessage("ScheduledTaskEnded", e.Result);
}
/// <summary>

View File

@@ -191,10 +191,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
throw new ArgumentNullException("displayPreferencesId");
}
var guidId = displayPreferencesId.GetMD5();
var cmd = _connection.CreateCommand();
cmd.CommandText = "select data from userdisplaypreferences where id = @id and userId=@userId and client=@client";
cmd.Parameters.Add(cmd, "@id", DbType.Guid).Value = displayPreferencesId.GetMD5();
cmd.Parameters.Add(cmd, "@id", DbType.Guid).Value = guidId;
cmd.Parameters.Add(cmd, "@userId", DbType.Guid).Value = userId;
cmd.Parameters.Add(cmd, "@client", DbType.String).Value = client;
@@ -209,7 +211,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
return null;
return new DisplayPreferences
{
Id = guidId.ToString("N")
};
}
/// <summary>

View File

@@ -282,7 +282,18 @@ namespace MediaBrowser.Server.Implementations.Session
if (!string.IsNullOrWhiteSpace(info.ItemId) && libraryItem != null)
{
info.Item = GetItemInfo(libraryItem, runtimeTicks, libraryItem, info.MediaSourceId);
var current = session.NowPlayingItem;
if (current == null || !string.Equals(current.Id, info.ItemId, StringComparison.OrdinalIgnoreCase))
{
info.Item = GetItemInfo(libraryItem, libraryItem, info.MediaSourceId);
}
else
{
info.Item = current;
}
info.Item.RunTimeTicks = runtimeTicks;
}
session.NowPlayingItem = info.Item;
@@ -1182,12 +1193,11 @@ namespace MediaBrowser.Server.Implementations.Session
/// Converts a BaseItem to a BaseItemInfo
/// </summary>
/// <param name="item">The item.</param>
/// <param name="runtimeTicks">The now playing runtime ticks.</param>
/// <param name="chapterOwner">The chapter owner.</param>
/// <param name="mediaSourceId">The media source identifier.</param>
/// <returns>BaseItemInfo.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
private BaseItemInfo GetItemInfo(BaseItem item, long? runtimeTicks, BaseItem chapterOwner, string mediaSourceId)
private BaseItemInfo GetItemInfo(BaseItem item, BaseItem chapterOwner, string mediaSourceId)
{
if (item == null)
{
@@ -1200,7 +1210,7 @@ namespace MediaBrowser.Server.Implementations.Session
Name = item.Name,
MediaType = item.MediaType,
Type = item.GetClientTypeName(),
RunTimeTicks = runtimeTicks,
RunTimeTicks = item.RunTimeTicks,
IndexNumber = item.IndexNumber,
ParentIndexNumber = item.ParentIndexNumber,
PremiereDate = item.PremiereDate,
@@ -1376,7 +1386,7 @@ namespace MediaBrowser.Server.Implementations.Session
{
var item = _libraryManager.GetItemById(new Guid(itemId));
var info = GetItemInfo(item, item.RunTimeTicks, null, null);
var info = GetItemInfo(item, null, null);
ReportNowViewingItem(sessionId, info);
}