mirror of
https://github.com/91270/MeiamSubtitles.git
synced 2026-02-02 18:19:50 +08:00
Emby .NET 框架更换到 netstandard2.0 适配最新版本
This commit is contained in:
@@ -1,29 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>1.0.10.0</AssemblyVersion>
|
||||
<FileVersion>1.0.10.0</FileVersion>
|
||||
<Version>1.0.10</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<WarningLevel>2</WarningLevel>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>..\Release</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Thumb.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Thumb.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MediaBrowser.Common" Version="4.8.5" />
|
||||
<PackageReference Include="MediaBrowser.Server.Core" Version="4.8.5" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="Copy $(TargetDir)$(TargetFileName) $(SolutionDir)$(ConfigurationName)\$(TargetFileName) /y
" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace Emby.MeiamSub.Shooter
|
||||
{
|
||||
@@ -28,7 +29,7 @@ namespace Emby.MeiamSub.Shooter
|
||||
public const string SSA = "ssa";
|
||||
public const string SRT = "srt";
|
||||
|
||||
private readonly ILogger _logger;
|
||||
protected readonly ILogger _logger;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
||||
@@ -42,12 +43,12 @@ namespace Emby.MeiamSub.Shooter
|
||||
#endregion
|
||||
|
||||
#region 构造函数
|
||||
public ShooterProvider(ILogger logger, IJsonSerializer jsonSerializer,IHttpClient httpClient)
|
||||
public ShooterProvider(ILogManager logManager, IJsonSerializer jsonSerializer,IHttpClient httpClient)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger = logManager.GetLogger(GetType().Name);
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_httpClient = httpClient;
|
||||
_logger.Info($"{Name} Init");
|
||||
_logger.Info("{0} Init", new object[1] { Name });
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -61,7 +62,7 @@ namespace Emby.MeiamSub.Shooter
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<RemoteSubtitleInfo>> Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.Info($"{Name} Search | SubtitleSearchRequest -> { _jsonSerializer.SerializeToString(request) }");
|
||||
_logger.Info("{0} Search | SubtitleSearchRequest -> {1}", new object[2] { Name , _jsonSerializer.SerializeToString(request) });
|
||||
|
||||
var subtitles = await SearchSubtitlesAsync(request);
|
||||
|
||||
@@ -90,7 +91,7 @@ namespace Emby.MeiamSub.Shooter
|
||||
|
||||
var hash = ComputeFileHash(fileInfo);
|
||||
|
||||
_logger.Info($"{Name} Search | FileHash -> { hash }");
|
||||
_logger.Info("{0} Search | FileHash -> {1}", new object[2] { Name, hash });
|
||||
|
||||
HttpRequestOptions options = new HttpRequestOptions
|
||||
{
|
||||
@@ -108,11 +109,11 @@ namespace Emby.MeiamSub.Shooter
|
||||
{ "lang",request.Language == "chi" ? "chn" : "eng"}
|
||||
});
|
||||
|
||||
_logger.Info($"{Name} Search | Request -> { _jsonSerializer.SerializeToString(options) }");
|
||||
_logger.Info("{0} Search | Request -> {1}", new object[2] { Name, _jsonSerializer.SerializeToString(options) });
|
||||
|
||||
var response = await _httpClient.Post(options);
|
||||
|
||||
_logger.Info($"{Name} Search | Response -> { _jsonSerializer.SerializeToString(response) }");
|
||||
_logger.Info("{0} Search | Response -> {1}", new object[2] { Name, _jsonSerializer.SerializeToString(response) });
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.OK && response.ContentType.Contains("application/json"))
|
||||
{
|
||||
@@ -120,7 +121,7 @@ namespace Emby.MeiamSub.Shooter
|
||||
|
||||
if (subtitleResponse != null)
|
||||
{
|
||||
_logger.Info($"{Name} Search | Response -> { _jsonSerializer.SerializeToString(subtitleResponse) }");
|
||||
_logger.Info("{0} Search | Response -> {1}", new object[2] { Name, _jsonSerializer.SerializeToString(subtitleResponse) });
|
||||
|
||||
var remoteSubtitleInfos = new List<RemoteSubtitleInfo>();
|
||||
|
||||
@@ -146,14 +147,14 @@ namespace Emby.MeiamSub.Shooter
|
||||
});
|
||||
}
|
||||
}
|
||||
_logger.Info("{0} Search | Summary -> Get {1} Subtitles", new object[2] { Name, remoteSubtitleInfos.Count });
|
||||
|
||||
_logger.Info($"{Name} Search | Summary -> Get { remoteSubtitleInfos.Count } Subtitles");
|
||||
|
||||
return remoteSubtitleInfos;
|
||||
}
|
||||
}
|
||||
|
||||
_logger.Info($"{Name} Search | Summary -> Get 0 Subtitles");
|
||||
_logger.Info("{0} Search | Summary -> Get 0 Subtitles", new object[1] { Name });
|
||||
|
||||
return Array.Empty<RemoteSubtitleInfo>();
|
||||
}
|
||||
@@ -168,7 +169,7 @@ namespace Emby.MeiamSub.Shooter
|
||||
/// <returns></returns>
|
||||
public async Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.Info($"{Name} DownloadSub | Request -> {id}");
|
||||
_logger.Info("{0} DownloadSub | Request -> {1}", new object[2] { Name, id });
|
||||
|
||||
return await DownloadSubAsync(id);
|
||||
}
|
||||
@@ -187,7 +188,8 @@ namespace Emby.MeiamSub.Shooter
|
||||
return new SubtitleResponse();
|
||||
}
|
||||
|
||||
_logger.Info($"{Name} DownloadSub | Url -> { downloadSub.Url } | Format -> { downloadSub.Format } | Language -> { downloadSub.Language } ");
|
||||
_logger.Info($"{0} DownloadSub | Url -> {1} | Format -> {2} | Language -> {3} " ,
|
||||
new object[4] { Name, downloadSub.Url, downloadSub.Format, downloadSub.Language });
|
||||
|
||||
var response = await _httpClient.GetResponse(new HttpRequestOptions
|
||||
{
|
||||
@@ -198,7 +200,8 @@ namespace Emby.MeiamSub.Shooter
|
||||
});
|
||||
|
||||
|
||||
_logger.Info($"{Name} DownloadSub | Response -> { response.StatusCode }");
|
||||
_logger.Info("{0} DownloadSub | Request -> {1}", new object[2] { Name, response.StatusCode });
|
||||
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
<FileVersion>1.0.10.0</FileVersion>
|
||||
<Version>1.0.10</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>..\Release</OutputPath>
|
||||
</PropertyGroup>
|
||||
@@ -22,6 +22,7 @@
|
||||
<EmbeddedResource Include="Thumb.png" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MediaBrowser.Common" Version="4.8.5" />
|
||||
<PackageReference Include="MediaBrowser.Server.Core" Version="4.8.5" />
|
||||
@@ -31,4 +32,5 @@
|
||||
<Exec Command="Copy $(TargetDir)$(TargetFileName) $(SolutionDir)$(ConfigurationName)\$(TargetFileName) /y
" />
|
||||
</Target>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -42,12 +42,12 @@ namespace Emby.MeiamSub.Thunder
|
||||
#endregion
|
||||
|
||||
#region 构造函数
|
||||
public ThunderProvider(ILogger logger, IJsonSerializer jsonSerializer,IHttpClient httpClient)
|
||||
public ThunderProvider(ILogManager logManager, IJsonSerializer jsonSerializer, IHttpClient httpClient)
|
||||
{
|
||||
_logger = logger;
|
||||
_logger = logManager.GetLogger(GetType().Name);
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_httpClient = httpClient;
|
||||
_logger.Info($"{Name} Init");
|
||||
_logger.Info("{0} Init", new object[1] { Name });
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Emby.MeiamSub.Thunder
|
||||
/// <returns></returns>
|
||||
public async Task<IEnumerable<RemoteSubtitleInfo>> Search(SubtitleSearchRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.Info($"{Name} Search | SubtitleSearchRequest -> { _jsonSerializer.SerializeToString(request) }");
|
||||
_logger.Info($"{0} Search | SubtitleSearchRequest -> {1}", new object[2] { Name, _jsonSerializer.SerializeToString(request) });
|
||||
|
||||
var subtitles = await SearchSubtitlesAsync(request);
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Emby.MeiamSub.Thunder
|
||||
|
||||
var cid = GetCidByFile(request.MediaPath);
|
||||
|
||||
_logger.Info($"{Name} Search | FileHash -> { cid }");
|
||||
_logger.Info($"{0} Search | FileHash -> {1}", new object[2] { Name, cid });
|
||||
|
||||
var response = await _httpClient.GetResponse(new HttpRequestOptions
|
||||
{
|
||||
@@ -96,7 +96,7 @@ namespace Emby.MeiamSub.Thunder
|
||||
AcceptHeader = "*/*",
|
||||
});
|
||||
|
||||
_logger.Info($"{Name} Search | Response -> { _jsonSerializer.SerializeToString(response) }");
|
||||
_logger.Info($"{0} Search | Response -> {1}", new object[2] { Name, _jsonSerializer.SerializeToString(response) });
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
@@ -104,13 +104,13 @@ namespace Emby.MeiamSub.Thunder
|
||||
|
||||
if (subtitleResponse != null)
|
||||
{
|
||||
_logger.Info($"{Name} Search | Response -> { _jsonSerializer.SerializeToString(subtitleResponse) }");
|
||||
_logger.Info($"{0} Search | Response -> {1}", new object[2] { Name, _jsonSerializer.SerializeToString(subtitleResponse) });
|
||||
|
||||
var subtitles = subtitleResponse.sublist.Where(m => !string.IsNullOrEmpty(m.sname));
|
||||
|
||||
if (subtitles.Count() > 0)
|
||||
{
|
||||
_logger.Info($"{Name} Search | Summary -> Get { subtitles.Count() } Subtitles");
|
||||
_logger.Info($"{0} Search | Summary -> Get {1} Subtitles", new object[2] { Name, subtitles.Count() });
|
||||
|
||||
return subtitles.Select(m => new RemoteSubtitleInfo()
|
||||
{
|
||||
@@ -133,7 +133,8 @@ namespace Emby.MeiamSub.Thunder
|
||||
}
|
||||
}
|
||||
|
||||
_logger.Info($"{Name} Search | Summary -> Get 0 Subtitles");
|
||||
_logger.Info($"{0} Search | Summary -> Get 0 Subtitles", new object[1] { Name });
|
||||
|
||||
|
||||
return Array.Empty<RemoteSubtitleInfo>();
|
||||
}
|
||||
@@ -148,7 +149,7 @@ namespace Emby.MeiamSub.Thunder
|
||||
/// <returns></returns>
|
||||
public async Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.Info($"{Name} DownloadSub | Request -> {id}");
|
||||
_logger.Info($"{0} DownloadSub | Request -> {1}", new object[2] { Name, id });
|
||||
|
||||
return await DownloadSubAsync(id);
|
||||
}
|
||||
@@ -167,7 +168,8 @@ namespace Emby.MeiamSub.Thunder
|
||||
return new SubtitleResponse();
|
||||
}
|
||||
|
||||
_logger.Info($"{Name} DownloadSub | Url -> { downloadSub.Url } | Format -> { downloadSub.Format } | Language -> { downloadSub.Language } ");
|
||||
_logger.Info($"{0} DownloadSub | Url -> {1} | Format -> {2} | Language -> {3} ",
|
||||
new object[4] { Name, downloadSub.Url, downloadSub.Format, downloadSub.Language });
|
||||
|
||||
var response = await _httpClient.GetResponse(new HttpRequestOptions
|
||||
{
|
||||
@@ -177,7 +179,7 @@ namespace Emby.MeiamSub.Thunder
|
||||
AcceptHeader = "*/*",
|
||||
});
|
||||
|
||||
_logger.Info($"{Name} DownloadSub | Response -> { response.StatusCode }");
|
||||
_logger.Info($"{0} DownloadSub | Response -> {1}", new object[2] { Name, response.StatusCode });
|
||||
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31424.327
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.10.34916.146
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.MeiamSub.Thunder", "Emby.MeiamSub.Thunder\Emby.MeiamSub.Thunder.csproj", "{96F3F427-0EC3-4610-81C3-2C92D773EDC8}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.MeiamSub.DevTool", "Emby.MeiamSub.DevTool\Emby.MeiamSub.DevTool.csproj", "{6B0C23EA-EC24-4FB0-948E-094E84AEBF21}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emby.MeiamSub.Shooter", "Emby.MeiamSub.Shooter\Emby.MeiamSub.Shooter.csproj", "{0F502AEB-0FF4-44FA-8391-13AD61FC5490}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jellyfin.MeiamSub.Thunder", "Jellyfin.MeiamSub.Thunder\Jellyfin.MeiamSub.Thunder.csproj", "{4676AA1B-CC6C-42DC-BD69-6A293BAE8823}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.MeiamSub.Shooter", "Jellyfin.MeiamSub.Shooter\Jellyfin.MeiamSub.Shooter.csproj", "{8F77E155-9A91-4882-82E8-E8D69FECD246}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jellyfin.MeiamSub.Shooter", "Jellyfin.MeiamSub.Shooter\Jellyfin.MeiamSub.Shooter.csproj", "{8F77E155-9A91-4882-82E8-E8D69FECD246}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.MeiamSub.Shooter", "Emby.MeiamSub.Shooter\Emby.MeiamSub.Shooter.csproj", "{F2636BCB-111D-4F22-AA06-8852E96D05C4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emby.MeiamSub.Thunder", "Emby.MeiamSub.Thunder\Emby.MeiamSub.Thunder.csproj", "{96F4C65C-11B1-46F4-B343-115168688C2D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -19,18 +19,10 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{96F3F427-0EC3-4610-81C3-2C92D773EDC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{96F3F427-0EC3-4610-81C3-2C92D773EDC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{96F3F427-0EC3-4610-81C3-2C92D773EDC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{96F3F427-0EC3-4610-81C3-2C92D773EDC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6B0C23EA-EC24-4FB0-948E-094E84AEBF21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6B0C23EA-EC24-4FB0-948E-094E84AEBF21}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6B0C23EA-EC24-4FB0-948E-094E84AEBF21}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6B0C23EA-EC24-4FB0-948E-094E84AEBF21}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0F502AEB-0FF4-44FA-8391-13AD61FC5490}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0F502AEB-0FF4-44FA-8391-13AD61FC5490}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F502AEB-0FF4-44FA-8391-13AD61FC5490}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F502AEB-0FF4-44FA-8391-13AD61FC5490}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4676AA1B-CC6C-42DC-BD69-6A293BAE8823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4676AA1B-CC6C-42DC-BD69-6A293BAE8823}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4676AA1B-CC6C-42DC-BD69-6A293BAE8823}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -39,6 +31,14 @@ Global
|
||||
{8F77E155-9A91-4882-82E8-E8D69FECD246}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F77E155-9A91-4882-82E8-E8D69FECD246}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F77E155-9A91-4882-82E8-E8D69FECD246}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F2636BCB-111D-4F22-AA06-8852E96D05C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F2636BCB-111D-4F22-AA06-8852E96D05C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F2636BCB-111D-4F22-AA06-8852E96D05C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F2636BCB-111D-4F22-AA06-8852E96D05C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{96F4C65C-11B1-46F4-B343-115168688C2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{96F4C65C-11B1-46F4-B343-115168688C2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{96F4C65C-11B1-46F4-B343-115168688C2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{96F4C65C-11B1-46F4-B343-115168688C2D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Reference in New Issue
Block a user