re-enable mobile media controller
This commit is contained in:
parent
e9fb806478
commit
98c0b28d14
|
@ -350,11 +350,11 @@ namespace MediaBrowser.Api.Playback
|
|||
switch (qualitySetting)
|
||||
{
|
||||
case EncodingQuality.HighSpeed:
|
||||
crf = "12";
|
||||
crf = "16";
|
||||
profileScore = 2;
|
||||
break;
|
||||
case EncodingQuality.HighQuality:
|
||||
crf = "8";
|
||||
crf = "10";
|
||||
profileScore = 1;
|
||||
break;
|
||||
case EncodingQuality.MaxQuality:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Text;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Events;
|
||||
using MediaBrowser.Common.Implementations.Archiving;
|
||||
using MediaBrowser.Common.Implementations.IO;
|
||||
|
@ -26,6 +25,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace MediaBrowser.Common.Implementations
|
|||
/// <summary>
|
||||
/// Occurs when [application updated].
|
||||
/// </summary>
|
||||
public event EventHandler<GenericEventArgs<Version>> ApplicationUpdated;
|
||||
public event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has changes that require the entire application to restart.
|
||||
|
@ -759,12 +759,16 @@ namespace MediaBrowser.Common.Implementations
|
|||
/// <summary>
|
||||
/// Called when [application updated].
|
||||
/// </summary>
|
||||
/// <param name="newVersion">The new version.</param>
|
||||
protected void OnApplicationUpdated(Version newVersion)
|
||||
/// <param name="package">The package.</param>
|
||||
protected void OnApplicationUpdated(PackageVersionInfo package)
|
||||
{
|
||||
Logger.Info("Application has been updated to version {0}", newVersion);
|
||||
Logger.Info("Application has been updated to version {0}", package.versionStr);
|
||||
|
||||
EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs<Version> { Argument = newVersion }, Logger);
|
||||
EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs<PackageVersionInfo>
|
||||
{
|
||||
Argument = package
|
||||
|
||||
}, Logger);
|
||||
|
||||
NotifyPendingRestart();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace MediaBrowser.Common
|
|||
/// <summary>
|
||||
/// Occurs when [application updated].
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<Version>> ApplicationUpdated;
|
||||
event EventHandler<GenericEventArgs<PackageVersionInfo>> ApplicationUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is running as service.
|
||||
|
|
|
@ -30,7 +30,6 @@ namespace MediaBrowser.Dlna.Main
|
|||
private readonly IHttpClient _httpClient;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly INetworkManager _networkManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDlnaManager _dlnaManager;
|
||||
private readonly IDtoService _dtoService;
|
||||
|
@ -41,7 +40,7 @@ namespace MediaBrowser.Dlna.Main
|
|||
private readonly List<Guid> _registeredServerIds = new List<Guid>();
|
||||
private bool _dlnaServerStarted;
|
||||
|
||||
public DlnaEntryPoint(IServerConfigurationManager config, ILogManager logManager, IServerApplicationHost appHost, INetworkManager network, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepo, ILibraryManager libraryManager, INetworkManager networkManager, IUserManager userManager, IDlnaManager dlnaManager, IDtoService dtoService, IImageProcessor imageProcessor)
|
||||
public DlnaEntryPoint(IServerConfigurationManager config, ILogManager logManager, IServerApplicationHost appHost, INetworkManager network, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IDtoService dtoService, IImageProcessor imageProcessor)
|
||||
{
|
||||
_config = config;
|
||||
_appHost = appHost;
|
||||
|
@ -50,7 +49,6 @@ namespace MediaBrowser.Dlna.Main
|
|||
_httpClient = httpClient;
|
||||
_itemRepo = itemRepo;
|
||||
_libraryManager = libraryManager;
|
||||
_networkManager = networkManager;
|
||||
_userManager = userManager;
|
||||
_dlnaManager = dlnaManager;
|
||||
_dtoService = dtoService;
|
||||
|
@ -196,7 +194,6 @@ namespace MediaBrowser.Dlna.Main
|
|||
_httpClient,
|
||||
_itemRepo,
|
||||
_libraryManager,
|
||||
_networkManager,
|
||||
_userManager,
|
||||
_dlnaManager,
|
||||
_appHost,
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Dlna;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
@ -31,15 +29,14 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IItemRepository _itemRepository;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly INetworkManager _networkManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDlnaManager _dlnaManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IImageProcessor _imageProcessor;
|
||||
|
||||
private readonly SsdpHandler _ssdpHandler;
|
||||
private readonly string _serverAddress;
|
||||
|
||||
public bool SupportsMediaRemoteControl
|
||||
{
|
||||
|
@ -54,19 +51,18 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, INetworkManager networkManager, IDlnaManager dlnaManager, IUserManager userManager, IServerApplicationHost appHost, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler)
|
||||
public PlayToController(SessionInfo session, ISessionManager sessionManager, IItemRepository itemRepository, ILibraryManager libraryManager, ILogger logger, IDlnaManager dlnaManager, IUserManager userManager, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler, string serverAddress)
|
||||
{
|
||||
_session = session;
|
||||
_itemRepository = itemRepository;
|
||||
_sessionManager = sessionManager;
|
||||
_libraryManager = libraryManager;
|
||||
_networkManager = networkManager;
|
||||
_dlnaManager = dlnaManager;
|
||||
_userManager = userManager;
|
||||
_appHost = appHost;
|
||||
_dtoService = dtoService;
|
||||
_imageProcessor = imageProcessor;
|
||||
_ssdpHandler = ssdpHandler;
|
||||
_serverAddress = serverAddress;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -81,6 +77,11 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
_ssdpHandler.MessageReceived += _SsdpHandler_MessageReceived;
|
||||
}
|
||||
|
||||
private string GetServerAddress()
|
||||
{
|
||||
return _serverAddress;
|
||||
}
|
||||
|
||||
async void _SsdpHandler_MessageReceived(object sender, SsdpMessageEventArgs e)
|
||||
{
|
||||
string nts;
|
||||
|
@ -93,17 +94,20 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
if (!e.Headers.TryGetValue("NT", out nt)) nt = string.Empty;
|
||||
|
||||
if (string.Equals(e.Method, "NOTIFY", StringComparison.OrdinalIgnoreCase) &&
|
||||
string.Equals(nts, "ssdp:byebye", StringComparison.OrdinalIgnoreCase))
|
||||
string.Equals(nts, "ssdp:byebye", StringComparison.OrdinalIgnoreCase) &&
|
||||
usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1 &&
|
||||
!_disposed)
|
||||
{
|
||||
if (usn.IndexOf(_device.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1)
|
||||
if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||
nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||
nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
try
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
await _sessionManager.ReportSessionEnded(_session.Id).ConfigureAwait(false);
|
||||
}
|
||||
await _sessionManager.ReportSessionEnded(_session.Id).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Could throw if the session is already gone
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -368,16 +372,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
private string GetServerAddress()
|
||||
{
|
||||
return string.Format("{0}://{1}:{2}/mediabrowser",
|
||||
|
||||
"http",
|
||||
_networkManager.GetLocalIpAddresses().FirstOrDefault() ?? "localhost",
|
||||
_appHost.HttpServerPort
|
||||
);
|
||||
}
|
||||
|
||||
private PlaylistItem CreatePlaylistItem(BaseItem item, long startPostionTicks, string serverAddress)
|
||||
{
|
||||
var deviceInfo = _device.Properties;
|
||||
|
|
|
@ -32,7 +32,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
|
||||
private readonly IItemRepository _itemRepository;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly INetworkManager _networkManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDlnaManager _dlnaManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
@ -42,7 +41,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
|
||||
private readonly SsdpHandler _ssdpHandler;
|
||||
|
||||
public PlayToManager(ILogger logger, IServerConfigurationManager config, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepository, ILibraryManager libraryManager, INetworkManager networkManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler)
|
||||
public PlayToManager(ILogger logger, IServerConfigurationManager config, ISessionManager sessionManager, IHttpClient httpClient, IItemRepository itemRepository, ILibraryManager libraryManager, IUserManager userManager, IDlnaManager dlnaManager, IServerApplicationHost appHost, IDtoService dtoService, IImageProcessor imageProcessor, SsdpHandler ssdpHandler)
|
||||
{
|
||||
_tokenSource = new CancellationTokenSource();
|
||||
|
||||
|
@ -51,7 +50,6 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
_httpClient = httpClient;
|
||||
_itemRepository = itemRepository;
|
||||
_libraryManager = libraryManager;
|
||||
_networkManager = networkManager;
|
||||
_userManager = userManager;
|
||||
_dlnaManager = dlnaManager;
|
||||
_appHost = appHost;
|
||||
|
@ -137,7 +135,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
{
|
||||
var args = SsdpHelper.ParseSsdpResponse(receiveBuffer, endPoint);
|
||||
|
||||
TryCreateController(args);
|
||||
TryCreateController(args, localIp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +152,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
}, _tokenSource.Token, TaskCreationOptions.LongRunning);
|
||||
}
|
||||
|
||||
private void TryCreateController(SsdpMessageEventArgs args)
|
||||
private void TryCreateController(SsdpMessageEventArgs args, IPAddress localIp)
|
||||
{
|
||||
string nts;
|
||||
args.Headers.TryGetValue("NTS", out nts);
|
||||
|
@ -203,7 +201,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
{
|
||||
try
|
||||
{
|
||||
await CreateController(new Uri(location)).ConfigureAwait(false);
|
||||
await CreateController(new Uri(location), localIp).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
@ -264,7 +262,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
/// </summary>
|
||||
/// <param name="uri">The URI.</param>
|
||||
/// <returns></returns>
|
||||
private async Task CreateController(Uri uri)
|
||||
private async Task CreateController(Uri uri, IPAddress localIp)
|
||||
{
|
||||
var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger).ConfigureAwait(false);
|
||||
|
||||
|
@ -277,7 +275,19 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
|
||||
if (controller == null)
|
||||
{
|
||||
sessionInfo.SessionController = controller = new PlayToController(sessionInfo, _sessionManager, _itemRepository, _libraryManager, _logger, _networkManager, _dlnaManager, _userManager, _appHost, _dtoService, _imageProcessor, _ssdpHandler);
|
||||
var serverAddress = GetServerAddress(localIp);
|
||||
|
||||
sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
|
||||
_sessionManager,
|
||||
_itemRepository,
|
||||
_libraryManager,
|
||||
_logger,
|
||||
_dlnaManager,
|
||||
_userManager,
|
||||
_dtoService,
|
||||
_imageProcessor,
|
||||
_ssdpHandler,
|
||||
serverAddress);
|
||||
|
||||
controller.Init(device);
|
||||
|
||||
|
@ -304,6 +314,16 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
}
|
||||
}
|
||||
|
||||
private string GetServerAddress(IPAddress localIp)
|
||||
{
|
||||
return string.Format("{0}://{1}:{2}/mediabrowser",
|
||||
|
||||
"http",
|
||||
localIp,
|
||||
_appHost.HttpServerPort
|
||||
);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposed)
|
||||
|
|
|
@ -551,9 +551,8 @@ namespace MediaBrowser.Model.ApiClient
|
|||
/// <param name="itemId">The id of the item to browse to.</param>
|
||||
/// <param name="itemName">The name of the item to browse to.</param>
|
||||
/// <param name="itemType">The type of the item to browse to.</param>
|
||||
/// <param name="context">Optional ui context (movies, music, tv, games, etc). The client is free to ignore this.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SendBrowseCommandAsync(string sessionId, string itemId, string itemName, string itemType, string context);
|
||||
Task SendBrowseCommandAsync(string sessionId, string itemId, string itemName, string itemType);
|
||||
|
||||
/// <summary>
|
||||
/// Sends the playstate command async.
|
||||
|
|
|
@ -145,6 +145,12 @@ namespace MediaBrowser.Model.Configuration
|
|||
/// <value>The title format string.</value>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the disabled services.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace MediaBrowser.Model.Notifications
|
|||
|
||||
public string DefaultTitle { get; set; }
|
||||
|
||||
public string DefaultDescription { get; set; }
|
||||
|
||||
public List<string> Variables { get; set; }
|
||||
|
||||
public NotificationTypeInfo()
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
|
|||
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
|
||||
}
|
||||
|
||||
async void _appHost_ApplicationUpdated(object sender, GenericEventArgs<Version> e)
|
||||
async void _appHost_ApplicationUpdated(object sender, GenericEventArgs<PackageVersionInfo> e)
|
||||
{
|
||||
var type = NotificationType.ApplicationUpdateInstalled.ToString();
|
||||
|
||||
|
@ -79,8 +79,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
|
|||
NotificationType = type
|
||||
};
|
||||
|
||||
notification.Variables["Version"] = e.Argument.ToString();
|
||||
|
||||
notification.Variables["Version"] = e.Argument.versionStr;
|
||||
notification.Variables["ReleaseNotes"] = e.Argument.description;
|
||||
|
||||
await SendNotification(notification).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
@ -98,6 +99,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
|
|||
|
||||
notification.Variables["Name"] = installationInfo.Name;
|
||||
notification.Variables["Version"] = installationInfo.Version.ToString();
|
||||
notification.Variables["ReleaseNotes"] = e.Argument.Item2.description;
|
||||
|
||||
await SendNotification(notification).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -249,6 +251,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications
|
|||
};
|
||||
|
||||
notification.Variables["Name"] = e.Argument.Name;
|
||||
notification.Variables["ErrorMessage"] = e.Argument.ErrorMessage;
|
||||
|
||||
await SendNotification(notification).ConfigureAwait(false);
|
||||
}
|
||||
|
|
|
@ -605,6 +605,7 @@
|
|||
"LetterButtonAbbreviation": "A",
|
||||
"TabNowPlaying": "Now Playing",
|
||||
"TabNavigation": "Navigation",
|
||||
"TabControls": "Controls",
|
||||
"ButtonFullscreen": "Toggle fullscreen",
|
||||
"ButtonScenes": "Scenes",
|
||||
"ButtonSubtitles": "Subtitles",
|
||||
|
@ -616,5 +617,8 @@
|
|||
"ButtonPause": "Pause",
|
||||
"LabelGroupMoviesIntoCollections": "Group movies into collections",
|
||||
"LabelGroupMoviesIntoCollectionsHelp": "When displaying movie lists, movies belonging to a collection will be displayed as one grouped item.",
|
||||
"NotificationOptionPluginError": "Plugin failure"
|
||||
"NotificationOptionPluginError": "Plugin failure",
|
||||
"ButtonVolumeUp": "Volume up",
|
||||
"ButtonVolumeDown": "Volume down",
|
||||
"ButtonMute": "Mute"
|
||||
}
|
|
@ -99,7 +99,7 @@ namespace MediaBrowser.Server.Implementations.News
|
|||
{
|
||||
if (lastUpdate.HasValue)
|
||||
{
|
||||
items = items.Where(i => i.Date.ToUniversalTime() > lastUpdate.Value)
|
||||
items = items.Where(i => i.Date.ToUniversalTime() >= lastUpdate.Value)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,9 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
new NotificationTypeInfo
|
||||
{
|
||||
Type = NotificationType.PluginError.ToString(),
|
||||
DefaultTitle = "{Name} has encountered an error: {Message}",
|
||||
Variables = new List<string>{"Name", "Message"}
|
||||
DefaultTitle = "{Name} has encountered an error.",
|
||||
DefaultDescription = "{ErrorMessage}",
|
||||
Variables = new List<string>{"Name", "ErrorMessage"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
|
@ -63,7 +64,8 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
{
|
||||
Type = NotificationType.PluginUpdateInstalled.ToString(),
|
||||
DefaultTitle = "{Name} was updated.",
|
||||
Variables = new List<string>{"Name", "Version"}
|
||||
DefaultDescription = "{ReleaseNotes}",
|
||||
Variables = new List<string>{"Name", "ReleaseNotes", "Version"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
|
@ -76,7 +78,8 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
{
|
||||
Type = NotificationType.TaskFailed.ToString(),
|
||||
DefaultTitle = "{Name} failed.",
|
||||
Variables = new List<string>{"Name"}
|
||||
DefaultDescription = "{ErrorMessage}",
|
||||
Variables = new List<string>{"Name", "ErrorMessage"}
|
||||
},
|
||||
|
||||
new NotificationTypeInfo
|
||||
|
|
|
@ -39,13 +39,14 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
_config.Configuration.NotificationOptions.GetOptions(notificationType);
|
||||
|
||||
var users = GetUserIds(request, options)
|
||||
.Except(request.UserIds)
|
||||
.Except(request.ExcludeUserIds)
|
||||
.Select(i => _userManager.GetUserById(new Guid(i)));
|
||||
|
||||
var title = GetTitle(request, options);
|
||||
var description = GetDescription(request, options);
|
||||
|
||||
var tasks = _services.Where(i => IsEnabled(i, notificationType))
|
||||
.Select(i => SendNotification(request, i, users, title, cancellationToken));
|
||||
.Select(i => SendNotification(request, i, users, description, title, cancellationToken));
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
}
|
||||
|
@ -54,12 +55,13 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
INotificationService service,
|
||||
IEnumerable<User> users,
|
||||
string title,
|
||||
string description,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
users = users.Where(i => IsEnabledForUser(service, i))
|
||||
.ToList();
|
||||
|
||||
var tasks = users.Select(i => SendNotification(request, service, title, i, cancellationToken));
|
||||
var tasks = users.Select(i => SendNotification(request, service, title, description, i, cancellationToken));
|
||||
|
||||
return Task.WhenAll(tasks);
|
||||
|
||||
|
@ -89,19 +91,20 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
.Select(i => i.Id.ToString("N"));
|
||||
}
|
||||
|
||||
return new List<string>();
|
||||
return request.UserIds;
|
||||
}
|
||||
|
||||
private async Task SendNotification(NotificationRequest request,
|
||||
INotificationService service,
|
||||
string title,
|
||||
string description,
|
||||
User user,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var notification = new UserNotification
|
||||
{
|
||||
Date = request.Date,
|
||||
Description = request.Description,
|
||||
Description = description,
|
||||
Level = request.Level,
|
||||
Name = title,
|
||||
Url = request.Url,
|
||||
|
@ -162,6 +165,48 @@ namespace MediaBrowser.Server.Implementations.Notifications
|
|||
return title;
|
||||
}
|
||||
|
||||
private string GetDescription(NotificationRequest request, NotificationOption options)
|
||||
{
|
||||
var text = request.Description;
|
||||
|
||||
// If empty, grab from options
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(request.NotificationType))
|
||||
{
|
||||
if (options != null)
|
||||
{
|
||||
text = options.Title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If still empty, grab default
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(request.NotificationType))
|
||||
{
|
||||
var info = GetNotificationTypes().FirstOrDefault(i => string.Equals(i.Type, request.NotificationType, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
text = info.DefaultDescription;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
text = text ?? string.Empty;
|
||||
|
||||
foreach (var pair in request.Variables)
|
||||
{
|
||||
var token = "{" + pair.Key + "}";
|
||||
|
||||
text = text.Replace(token, pair.Value, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
private bool IsEnabledForUser(INotificationService service, User user)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -1054,7 +1054,7 @@ namespace MediaBrowser.ServerApplication
|
|||
|
||||
HasUpdateAvailable = false;
|
||||
|
||||
OnApplicationUpdated(package.version);
|
||||
OnApplicationUpdated(package);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -373,6 +373,8 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
sb.Append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">");
|
||||
sb.Append("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">");
|
||||
sb.Append("<meta name=\"mobile-web-app-capable\" content=\"yes\">");
|
||||
//sb.Append("<meta name=\"application-name\" content=\"Media Browser\">");
|
||||
//sb.Append("<meta name=\"msapplication-config\" content=\"config.xml\">");
|
||||
//sb.Append("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\">");
|
||||
|
||||
sb.Append("<link rel=\"icon\" sizes=\"114x114\" href=\"css/images/touchicon114.png\" />");
|
||||
|
@ -382,7 +384,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
sb.Append("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"css/images/touchicon72.png\" />");
|
||||
sb.Append("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"css/images/touchicon114.png\" />");
|
||||
sb.Append("<link rel=\"apple-touch-startup-image\" href=\"css/images/iossplash.png\" />");
|
||||
sb.Append("<link rel=\"shortcut icon\" href=\"favicon.ico\" />");
|
||||
sb.Append("<link rel=\"shortcut icon\" href=\"css/images/favicon.ico\" />");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
<Content Include="dashboard-ui\css\images\clients\xbmc.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\favicon.ico" />
|
||||
<Content Include="dashboard-ui\css\images\icons\audiocd.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
Loading…
Reference in New Issue
Block a user