Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match a specific YouTube ID #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public YoutubeLocalImageProvider(IFileSystem fileSystem, ILogger<YoutubeLocalIma
public string Name => Constants.PluginName;

public int Order => 1;
private string GetSeriesInfo(string path)
private string GetSeriesInfo(string ytID, string path)
{
_logger.LogDebug("YTLocalImage GetSeriesInfo: {Path}", path);
Matcher matcher = new();
Expand All @@ -37,7 +37,8 @@ private string GetSeriesInfo(string path)
string infoPath = "";
foreach (string file in matcher.GetResultsInFullPath(path))
{
if (Regex.Match(file, Constants.YTID_RE).Success)
var match = Regex.Match(file, Constants.YTID_RE);
if (match.Success && match.Value == ytID)
{
infoPath = file;
break;
Expand All @@ -56,11 +57,8 @@ public IEnumerable<LocalImageInfo> GetImages(BaseItem item, IDirectoryService di
{
_logger.LogDebug("YTLocalImage GetImages: {Name}", item.Name);
var list = new List<LocalImageInfo>();
string jpgPath = GetSeriesInfo(item.ContainingFolderPath);
if (String.IsNullOrEmpty(jpgPath))
{
return list;
}
var id = Utils.GetYTID(item.FileNameWithoutExtension);
string jpgPath = GetSeriesInfo(id, item.ContainingFolderPath);
if (String.IsNullOrEmpty(jpgPath))
{
return list;
Expand Down