Optimize identity
This commit is contained in:
parent
8ccf56b209
commit
f93134139a
|
@ -264,6 +264,30 @@ namespace Jellyfin.Plugin.MetaShark.Test
|
||||||
Assert.IsTrue(parseResult.IsExtra);
|
Assert.IsTrue(parseResult.IsExtra);
|
||||||
|
|
||||||
|
|
||||||
|
fileName = "Evangelion 3.0+1.11 Thrice Upon a Time - Voice Message01 In Shin Evangelion No All Night Nippo (BDRIP 1920x1080 x265 10bit ac3)";
|
||||||
|
parseResult = NameParser.Parse(fileName);
|
||||||
|
Assert.IsTrue(parseResult.IsExtra);
|
||||||
|
|
||||||
|
fileName = "Evangelion 3.0+1.11 Thrice Upon a Time - Message1 In Kinyoubi Roadshow (BDRIP 1920x1080 x265 10bit ac3)";
|
||||||
|
parseResult = NameParser.Parse(fileName);
|
||||||
|
Assert.IsTrue(parseResult.IsExtra);
|
||||||
|
|
||||||
|
// fileName = "Evangelion 3.0+1.11 Thrice Upon a Time - CM (BDRIP 1920x1080 x265 10bit ac3)";
|
||||||
|
// parseResult = NameParser.Parse(fileName);
|
||||||
|
// Assert.IsTrue(parseResult.IsExtra);
|
||||||
|
|
||||||
|
// fileName = "Evangelion 3.0+1.11 Thrice Upon a Time - Logo (BDRIP 1920x1080 x265 10bit ac3)";
|
||||||
|
// parseResult = NameParser.Parse(fileName);
|
||||||
|
// Assert.IsTrue(parseResult.IsExtra);
|
||||||
|
|
||||||
|
// fileName = "Evangelion 3.0+1.11 Thrice Upon a Time - Audio Guide (BDRIP 1920x1080 x265 10bit ac3)";
|
||||||
|
// parseResult = NameParser.Parse(fileName);
|
||||||
|
// Assert.IsTrue(parseResult.IsExtra);
|
||||||
|
|
||||||
|
// fileName = "Evangelion 3.0+1.11 Thrice Upon a Time - BD&DVD PV (BDRIP 1920x1080 x265 10bit ac3).mkv";
|
||||||
|
// parseResult = NameParser.Parse(fileName);
|
||||||
|
// Assert.IsTrue(parseResult.IsExtra);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace Jellyfin.Plugin.MetaShark.Core
|
||||||
|
|
||||||
private static readonly Regex specialIndexNumberReg = new Regex(@"ep(\d{1,2})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex specialIndexNumberReg = new Regex(@"ep(\d{1,2})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
private static readonly Regex resolutionReg = new Regex(@"\d{3,4}x\d{3,4}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
public static ParseNameResult Parse(string fileName, bool isEpisode = false)
|
public static ParseNameResult Parse(string fileName, bool isEpisode = false)
|
||||||
{
|
{
|
||||||
fileName = NormalizeFileName(fileName);
|
fileName = NormalizeFileName(fileName);
|
||||||
|
@ -144,6 +146,9 @@ namespace Jellyfin.Plugin.MetaShark.Core
|
||||||
// emby原始电影解析
|
// emby原始电影解析
|
||||||
public static ParseNameResult ParseMovie(string fileName)
|
public static ParseNameResult ParseMovie(string fileName)
|
||||||
{
|
{
|
||||||
|
// 默认解析器会错误把分辨率当年份,先删除
|
||||||
|
fileName = resolutionReg.Replace(fileName, "");
|
||||||
|
|
||||||
var parseResult = new ParseNameResult();
|
var parseResult = new ParseNameResult();
|
||||||
var nameOptions = new Emby.Naming.Common.NamingOptions();
|
var nameOptions = new Emby.Naming.Common.NamingOptions();
|
||||||
var result = Emby.Naming.Video.VideoResolver.CleanDateTime(fileName, nameOptions);
|
var result = Emby.Naming.Video.VideoResolver.CleanDateTime(fileName, nameOptions);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
@ -92,6 +93,13 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
this.Log($"GetMovieMetadata of [name]: {info.Name}");
|
this.Log($"GetMovieMetadata of [name]: {info.Name}");
|
||||||
var result = new MetadataResult<Movie>();
|
var result = new MetadataResult<Movie>();
|
||||||
|
|
||||||
|
// 处理extras影片
|
||||||
|
var extraResult = this.HandleExtraType(info);
|
||||||
|
if (extraResult != null)
|
||||||
|
{
|
||||||
|
return extraResult;
|
||||||
|
}
|
||||||
|
|
||||||
// 使用刷新元数据时,providerIds会保留旧有值,只有识别/新增才会没值
|
// 使用刷新元数据时,providerIds会保留旧有值,只有识别/新增才会没值
|
||||||
var sid = info.GetProviderId(DoubanProviderId);
|
var sid = info.GetProviderId(DoubanProviderId);
|
||||||
var tmdbId = info.GetProviderId(MetadataProvider.Tmdb);
|
var tmdbId = info.GetProviderId(MetadataProvider.Tmdb);
|
||||||
|
@ -245,6 +253,22 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private MetadataResult<Movie>? HandleExtraType(MovieInfo info)
|
||||||
|
{
|
||||||
|
// 特典或extra视频可能和正片放在同一目录
|
||||||
|
// TODO:插件暂时不支持设置影片为extra类型,只能直接忽略处理(最好放extras目录)
|
||||||
|
var fileName = Path.GetFileNameWithoutExtension(info.Path) ?? info.Name;
|
||||||
|
var parseResult = NameParser.Parse(fileName);
|
||||||
|
if (parseResult.IsExtra)
|
||||||
|
{
|
||||||
|
this.Log($"Found extra of [name]: {fileName}");
|
||||||
|
return new MetadataResult<Movie>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private IEnumerable<PersonInfo> GetPersons(TMDbLib.Objects.Movies.Movie item)
|
private IEnumerable<PersonInfo> GetPersons(TMDbLib.Objects.Movies.Movie item)
|
||||||
{
|
{
|
||||||
// 演员
|
// 演员
|
||||||
|
|
|
@ -89,6 +89,8 @@ namespace AnitomySharp
|
||||||
"MENU",
|
"MENU",
|
||||||
// 广告 Commercial Message 电视放送广告,时长一般在 7s/15s/30s/45s/... 左右
|
// 广告 Commercial Message 电视放送广告,时长一般在 7s/15s/30s/45s/... 左右
|
||||||
"CM","SPOT",
|
"CM","SPOT",
|
||||||
|
// 语音信息
|
||||||
|
"MESSAGE",
|
||||||
// 宣传片/预告片 Promotion Video / Trailer 一般时长在 1~2min 命名参考原盘和 jsum
|
// 宣传片/预告片 Promotion Video / Trailer 一般时长在 1~2min 命名参考原盘和 jsum
|
||||||
"PV", "Teaser","TRAILER", "DRAMA",
|
"PV", "Teaser","TRAILER", "DRAMA",
|
||||||
// 真人特典 Interview/Talk/Stage... 目前我们对于节目、采访、舞台活动、制作等三次元画面的长视频,一概怼成 IV。
|
// 真人特典 Interview/Talk/Stage... 目前我们对于节目、采访、舞台活动、制作等三次元画面的长视频,一概怼成 IV。
|
||||||
|
|
Loading…
Reference in New Issue