Skip to content

Commit

Permalink
Fixed all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tidusjar committed Nov 10, 2020
1 parent 0d55eec commit 6b668c6
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 56 deletions.
13 changes: 6 additions & 7 deletions src/Ombi.Api.Plex/PlexApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,15 @@ public async Task<PlexLibrariesForMachineId> GetLibrariesForMachineId(string aut
}

/// <summary>
// 192.168.1.69:32400/library/metadata/3662/allLeaves
// The metadata ratingkey should be in the Cache
// Search for it and then call the above with the Directory.RatingKey
// THEN! We need the episode metadata using result.Vide.Key ("/library/metadata/3664")
// We then have the GUID which contains the TVDB ID plus the season and episode number: guid="com.plexapp.agents.thetvdb://269586/2/8?lang=en"
/// 192.168.1.69:32400/library/metadata/3662/allLeaves
/// The metadata ratingkey should be in the Cache
/// Search for it and then call the above with the Directory.RatingKey
/// THEN! We need the episode metadata using result.Vide.Key ("/library/metadata/3664")
/// We then have the GUID which contains the TVDB ID plus the season and episode number: guid="com.plexapp.agents.thetvdb://269586/2/8?lang=en"
/// </summary>
/// <param name="authToken"></param>
/// <param name="plexFullHost"></param>
/// <param name="ratingKey"></param>
/// <returns></returns>
public async Task<PlexMetadata> GetEpisodeMetaData(string authToken, string plexFullHost, int ratingKey)
{
var request = new Request($"/library/metadata/{ratingKey}", plexFullHost, HttpMethod.Get);
Expand Down Expand Up @@ -308,7 +307,7 @@ private void AddLimitHeaders(Request request, int from, int to)
}
private async Task CheckInstallId(PlexSettings s)
{
if (s.InstallId == null || s.InstallId == Guid.Empty)
if (s?.InstallId == Guid.Empty || s.InstallId == Guid.Empty)
{
s.InstallId = Guid.NewGuid();
await _plexSettings.SaveSettingsAsync(s);
Expand Down
6 changes: 3 additions & 3 deletions src/Ombi.Api/HttpRequestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Ombi.Api
{
public static class HttpRequestExtnesions
public static class HttpRequestExtensions
{
public static async Task<HttpRequestMessage> Clone(this HttpRequestMessage request)
{
Expand All @@ -14,9 +14,9 @@ public static async Task<HttpRequestMessage> Clone(this HttpRequestMessage reque
Content = await request.Content.Clone(),
Version = request.Version
};
foreach (KeyValuePair<string, object> prop in request.Properties)
foreach (KeyValuePair<string, object> prop in request.Options)
{
clone.Properties.Add(prop);
clone.Options.TryAdd(prop.Key, prop.Value);
}
foreach (KeyValuePair<string, IEnumerable<string>> header in request.Headers)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Ombi.Core/Engine/Demo/DemoMovieSearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public async Task<IEnumerable<SearchMovieViewModel>> Search(string search)
return null;
}

public async Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies()
new public async Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies()
{
var rand = new Random();
var responses = new List<SearchMovieViewModel>();
Expand All @@ -72,18 +72,18 @@ public async Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies()
return responses;
}

public async Task<IEnumerable<SearchMovieViewModel>> PopularMovies()
new public async Task<IEnumerable<SearchMovieViewModel>> PopularMovies()
{
return await NowPlayingMovies();
}


public async Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies()
new public async Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies()
{
return await NowPlayingMovies();
}

public async Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies()
new public async Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies()
{

return await NowPlayingMovies();
Expand Down
2 changes: 1 addition & 1 deletion src/Ombi.Core/Engine/Demo/DemoTvSearchEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public DemoTvSearchEngine(IPrincipal identity, IRequestServiceMain service, ITvM

private readonly DemoLists _demoLists;

public async Task<IEnumerable<SearchTvShowViewModel>> Search(string search)
new public async Task<IEnumerable<SearchTvShowViewModel>> Search(string search)
{
var searchResult = await TvMazeApi.Search(search);

Expand Down
4 changes: 2 additions & 2 deletions src/Ombi.Core/Engine/V2/CalendarEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public CalendarEngine(IPrincipal user, OmbiUserManager um, IRuleEvaluator rules,
private readonly IMovieRequestRepository _movieRepo;
private readonly ITvRequestRepository _tvRepo;

public async Task<List<CalendarViewModel>> GetCalendarData()
public Task<List<CalendarViewModel>> GetCalendarData()
{
var viewModel = new List<CalendarViewModel>();
var movies = _movieRepo.GetAll().Where(x =>
Expand Down Expand Up @@ -78,7 +78,7 @@ public async Task<List<CalendarViewModel>> GetCalendarData()
});
}

return viewModel;
return Task.FromResult(viewModel);
}

private string GetBackgroundColor(BaseRequest req)
Expand Down
3 changes: 2 additions & 1 deletion src/Ombi.Notifications/Agents/DiscordNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ protected override async Task Send(NotificationMessage model, DiscordNotificatio
"Available" => "51283",
"Denied" => "13959168",
"Processing Request" => "37354",
"Pending Approval" => "16754470"
"Pending Approval" => "16754470",
_ => throw new ArgumentOutOfRangeException(nameof(color))
};
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/Ombi.Store/Context/Sqlite/ExternalSqliteContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ private void Upgrade()
Database.ExecuteSqlRaw(@"INSERT OR IGNORE INTO __EFMigrationsHistory (MigrationId,ProductVersion)
VALUES('20191103205133_Inital', '2.2.6-servicing-10079'); ");
}
#pragma warning disable RCS1075 // Avoid empty catch clause that catches System.Exception.
catch (Exception)
#pragma warning restore RCS1075 // Avoid empty catch clause that catches System.Exception.
{
// ignored
}
Expand Down
3 changes: 0 additions & 3 deletions src/Ombi.Store/Repository/Requests/ITvRequestRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ namespace Ombi.Store.Repository.Requests
public interface ITvRequestRepository : IRepository<TvRequests>
{
OmbiContext Db { get; }
Task<TvRequests> Add(TvRequests request);
Task<ChildRequests> AddChild(ChildRequests request);
Task Delete(TvRequests request);
Task DeleteRange(IEnumerable<TvRequests> request);
Task DeleteChild(ChildRequests request);
IQueryable<TvRequests> Get();
IQueryable<TvRequests> GetLite();
Expand Down
6 changes: 1 addition & 5 deletions src/Ombi/Controllers/V1/External/EmbyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ namespace Ombi.Controllers.V1.External
[Produces("application/json")]
public class EmbyController : Controller
{
/// <summary>
///
/// </summary>
/// <param name="emby"></param>
/// <param name="embySettings"></param>

public EmbyController(IEmbyApiFactory emby, ISettingsService<EmbySettings> embySettings)
{
EmbyApi = emby;
Expand Down
2 changes: 1 addition & 1 deletion src/Ombi/Controllers/V1/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public async Task<string> GetClientId()
[HttpPost("plex")]
public async Task<bool> PlexSettings([FromBody]PlexSettings plex)
{
if (plex.InstallId == null || plex.InstallId == Guid.Empty)
if (plex?.InstallId == Guid.Empty || plex.InstallId == Guid.Empty)
{
plex.InstallId = Guid.NewGuid();
}
Expand Down
12 changes: 3 additions & 9 deletions src/Ombi/Controllers/V1/TokenController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private async Task<IActionResult> CreateToken(bool rememberMe, OmbiUser user)
new Claim("Id", user.Id)
};
claims.AddRange(roles.Select(role => new Claim("role", role)));
if(user.Email.HasValue())
if (user.Email.HasValue())
{
claims.Add(new Claim("Email", user.Email));
}
Expand All @@ -158,14 +158,8 @@ private async Task<IActionResult> CreateToken(bool rememberMe, OmbiUser user)
}

user.LastLoggedIn = DateTime.UtcNow;
try
{
await _userManager.UpdateAsync(user);
}
catch (Exception)
{

}

await _userManager.UpdateAsync(user);

return new JsonResult(new
{
Expand Down
2 changes: 1 addition & 1 deletion src/Ombi/Extensions/StartupExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void AddSwagger(this IServiceCollection services)
Type = SecuritySchemeType.ApiKey
});
c.CustomSchemaIds(x => x.FullName);
var basePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var basePath = Path.GetDirectoryName(AppContext.BaseDirectory);
var xmlPath = Path.Combine(basePath, "Swagger.xml");
try
{
Expand Down
19 changes: 0 additions & 19 deletions src/Ombi/Ombi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,11 @@
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netcoreapp2.2\Swagger.xml</DocumentationFile>
<NoWarn>1701;1702;1705;1591;</NoWarn>
</PropertyGroup>

<ItemGroup>
<Content Remove="$(SpaRoot)**" />
<None Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netcoreapp2.2\Swagger.xml</DocumentationFile>
<NoWarn>1701;1702;1705;1591;</NoWarn>
<DefineConstants>TRACE;RELEASE;NETCOREAPP2_0</DefineConstants>
</PropertyGroup>

<ItemGroup>
<!-- Files not to show in IDE -->
Expand Down Expand Up @@ -72,7 +61,6 @@
<PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.SQLite" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
<PackageReference Include="System.Security.Cryptography.Csp" Version="4.3.0" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.1.10" />
Expand All @@ -97,13 +85,6 @@
<ProjectReference Include="..\Ombi.Updater\Ombi.Updater.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="HealthCheck.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>



<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<Exec Command="node --version" ContinueOnError="true">
Expand Down

0 comments on commit 6b668c6

Please sign in to comment.