fixes #719 - Artist.LocalTitle with more than one period in name truncates name

pull/702/head
Luke Pulverenti 11 years ago
parent a6d06bf25f
commit 6f2e74f76c

@ -169,15 +169,7 @@ namespace MediaBrowser.Providers.Manager
/// <returns>ItemUpdateType.</returns> /// <returns>ItemUpdateType.</returns>
protected virtual ItemUpdateType BeforeSave(TItemType item) protected virtual ItemUpdateType BeforeSave(TItemType item)
{ {
var updateType = ItemUpdateType.None; return ItemUpdateType.None;
if (string.IsNullOrEmpty(item.Name) && !string.IsNullOrEmpty(item.Path))
{
item.Name = Path.GetFileNameWithoutExtension(item.Path);
updateType = updateType | ItemUpdateType.MetadataDownload;
}
return updateType;
} }
/// <summary> /// <summary>
@ -311,11 +303,6 @@ namespace MediaBrowser.Providers.Manager
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.ImageUpdate; refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.ImageUpdate;
} }
if (string.IsNullOrWhiteSpace(localItem.Item.Name))
{
localItem.Item.Name = item.Name ?? Path.GetFileNameWithoutExtension(item.Path);
}
MergeData(localItem.Item, temp, new List<MetadataFields>(), !options.ReplaceAllMetadata, true); MergeData(localItem.Item, temp, new List<MetadataFields>(), !options.ReplaceAllMetadata, true);
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataImport; refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataImport;

@ -1,7 +1,7 @@
using System; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace MediaBrowser.Providers.Manager namespace MediaBrowser.Providers.Manager
@ -13,10 +13,14 @@ namespace MediaBrowser.Providers.Manager
if (!lockedFields.Contains(MetadataFields.Name)) if (!lockedFields.Contains(MetadataFields.Name))
{ {
if (replaceData || string.IsNullOrEmpty(target.Name)) if (replaceData || string.IsNullOrEmpty(target.Name))
{
// Safeguard against incoming data having an emtpy name
if (!string.IsNullOrWhiteSpace(source.Name))
{ {
target.Name = source.Name; target.Name = source.Name;
} }
} }
}
if (replaceData || !target.CommunityRating.HasValue) if (replaceData || !target.CommunityRating.HasValue)
{ {

Loading…
Cancel
Save