Skip to content

Commit

Permalink
Merge pull request #2053 from tidusjar/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tidusjar authored Mar 9, 2018
2 parents 152818f + cc30cc0 commit b6348a7
Show file tree
Hide file tree
Showing 23 changed files with 1,191 additions and 59 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## (unreleased)

### **New Features**

- Added the ability to override root and quality options in Sonarr (#2049) [Jamie]

- Added Pending Approval into the filters list. [tidusjar]

### **Fixes**

- Fixed #2042. [Jamie]


## v3.0.0 (2018-03-04)

### **New Features**
Expand Down
7 changes: 7 additions & 0 deletions src/Ombi.Core/Engine/TvRequestEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ public async Task<TvRequests> UpdateTvRequest(TvRequests request)
var allRequests = TvRepository.Get();
var results = await allRequests.FirstOrDefaultAsync(x => x.Id == request.Id);

results.TvDbId = request.TvDbId;
results.ImdbId = request.ImdbId;
results.Overview = request.Overview;
results.PosterPath = PosterPathHelper.FixPosterPath(request.PosterPath);
results.QualityOverride = request.QualityOverride;
results.RootFolder = request.RootFolder;

await TvRepository.Update(results);
return results;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Ombi.Core/Helpers/EmailValidator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Globalization;
using System.Net.Mail;
using System.Text.RegularExpressions;

namespace Ombi.Core.Helpers
Expand Down Expand Up @@ -31,12 +32,11 @@ public static bool IsValidEmail(string strIn)
// Return true if strIn is in valid e-mail format.
try
{
return Regex.IsMatch(strIn,
@"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$",
RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250));
// ReSharper disable once ObjectCreationAsStatement
new MailAddress(strIn);
return true;
}
catch (RegexMatchTimeoutException)
catch (FormatException)
{
return false;
}
Expand Down
16 changes: 6 additions & 10 deletions src/Ombi.Core/Senders/TvSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ private async Task<DogNzbAddResult> SendToDogNzb(ChildRequests model, DogNzbSett
/// </summary>
/// <param name="s"></param>
/// <param name="model"></param>
/// <param name="qualityId">This is for any qualities overriden from the UI</param>
/// <returns></returns>
public async Task<NewSeries> SendToSonarr(ChildRequests model, string qualityId = null)
public async Task<NewSeries> SendToSonarr(ChildRequests model)
{
var s = await SonarrSettings.GetSettingsAsync();
if (!s.Enabled)
Expand All @@ -118,15 +117,12 @@ public async Task<NewSeries> SendToSonarr(ChildRequests model, string qualityId
{
return null;
}
var qualityProfile = 0;
if (!string.IsNullOrEmpty(qualityId)) // try to parse the passed in quality, otherwise use the settings default quality
{
int.TryParse(qualityId, out qualityProfile);
}

if (qualityProfile <= 0)
int.TryParse(s.QualityProfile, out var qualityToUse);

if (model.ParentRequest.QualityOverride.HasValue)
{
int.TryParse(s.QualityProfile, out qualityProfile);
qualityToUse = model.ParentRequest.QualityOverride.Value;
}

// Get the root path from the rootfolder selected.
Expand All @@ -151,7 +147,7 @@ public async Task<NewSeries> SendToSonarr(ChildRequests model, string qualityId
monitored = true,
seasonFolder = s.SeasonFolders,
rootFolderPath = rootFolderPath,
qualityProfileId = qualityProfile,
qualityProfileId = qualityToUse,
titleSlug = model.ParentRequest.Title,
addOptions = new AddOptions
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ombi.Notifications/NotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public NotificationService(IServiceProvider provider, ILogger<NotificationServic
private List<INotification> NotificationAgents { get; }
private ILogger<NotificationService> Log { get; }

/// <summary>
/// <summary>^
/// Sends a notification to the user. This one is used in normal notification scenarios
/// </summary>
/// <param name="model">The model.</param>
Expand Down
7 changes: 7 additions & 0 deletions src/Ombi.Schedule/Jobs/Emby/EmbyUserImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ public async Task Start()
var existingEmbyUser = allUsers.FirstOrDefault(x => x.ProviderUserId == embyUser.Id);
if (existingEmbyUser == null)
{

if (!embyUser.ConnectUserName.HasValue() && !embyUser.Name.HasValue())
{
_log.LogInformation("Could not create Emby user since the have no username, PlexUserId: {0}", embyUser.Id);
continue;
}

// Create this users
// We do not store a password against the user since they will authenticate via Plex
var newUser = new OmbiUser
Expand Down
6 changes: 6 additions & 0 deletions src/Ombi.Schedule/Jobs/Plex/PlexUserImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public async Task Start()
var existingPlexUser = allUsers.FirstOrDefault(x => x.ProviderUserId == plexUser.Id);
if (existingPlexUser == null)
{

if (!plexUser.Username.HasValue())
{
_log.LogInformation("Could not create Plex user since the have no username, PlexUserId: {0}", plexUser.Id);
continue;
}
// Create this users
// We do not store a password against the user since they will authenticate via Plex
var newUser = new OmbiUser
Expand Down
22 changes: 22 additions & 0 deletions src/Ombi.Store/Entities/OmbiUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.AspNetCore.Identity;
using Newtonsoft.Json;
using Ombi.Helpers;

namespace Ombi.Store.Entities
Expand Down Expand Up @@ -35,5 +36,26 @@ public class OmbiUser : IdentityUser

[NotMapped]
public bool EmailLogin { get; set; }

[JsonIgnore]
public override string PasswordHash
{
get => base.PasswordHash;
set => base.PasswordHash = value;
}

[JsonIgnore]
public override string SecurityStamp
{
get => base.SecurityStamp;
set => base.SecurityStamp = value;
}

[JsonIgnore]
public override string ConcurrencyStamp
{
get => base.ConcurrencyStamp;
set => base.ConcurrencyStamp = value;
}
}
}
1 change: 1 addition & 0 deletions src/Ombi.Store/Entities/Requests/TvRequests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class TvRequests : Entity
{
public int TvDbId { get; set; }
public string ImdbId { get; set; }
public int? QualityOverride { get; set; }
public int? RootFolder { get; set; }
public string Overview { get; set; }
public string Title { get; set; }
Expand Down
1 change: 1 addition & 0 deletions src/Ombi.Store/Migration.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet ef migrations add Inital --context OmbiContext --startup-project ../Ombi/Ombi.csproj
Loading

0 comments on commit b6348a7

Please sign in to comment.