mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-08 23:00:51 +02:00
Resolve Azure build error
This commit is contained in:
parent
6f0d33b1ca
commit
0d5bd85d6d
|
@ -18,18 +18,29 @@ public static class LyricInfo
|
||||||
/// <returns>Lyric file path if passed lyric provider's supported media type is found; otherwise, null.</returns>
|
/// <returns>Lyric file path if passed lyric provider's supported media type is found; otherwise, null.</returns>
|
||||||
public static string? GetLyricFilePath(this ILyricProvider lyricProvider, string itemPath)
|
public static string? GetLyricFilePath(this ILyricProvider lyricProvider, string itemPath)
|
||||||
{
|
{
|
||||||
|
// Ensure we have a provider
|
||||||
if (lyricProvider is null)
|
if (lyricProvider is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Directory.Exists(Path.GetDirectoryName(itemPath)))
|
// Ensure the path to the item is not null
|
||||||
|
string? itemDirectoryPath = Path.GetDirectoryName(itemPath);
|
||||||
|
if (itemDirectoryPath is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var lyricFilePath in Directory.GetFiles(Path.GetDirectoryName(itemPath), $"{Path.GetFileNameWithoutExtension(itemPath)}.*"))
|
// Ensure the directory path exists
|
||||||
|
if (!Directory.Exists(itemDirectoryPath))
|
||||||
{
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var lyricFilePath in Directory.GetFiles(itemDirectoryPath, $"{Path.GetFileNameWithoutExtension(itemPath)}.*"))
|
||||||
|
{
|
||||||
|
if (lyricFilePath is null) { continue; }
|
||||||
|
|
||||||
if (lyricProvider.SupportedMediaTypes.Contains(Path.GetExtension(lyricFilePath)[1..]))
|
if (lyricProvider.SupportedMediaTypes.Contains(Path.GetExtension(lyricFilePath)[1..]))
|
||||||
{
|
{
|
||||||
return lyricFilePath;
|
return lyricFilePath;
|
||||||
|
|
Loading…
Reference in a new issue