fix: fix find tmdb id by season imdb
This commit is contained in:
parent
23d10b94ed
commit
2eca5c9a22
|
@ -8,6 +8,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using TMDbLib.Objects.Find;
|
||||||
using TMDbLib.Objects.Languages;
|
using TMDbLib.Objects.Languages;
|
||||||
|
|
||||||
namespace Jellyfin.Plugin.MetaShark.Test
|
namespace Jellyfin.Plugin.MetaShark.Test
|
||||||
|
@ -124,5 +125,27 @@ namespace Jellyfin.Plugin.MetaShark.Test
|
||||||
}).GetAwaiter().GetResult();
|
}).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TestFindByExternalId()
|
||||||
|
{
|
||||||
|
var api = new TmdbApi(loggerFactory);
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await api.FindByExternalIdAsync("tt5924366", FindExternalSource.Imdb, "zh", CancellationToken.None)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
Assert.IsNotNull(result);
|
||||||
|
TestContext.WriteLine(result.ToJson());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TestContext.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}).GetAwaiter().GetResult();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<PackageReference Include="Jellyfin.Controller" Version="10.8.0" />
|
<PackageReference Include="Jellyfin.Controller" Version="10.8.0" />
|
||||||
<PackageReference Include="Jellyfin.Model" Version="10.8.0" />
|
<PackageReference Include="Jellyfin.Model" Version="10.8.0" />
|
||||||
<PackageReference Include="RateLimiter" Version="2.2.0" />
|
<PackageReference Include="RateLimiter" Version="2.2.0" />
|
||||||
<PackageReference Include="TMDbLib" Version="2.0.0" />
|
<PackageReference Include="TMDbLib" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
|
||||||
|
|
|
@ -351,6 +351,18 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
this.Log($"Found tmdb [id]: {tmdbId} by imdb id: {imdb}");
|
this.Log($"Found tmdb [id]: {tmdbId} by imdb id: {imdb}");
|
||||||
return $"{tmdbId}";
|
return $"{tmdbId}";
|
||||||
}
|
}
|
||||||
|
if (findResult?.TvEpisode != null && findResult.TvEpisode.Count > 0)
|
||||||
|
{
|
||||||
|
var tmdbId = findResult.TvEpisode[0].ShowId;
|
||||||
|
this.Log($"Found tmdb [id]: {tmdbId} by imdb id: {imdb}");
|
||||||
|
return $"{tmdbId}";
|
||||||
|
}
|
||||||
|
if (findResult?.TvSeason != null && findResult.TvSeason.Count > 0)
|
||||||
|
{
|
||||||
|
var tmdbId = findResult.TvSeason[0].ShowId;
|
||||||
|
this.Log($"Found tmdb [id]: {tmdbId} by imdb id: {imdb}");
|
||||||
|
return $"{tmdbId}";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -386,6 +398,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
||||||
// 当没有season级目录时,path为空,直接返回
|
// 当没有season级目录时,path为空,直接返回
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
|
this.Log($"Season path is empty!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue