fix mixed platform directory mapping (#106)

* sync plex platform and platform version

* fix mixed-platform path replacements
This commit is contained in:
Jason Dove
2021-03-28 01:40:40 +00:00
committed by GitHub
parent 22c4fe2a27
commit 104d4a0cbd
15 changed files with 2075 additions and 35 deletions
@@ -135,6 +135,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
inner join PlexPathReplacement ppr on ppr.PlexMediaSourceId = l.MediaSourceId
where lp.Id = {0}",
plexLibraryPathId)
.Include(ppr => ppr.PlexMediaSource)
.ToListAsync();
}
@@ -158,8 +159,20 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
List<PlexConnection> toDelete)
{
await _dbConnection.ExecuteAsync(
@"UPDATE PlexMediaSource SET ProductVersion = @ProductVersion, ServerName = @ServerName WHERE Id = @Id",
new { plexMediaSource.ProductVersion, plexMediaSource.ServerName, plexMediaSource.Id });
@"UPDATE PlexMediaSource SET
ProductVersion = @ProductVersion,
Platform = @Platform,
PlatformVersion = @PlatformVersion,
ServerName = @ServerName
WHERE Id = @Id",
new
{
plexMediaSource.ProductVersion,
plexMediaSource.Platform,
plexMediaSource.PlatformVersion,
plexMediaSource.ServerName,
plexMediaSource.Id
});
await using TvContext dbContext = _dbContextFactory.CreateDbContext();
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace ErsatzTV.Infrastructure.Migrations
{
public partial class Add_PlexMediaSourcePlatform : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
"Platform",
"PlexMediaSource",
"TEXT",
nullable: true);
migrationBuilder.AddColumn<string>(
"PlatformVersion",
"PlexMediaSource",
"TEXT",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
"Platform",
"PlexMediaSource");
migrationBuilder.DropColumn(
"PlatformVersion",
"PlexMediaSource");
}
}
}
@@ -1026,6 +1026,12 @@ namespace ErsatzTV.Infrastructure.Migrations
b.Property<string>("ClientIdentifier")
.HasColumnType("TEXT");
b.Property<string>("Platform")
.HasColumnType("TEXT");
b.Property<string>("PlatformVersion")
.HasColumnType("TEXT");
b.Property<string>("ProductVersion")
.HasColumnType("TEXT");
@@ -6,6 +6,8 @@ namespace ErsatzTV.Infrastructure.Plex.Models
{
public string Name { get; set; }
public string ProductVersion { get; set; }
public string Platform { get; set; }
public string PlatformVersion { get; set; }
public string ClientIdentifier { get; set; }
public string AccessToken { get; set; }
@@ -70,6 +70,8 @@ namespace ErsatzTV.Infrastructure.Plex
{
ServerName = resource.Name,
ProductVersion = resource.ProductVersion,
Platform = resource.Platform,
PlatformVersion = resource.PlatformVersion,
ClientIdentifier = resource.ClientIdentifier,
Connections = sortedConnections
.Map(c => new PlexConnection { Uri = c.Uri }).ToList()
@@ -0,0 +1,10 @@
using System.Runtime.InteropServices;
using ErsatzTV.Core.Interfaces.Runtime;
namespace ErsatzTV.Infrastructure.Runtime
{
public class RuntimeInfo : IRuntimeInfo
{
public bool IsOSPlatform(OSPlatform osPlatform) => RuntimeInformation.IsOSPlatform(osPlatform);
}
}