Added Notification display time to XBMC

This commit is contained in:
Mark McDowall 2013-07-18 00:08:32 -07:00
parent deb4972cdc
commit 57c876a420
5 changed files with 20 additions and 7 deletions

View File

@ -26,7 +26,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
public void Notify(XbmcSettings settings, string title, string message)
{
var notification = String.Format("Notification({0},{1},{2},{3})", title, message, 5000, "https://raw.github.com/NzbDrone/NzbDrone/vnext/NzbDrone.Core/NzbDrone.jpg");
var notification = String.Format("Notification({0},{1},{2},{3})", title, message, settings.DisplayTime * 1000, "https://raw.github.com/NzbDrone/NzbDrone/vnext/NzbDrone.Core/NzbDrone.jpg");
var command = BuildExecBuiltInCommand(notification);
SendCommand(settings, command);

View File

@ -27,7 +27,8 @@ namespace NzbDrone.Core.Notifications.Xbmc
var parameters = new JObject(
new JProperty("title", title),
new JProperty("message", message),
new JProperty("image", "https://raw.github.com/NzbDrone/NzbDrone/vnext/NzbDrone.Core/NzbDrone.jpg"));
new JProperty("image", "https://raw.github.com/NzbDrone/NzbDrone/vnext/NzbDrone.Core/NzbDrone.jpg"),
new JProperty("displaytime", settings.DisplayTime * 1000));
var postJson = BuildJsonRequest("GUI.ShowNotification", parameters);

View File

@ -8,5 +8,6 @@ namespace NzbDrone.Core.Notifications.Xbmc
public int Port { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public int DisplayTime { get; set; }
}
}

View File

@ -105,7 +105,8 @@ namespace NzbDrone.Core.Notifications.Xbmc
Host = message.Host,
Port = message.Port,
Username = message.Username,
Password = message.Password
Password = message.Password,
DisplayTime = message.DisplayTime
};
Logger.Trace("Determining version of XBMC Host: {0}", settings.Address);

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
@ -9,6 +10,11 @@ namespace NzbDrone.Core.Notifications.Xbmc
{
public class XbmcSettings : INotifcationSettings
{
public XbmcSettings()
{
DisplayTime = 5;
}
[FieldDefinition(0, Label = "Host")]
public String Host { get; set; }
@ -21,16 +27,20 @@ namespace NzbDrone.Core.Notifications.Xbmc
[FieldDefinition(3, Label = "Password", Type = FieldType.Password)]
public String Password { get; set; }
[FieldDefinition(4, Label = "GUI Notification", HelpText = "Show GUI notifications?", Type = FieldType.Checkbox)]
[DefaultValue(5)]
[FieldDefinition(4, Label = "Display Time", HelpText = "How long the notification will be displayed for (In seconds)")]
public Int32 DisplayTime { get; set; }
[FieldDefinition(5, Label = "GUI Notification", HelpText = "Show GUI notifications?", Type = FieldType.Checkbox)]
public Boolean Notify { get; set; }
[FieldDefinition(5, Label = "Update Library", HelpText = "Update Library on Download & Rename?", Type = FieldType.Checkbox)]
[FieldDefinition(6, Label = "Update Library", HelpText = "Update Library on Download & Rename?", Type = FieldType.Checkbox)]
public Boolean UpdateLibrary { get; set; }
[FieldDefinition(6, Label = "Clean Library", HelpText = "Clean Library after update?", Type = FieldType.Checkbox)]
[FieldDefinition(7, Label = "Clean Library", HelpText = "Clean Library after update?", Type = FieldType.Checkbox)]
public Boolean CleanLibrary { get; set; }
[FieldDefinition(7, Label = "Always Update", HelpText = "Update Library even when a video is playing?", Type = FieldType.Checkbox)]
[FieldDefinition(8, Label = "Always Update", HelpText = "Update Library even when a video is playing?", Type = FieldType.Checkbox)]
public Boolean AlwaysUpdate { get; set; }
[JsonIgnore]