fixed image uploading for virtual items

This commit is contained in:
Luke Pulverenti 2013-05-18 13:07:20 -04:00
parent 032bf6b8c6
commit 4cd7030248
4 changed files with 15 additions and 9 deletions

View File

@ -765,7 +765,7 @@ namespace MediaBrowser.Api.Images
}
// Don't save locally if there's no parent (special feature, trailer, etc)
var saveLocally = (!(entity is Audio) && entity.Parent != null && !string.IsNullOrEmpty(entity.MetaLocation)) || entity is User;
var saveLocally = !(entity is Audio) && entity.Parent != null && !string.IsNullOrEmpty(entity.MetaLocation) || entity is User;
if (imageType != ImageType.Primary)
{
@ -775,6 +775,11 @@ namespace MediaBrowser.Api.Images
}
}
if (entity.LocationType != LocationType.FileSystem)
{
saveLocally = false;
}
var imagePath = _providerManager.GetSavePath(entity, filename + "." + extension, saveLocally);
// Save to file system

View File

@ -325,7 +325,7 @@ namespace MediaBrowser.Controller.Providers
if (!string.IsNullOrWhiteSpace(val))
{
item.AddTrailerUrl(val);
//item.AddTrailerUrl(val);
}
break;
}
@ -336,10 +336,10 @@ namespace MediaBrowser.Controller.Providers
if (!string.IsNullOrWhiteSpace(val))
{
int ProductionYear;
if (int.TryParse(val, out ProductionYear) && ProductionYear > 1850)
int productionYear;
if (int.TryParse(val, out productionYear) && productionYear > 1850)
{
item.ProductionYear = ProductionYear;
item.ProductionYear = productionYear;
}
}

View File

@ -18,9 +18,10 @@ namespace MediaBrowser.Controller.Resolvers
/// The third
/// </summary>
Third = 3,
Fourth = 4,
/// <summary>
/// The last
/// </summary>
Last = 4
Last = 5
}
}

View File

@ -408,7 +408,7 @@ namespace MediaBrowser.Server.Implementations.Providers
{
return (saveLocally && item.MetaLocation != null) ?
Path.Combine(item.MetaLocation, targetFileName) :
_remoteImageCache.GetResourcePath(item.GetType().FullName + item.Path.ToLower(), targetFileName);
_remoteImageCache.GetResourcePath(item.GetType().FullName + item.Id.ToString(), targetFileName);
}
/// <summary>