mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Merge branch 'dev' of https://github.com/tidusjar/Ombi into dev
This commit is contained in:
commit
2465124b4c
13 changed files with 113 additions and 22 deletions
|
@ -31,7 +31,7 @@ namespace Ombi.Api.Models.Emby
|
||||||
{
|
{
|
||||||
public class EmbyUserdata
|
public class EmbyUserdata
|
||||||
{
|
{
|
||||||
public int PlaybackPositionTicks { get; set; }
|
public double PlaybackPositionTicks { get; set; }
|
||||||
public int PlayCount { get; set; }
|
public int PlayCount { get; set; }
|
||||||
public bool IsFavorite { get; set; }
|
public bool IsFavorite { get; set; }
|
||||||
public bool Played { get; set; }
|
public bool Played { get; set; }
|
||||||
|
|
|
@ -81,7 +81,10 @@ namespace Ombi.Services.Jobs
|
||||||
public void CheckAndUpdateAll()
|
public void CheckAndUpdateAll()
|
||||||
{
|
{
|
||||||
var embySettings = Emby.GetSettings();
|
var embySettings = Emby.GetSettings();
|
||||||
|
if (!embySettings.Enable)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!ValidateSettings(embySettings))
|
if (!ValidateSettings(embySettings))
|
||||||
{
|
{
|
||||||
Log.Debug("Validation of the Emby settings failed.");
|
Log.Debug("Validation of the Emby settings failed.");
|
||||||
|
|
|
@ -69,7 +69,10 @@ namespace Ombi.Services.Jobs
|
||||||
public void CacheContent()
|
public void CacheContent()
|
||||||
{
|
{
|
||||||
var embySettings = Emby.GetSettings();
|
var embySettings = Emby.GetSettings();
|
||||||
|
if (!embySettings.Enable)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!ValidateSettings(embySettings))
|
if (!ValidateSettings(embySettings))
|
||||||
{
|
{
|
||||||
Log.Debug("Validation of emby settings failed.");
|
Log.Debug("Validation of emby settings failed.");
|
||||||
|
|
|
@ -82,6 +82,11 @@ namespace Ombi.Services.Jobs
|
||||||
|
|
||||||
var plexSettings = Plex.GetSettings();
|
var plexSettings = Plex.GetSettings();
|
||||||
|
|
||||||
|
if (!plexSettings.Enable)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ValidateSettings(plexSettings))
|
if (!ValidateSettings(plexSettings))
|
||||||
{
|
{
|
||||||
Log.Debug("Validation of the plex settings failed.");
|
Log.Debug("Validation of the plex settings failed.");
|
||||||
|
|
|
@ -77,7 +77,10 @@ namespace Ombi.Services.Jobs
|
||||||
public void CacheContent()
|
public void CacheContent()
|
||||||
{
|
{
|
||||||
var plexSettings = Plex.GetSettings();
|
var plexSettings = Plex.GetSettings();
|
||||||
|
if (!plexSettings.Enable)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!ValidateSettings(plexSettings))
|
if (!ValidateSettings(plexSettings))
|
||||||
{
|
{
|
||||||
Log.Debug("Validation of the plex settings failed.");
|
Log.Debug("Validation of the plex settings failed.");
|
||||||
|
|
|
@ -130,6 +130,7 @@ namespace Ombi.Services.Notification
|
||||||
var embySettings = await EmbySettings.GetSettingsAsync();
|
var embySettings = await EmbySettings.GetSettingsAsync();
|
||||||
var embyUsers = EmbyApi.GetUsers(embySettings.FullUri, embySettings.ApiKey);
|
var embyUsers = EmbyApi.GetUsers(embySettings.FullUri, embySettings.ApiKey);
|
||||||
var userAccount = embyUsers.FirstOrDefault(x => x.Policy.IsAdministrator);
|
var userAccount = embyUsers.FirstOrDefault(x => x.Policy.IsAdministrator);
|
||||||
|
var localUsers = UserHelper.GetUsers().ToList();
|
||||||
|
|
||||||
var adminUsername = userAccount.Name ?? string.Empty;
|
var adminUsername = userAccount.Name ?? string.Empty;
|
||||||
|
|
||||||
|
@ -179,10 +180,16 @@ namespace Ombi.Services.Notification
|
||||||
var email = embyUsers.FirstOrDefault(x => x.Name.Equals(user, StringComparison.CurrentCultureIgnoreCase));
|
var email = embyUsers.FirstOrDefault(x => x.Name.Equals(user, StringComparison.CurrentCultureIgnoreCase));
|
||||||
if (email == null)
|
if (email == null)
|
||||||
{
|
{
|
||||||
Log.Info("There is no email address for this Emby user, cannot send notification");
|
// Local User?
|
||||||
// We do not have a emby user that requested this!
|
var local = localUsers.FirstOrDefault(x => x.UsernameOrAlias.Equals(user));
|
||||||
|
if (local != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", local.UsernameOrAlias, local.EmailAddress, model.Title);
|
||||||
|
await PublishUserNotification(local.UsernameOrAlias, local.EmailAddress, model.Title, model.PosterPath, type, model.Type);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Name, embyUser.EmailAddress, model.Title);
|
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Name, embyUser.EmailAddress, model.Title);
|
||||||
await PublishUserNotification(email.Name, embyUser.EmailAddress, model.Title, model.PosterPath, type, model.Type);
|
await PublishUserNotification(email.Name, embyUser.EmailAddress, model.Title, model.PosterPath, type, model.Type);
|
||||||
|
|
|
@ -171,8 +171,10 @@ namespace Ombi.Services.Notification
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var settings = await PlexSettings.GetSettingsAsync();
|
var settings = await PlexSettings.GetSettingsAsync();
|
||||||
var plexUser = PlexApi.GetUsers(settings.PlexAuthToken);
|
|
||||||
|
var plexUser = PlexApi.GetUsers(settings.PlexAuthToken); // TODO emby
|
||||||
var userAccount = PlexApi.GetAccount(settings.PlexAuthToken);
|
var userAccount = PlexApi.GetAccount(settings.PlexAuthToken);
|
||||||
|
var localUsers = UserHelper.GetUsers().ToList();
|
||||||
|
|
||||||
var adminUsername = userAccount.Username ?? string.Empty;
|
var adminUsername = userAccount.Username ?? string.Empty;
|
||||||
|
|
||||||
|
@ -219,12 +221,18 @@ namespace Ombi.Services.Notification
|
||||||
}
|
}
|
||||||
|
|
||||||
var email = plexUser.User.FirstOrDefault(x => x.Username.Equals(user, StringComparison.CurrentCultureIgnoreCase));
|
var email = plexUser.User.FirstOrDefault(x => x.Username.Equals(user, StringComparison.CurrentCultureIgnoreCase));
|
||||||
if (email == null)
|
if (email == null) // This is not a Plex User
|
||||||
{
|
{
|
||||||
Log.Info("There is no email address for this Plex user, cannot send notification");
|
// Local User?
|
||||||
// We do not have a plex user that requested this!
|
var local = localUsers.FirstOrDefault(x => x.UsernameOrAlias.Equals(user));
|
||||||
|
if (local != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", local.UsernameOrAlias, local.EmailAddress, model.Title);
|
||||||
|
await PublishUserNotification(local.UsernameOrAlias, local.EmailAddress, model.Title, model.PosterPath, type, model.Type);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Username, email.Email, model.Title);
|
Log.Info("Sending notification to: {0} at: {1}, for title: {2}", email.Username, email.Email, model.Title);
|
||||||
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
await PublishUserNotification(email.Username, email.Email, model.Title, model.PosterPath, type, model.Type);
|
||||||
|
|
19
Ombi.UI/Content/base.css
vendored
19
Ombi.UI/Content/base.css
vendored
|
@ -525,3 +525,22 @@ label {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
margin: 0 auto !important; }
|
margin: 0 auto !important; }
|
||||||
|
|
||||||
|
.pace {
|
||||||
|
-webkit-pointer-events: none;
|
||||||
|
pointer-events: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
user-select: none; }
|
||||||
|
|
||||||
|
.pace-inactive {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
|
.pace .pace-progress {
|
||||||
|
background: #df691a;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 2000;
|
||||||
|
top: 0;
|
||||||
|
right: 100%;
|
||||||
|
width: 100%;
|
||||||
|
height: 5px; }
|
||||||
|
|
||||||
|
|
2
Ombi.UI/Content/base.min.css
vendored
2
Ombi.UI/Content/base.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -651,3 +651,26 @@ $border-radius: 10px;
|
||||||
display: block $i;
|
display: block $i;
|
||||||
margin: 0 auto $i;
|
margin: 0 auto $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pace {
|
||||||
|
-webkit-pointer-events: none;
|
||||||
|
pointer-events: none;
|
||||||
|
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pace-inactive {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pace .pace-progress {
|
||||||
|
background: $primary-colour;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 2000;
|
||||||
|
top: 0;
|
||||||
|
right: 100%;
|
||||||
|
width: 100%;
|
||||||
|
height: 5px;
|
||||||
|
}
|
|
@ -156,7 +156,7 @@ namespace Ombi.UI.Modules.Admin
|
||||||
var cp = await CpSettings.GetSettingsAsync();
|
var cp = await CpSettings.GetSettingsAsync();
|
||||||
if (cp.Enabled)
|
if (cp.Enabled)
|
||||||
{
|
{
|
||||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "CouchPotato is enabled, we cannot enable Watcher and CouchPotato" });
|
return Response.AsJson(new JsonResponseModel { Result = false, Message = "CouchPotato is enabled, we cannot enable Radarr and CouchPotato" });
|
||||||
}
|
}
|
||||||
|
|
||||||
var valid = this.Validate(radarrSettings);
|
var valid = this.Validate(radarrSettings);
|
||||||
|
|
|
@ -66,8 +66,10 @@ namespace Ombi.UI.Modules
|
||||||
ICacheProvider cache,
|
ICacheProvider cache,
|
||||||
IAnalytics an,
|
IAnalytics an,
|
||||||
IPlexNotificationEngine engine,
|
IPlexNotificationEngine engine,
|
||||||
|
IEmbyNotificationEngine embyEngine,
|
||||||
ISecurityExtensions security,
|
ISecurityExtensions security,
|
||||||
ISettingsService<CustomizationSettings> customSettings) : base("requests", prSettings, security)
|
ISettingsService<CustomizationSettings> customSettings,
|
||||||
|
ISettingsService<EmbySettings> embyS) : base("requests", prSettings, security)
|
||||||
{
|
{
|
||||||
Service = service;
|
Service = service;
|
||||||
PrSettings = prSettings;
|
PrSettings = prSettings;
|
||||||
|
@ -81,8 +83,10 @@ namespace Ombi.UI.Modules
|
||||||
CpApi = cpApi;
|
CpApi = cpApi;
|
||||||
Cache = cache;
|
Cache = cache;
|
||||||
Analytics = an;
|
Analytics = an;
|
||||||
NotificationEngine = engine;
|
PlexNotificationEngine = engine;
|
||||||
|
EmbyNotificationEngine = embyEngine;
|
||||||
CustomizationSettings = customSettings;
|
CustomizationSettings = customSettings;
|
||||||
|
EmbySettings = embyS;
|
||||||
|
|
||||||
Get["/", true] = async (x, ct) => await LoadRequests();
|
Get["/", true] = async (x, ct) => await LoadRequests();
|
||||||
Get["/movies", true] = async (x, ct) => await GetMovies();
|
Get["/movies", true] = async (x, ct) => await GetMovies();
|
||||||
|
@ -111,11 +115,13 @@ namespace Ombi.UI.Modules
|
||||||
private ISettingsService<SickRageSettings> SickRageSettings { get; }
|
private ISettingsService<SickRageSettings> SickRageSettings { get; }
|
||||||
private ISettingsService<CouchPotatoSettings> CpSettings { get; }
|
private ISettingsService<CouchPotatoSettings> CpSettings { get; }
|
||||||
private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
|
private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
|
||||||
|
private ISettingsService<EmbySettings> EmbySettings { get; }
|
||||||
private ISonarrApi SonarrApi { get; }
|
private ISonarrApi SonarrApi { get; }
|
||||||
private ISickRageApi SickRageApi { get; }
|
private ISickRageApi SickRageApi { get; }
|
||||||
private ICouchPotatoApi CpApi { get; }
|
private ICouchPotatoApi CpApi { get; }
|
||||||
private ICacheProvider Cache { get; }
|
private ICacheProvider Cache { get; }
|
||||||
private INotificationEngine NotificationEngine { get; }
|
private INotificationEngine PlexNotificationEngine { get; }
|
||||||
|
private INotificationEngine EmbyNotificationEngine { get; }
|
||||||
|
|
||||||
private async Task<Negotiator> LoadRequests()
|
private async Task<Negotiator> LoadRequests()
|
||||||
{
|
{
|
||||||
|
@ -438,7 +444,21 @@ namespace Ombi.UI.Modules
|
||||||
originalRequest.Available = available;
|
originalRequest.Available = available;
|
||||||
|
|
||||||
var result = await Service.UpdateRequestAsync(originalRequest);
|
var result = await Service.UpdateRequestAsync(originalRequest);
|
||||||
await NotificationEngine.NotifyUsers(originalRequest, available ? NotificationType.RequestAvailable : NotificationType.RequestDeclined);
|
|
||||||
|
var plexSettings = await PlexSettings.GetSettingsAsync();
|
||||||
|
if (plexSettings.Enable)
|
||||||
|
{
|
||||||
|
await
|
||||||
|
PlexNotificationEngine.NotifyUsers(originalRequest,
|
||||||
|
available ? NotificationType.RequestAvailable : NotificationType.RequestDeclined);
|
||||||
|
}
|
||||||
|
|
||||||
|
var embySettings = await EmbySettings.GetSettingsAsync();
|
||||||
|
if (embySettings.Enable)
|
||||||
|
{
|
||||||
|
await EmbyNotificationEngine.NotifyUsers(originalRequest,
|
||||||
|
available ? NotificationType.RequestAvailable : NotificationType.RequestDeclined);
|
||||||
|
}
|
||||||
return Response.AsJson(result
|
return Response.AsJson(result
|
||||||
? new { Result = true, Available = available, Message = string.Empty }
|
? new { Result = true, Available = available, Message = string.Empty }
|
||||||
: new { Result = false, Available = false, Message = "Could not update the availability, please try again or check the logs" });
|
: new { Result = false, Available = false, Message = "Could not update the availability, please try again or check the logs" });
|
||||||
|
|
|
@ -64,10 +64,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="RootPath" class="control-label">Root save directory for TV shows</label>
|
<label for="RootPath" class="control-label">Root save directory for Movies</label>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" class="form-control form-control-custom " placeholder="C:\Media\Tv" id="RootPath" name="RootPath" value="@Model.RootPath">
|
<input type="text" class="form-control form-control-custom " placeholder="C:\Media\Movies" id="RootPath" name="RootPath" value="@Model.RootPath">
|
||||||
<label>Enter the root folder where movies are saved. For example <strong>C:\Media\TV</strong>.</label>
|
<label>Enter the root folder where movies are saved. For example <strong>C:\Media\Movies</strong>.</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue