aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author1hitsong <3330318+1hitsong@users.noreply.github.com>2022-09-11 19:13:02 -0400
committer1hitsong <3330318+1hitsong@users.noreply.github.com>2022-09-11 19:13:02 -0400
commitcecca5f715f70b263f81b5c44dfcee5c38d53bf8 (patch)
tree0b559792cffbd14ae94934f1505072dbe8ce4e03
parent3928d02e175f732d5e13fa0c66dbccb704c4324d (diff)
Remove unneeded 2nd loops
-rw-r--r--.gitignore2
-rw-r--r--Jellyfin.Api/Helpers/ItemHelper.cs30
2 files changed, 8 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore
index 3f80ffcf7..c2ae76c1e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -281,5 +281,3 @@ apiclient/generated
# Omnisharp crash logs
mono_crash.*.json
-
-!LrcParser.dll \ No newline at end of file
diff --git a/Jellyfin.Api/Helpers/ItemHelper.cs b/Jellyfin.Api/Helpers/ItemHelper.cs
index cd29361bd..0afe5a155 100644
--- a/Jellyfin.Api/Helpers/ItemHelper.cs
+++ b/Jellyfin.Api/Helpers/ItemHelper.cs
@@ -40,16 +40,11 @@ namespace Jellyfin.Api.Helpers
ILyricsProvider? newProvider = Activator.CreateInstance(provider) as ILyricsProvider;
if (newProvider is not null)
{
- providerList.Add(newProvider);
- }
- }
-
- foreach (ILyricsProvider provider in providerList)
- {
- provider.Process(item);
- if (provider.HasData)
- {
- return provider.Data;
+ newProvider.Process(item);
+ if (newProvider.HasData)
+ {
+ return newProvider.Data;
+ }
}
}
@@ -86,26 +81,17 @@ namespace Jellyfin.Api.Helpers
if (foundProvider.FileExtensions.Any())
{
- // Gather distinct list of handled file extentions
foreach (string lyricFileExtension in foundProvider.FileExtensions)
{
- if (!supportedLyricFileExtensions.Contains(lyricFileExtension))
+ string lyricFilePath = @Path.ChangeExtension(itemPath, lyricFileExtension);
+ if (System.IO.File.Exists(lyricFilePath))
{
- supportedLyricFileExtensions.Add(lyricFileExtension);
+ return lyricFilePath;
}
}
}
}
- foreach (string lyricFileExtension in supportedLyricFileExtensions)
- {
- string lyricFilePath = @Path.ChangeExtension(itemPath, lyricFileExtension);
- if (System.IO.File.Exists(lyricFilePath))
- {
- return lyricFilePath;
- }
- }
-
return null;
}