Fixed episode image path

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti 2012-08-21 12:33:38 -04:00
parent 76d365fcf9
commit d44f264ac0
2 changed files with 11 additions and 3 deletions

View File

@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Xml
public void Fetch(T item, string metadataFile) public void Fetch(T item, string metadataFile)
{ {
// Use XmlReader for best performance // Use XmlReader for best performance
using (XmlReader reader = XmlReader.Create(metadataFile, new XmlReaderSettings() { })) using (XmlReader reader = XmlReader.Create(metadataFile))
{ {
reader.MoveToContent(); reader.MoveToContent();

View File

@ -46,14 +46,22 @@ namespace MediaBrowser.TV.Providers
Path.Combine(metadataFolder, Path.ChangeExtension(episodeFileName, ".png")) Path.Combine(metadataFolder, Path.ChangeExtension(episodeFileName, ".png"))
}; };
string image;
if (season == null) if (season == null)
{ {
// Gotta do this the slow way // Gotta do this the slow way
item.PrimaryImagePath = imageFiles.FirstOrDefault(f => File.Exists(f)); image = imageFiles.FirstOrDefault(f => File.Exists(f));
} }
else else
{ {
item.PrimaryImagePath = imageFiles.FirstOrDefault(f => season.ContainsMetadataFile(f)); image = imageFiles.FirstOrDefault(f => season.ContainsMetadataFile(f));
}
// If we found something, set PrimaryImagePath
if (!string.IsNullOrEmpty(image))
{
item.PrimaryImagePath = image;
} }
} }
} }