Skip to content

Commit

Permalink
tweak: optimize log output
Browse files Browse the repository at this point in the history
  • Loading branch information
cxfksword committed Jan 6, 2024
1 parent b7541fb commit 9c04488
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,20 @@ public void TestEposideParse()
Assert.AreEqual(parseResult.Name, "New World");
Assert.AreEqual(parseResult.Year, 2013);

// 只英文
// 只英文S01E01
fileName = "She-Hulk.Attorney.At.Law.S01E01.1080p.WEBRip.x265-RARBG";
parseResult = NameParser.Parse(fileName);
Assert.AreEqual(parseResult.Name, "She-Hulk Attorney At Law");
Assert.AreEqual(parseResult.ParentIndexNumber, 1);
Assert.AreEqual(parseResult.IndexNumber, 1);

// 只英文S01EP01
fileName = "Detective.Dee.S01EP18.2004.1080p.WEB-DL.x264.AAC-HQCS";
parseResult = NameParser.Parse(fileName);
Assert.AreEqual(parseResult.Name, "Detective Dee");
Assert.AreEqual(parseResult.ParentIndexNumber, 1);
Assert.AreEqual(parseResult.IndexNumber, 18);


// 日文
fileName = "プロポーズ大作戦Ep05_x264.mp4";
Expand Down
3 changes: 2 additions & 1 deletion Jellyfin.Plugin.MetaShark/Providers/MovieProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(MovieInfo in
/// <inheritdoc />
public async Task<MetadataResult<Movie>> GetMetadata(MovieInfo info, CancellationToken cancellationToken)
{
this.Log($"GetMovieMetadata of [name]: {info.Name} IsAutomated: {info.IsAutomated}");
var fileName = this.GetOriginalFileName(info);
this.Log($"GetMovieMetadata of [name]: {info.Name} [fileName]: {fileName} IsAutomated: {info.IsAutomated}");
var result = new MetadataResult<Movie>();

// 使用刷新元数据时,providerIds会保留旧有值,只有识别/新增才会没值
Expand Down
4 changes: 3 additions & 1 deletion Jellyfin.Plugin.MetaShark/Providers/SeasonProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ public async Task<MetadataResult<Season>> GetMetadata(SeasonInfo info, Cancellat
{
var result = new MetadataResult<Season>();

// 使用刷新元数据时,之前识别的seasonNumber会保留,不会被覆盖
info.SeriesProviderIds.TryGetValue(MetadataProvider.Tmdb.ToString(), out var seriesTmdbId);
info.SeriesProviderIds.TryGetValue(Plugin.ProviderId, out var metaSource);
info.SeriesProviderIds.TryGetValue(DoubanProviderId, out var sid);
var seasonNumber = info.IndexNumber; // S00/Season 00特典目录会为0
var seasonSid = info.GetProviderId(DoubanProviderId);
this.Log($"GetSeasonMetaData of [name]: {info.Name} number: {info.IndexNumber} seriesTmdbId: {seriesTmdbId} sid: {sid} metaSource: {metaSource} IsAutomated: {info.IsAutomated}");
var fileName = this.GetOriginalFileName(info);
this.Log($"GetSeasonMetaData of [name]: {info.Name} [fileName]: {fileName} number: {info.IndexNumber} seriesTmdbId: {seriesTmdbId} sid: {sid} metaSource: {metaSource} IsAutomated: {info.IsAutomated}");

if (metaSource != MetaSource.Tmdb && !string.IsNullOrEmpty(sid))
{
Expand Down
3 changes: 2 additions & 1 deletion Jellyfin.Plugin.MetaShark/Providers/SeriesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo i
/// <inheritdoc />
public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo info, CancellationToken cancellationToken)
{
this.Log($"GetSeriesMetadata of [name]: {info.Name} IsAutomated: {info.IsAutomated}");
var fileName = this.GetOriginalFileName(info);
this.Log($"GetSeriesMetadata of [name]: {info.Name} [fileName]: {fileName} IsAutomated: {info.IsAutomated}");
var result = new MetadataResult<Series>();

var sid = info.GetProviderId(DoubanProviderId);
Expand Down

0 comments on commit 9c04488

Please sign in to comment.