further improve last fm images

pull/702/head
Luke Pulverenti 11 years ago
parent 062d2dc29f
commit 5c3fcaf049

@ -136,13 +136,11 @@ namespace MediaBrowser.Providers
private void ValidateImages(BaseItem item, ItemResolveArgs args)
{
// Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below
var deletedKeys = item.Images.ToList().Where(image =>
{
var path = image.Value;
return IsInMetaLocation(item, path) && args.GetMetaFileByPath(path) == null;
}).Select(i => i.Key).ToList();
var deletedKeys = item.Images
.ToList()
.Where(image => !File.Exists(image.Value))
.Select(i => i.Key)
.ToList();
// Now remove them from the dictionary
foreach (var key in deletedKeys)
@ -159,7 +157,9 @@ namespace MediaBrowser.Providers
private void ValidateBackdrops(BaseItem item, ItemResolveArgs args)
{
// Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below
var deletedImages = item.BackdropImagePaths.Where(path => IsInMetaLocation(item, path) && args.GetMetaFileByPath(path) == null).ToList();
var deletedImages = item.BackdropImagePaths
.Where(path => !File.Exists(path))
.ToList();
// Now remove them from the dictionary
foreach (var path in deletedImages)
@ -176,7 +176,9 @@ namespace MediaBrowser.Providers
private void ValidateScreenshots(BaseItem item, ItemResolveArgs args)
{
// Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below
var deletedImages = item.ScreenshotImagePaths.Where(path => IsInMetaLocation(item, path) && args.GetMetaFileByPath(path) == null).ToList();
var deletedImages = item.ScreenshotImagePaths
.Where(path => !File.Exists(path))
.ToList();
// Now remove them from the dictionary
foreach (var path in deletedImages)

@ -1,5 +1,4 @@
using System.IO;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
@ -10,6 +9,7 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Serialization;
using MoreLinq;
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -40,6 +40,14 @@ namespace MediaBrowser.Providers.Music
get { return MetadataProviderPriority.Third; }
}
protected override string ProviderVersion
{
get
{
return "8";
}
}
private bool HasAltMeta(BaseItem item)
{
return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName("album.xml");

@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.Music
{
get
{
return "6";
return "8";
}
}

@ -47,7 +47,7 @@ namespace MediaBrowser.Providers.Music
{
get
{
return "5";
return "8";
}
}

@ -54,8 +54,11 @@ namespace MediaBrowser.Providers.Music
return null;
}
var img = data.image
var validImages = data.image
.Where(i => !string.IsNullOrWhiteSpace(i.url))
.ToList();
var img = validImages
.FirstOrDefault(i => string.Equals(i.size, "mega", StringComparison.OrdinalIgnoreCase)) ??
data.image.FirstOrDefault(i => string.Equals(i.size, "extralarge", StringComparison.OrdinalIgnoreCase)) ??
data.image.FirstOrDefault(i => string.Equals(i.size, "large", StringComparison.OrdinalIgnoreCase)) ??

@ -4,11 +4,11 @@ using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Providers.TV
{
@ -115,13 +115,7 @@ namespace MediaBrowser.Providers.TV
return;
}
// Only validate images in the season/metadata folder
if (!string.Equals(Path.GetDirectoryName(path), metadataFolderPath, StringComparison.OrdinalIgnoreCase))
{
return;
}
if (episode.Parent.ResolveArgs.GetMetaFileByPath(path) == null)
if (!File.Exists(path))
{
episode.PrimaryImagePath = null;
}

Loading…
Cancel
Save