remove obsolete markings

This commit is contained in:
Luke Pulverenti 2014-06-29 23:32:43 -04:00
parent 3d47b495a9
commit 62d98551ed
9 changed files with 43 additions and 76 deletions

View File

@ -199,7 +199,6 @@ namespace MediaBrowser.Model.Configuration
public string UICulture { get; set; } public string UICulture { get; set; }
[Obsolete]
public DlnaOptions DlnaOptions { get; set; } public DlnaOptions DlnaOptions { get; set; }
public double DownMixAudioBoost { get; set; } public double DownMixAudioBoost { get; set; }
@ -213,10 +212,8 @@ namespace MediaBrowser.Model.Configuration
public ChannelOptions ChannelOptions { get; set; } public ChannelOptions ChannelOptions { get; set; }
[Obsolete]
public ChapterOptions ChapterOptions { get; set; } public ChapterOptions ChapterOptions { get; set; }
[Obsolete]
public bool DefaultMetadataSettingsApplied { get; set; } public bool DefaultMetadataSettingsApplied { get; set; }
/// <summary> /// <summary>

View File

@ -289,7 +289,7 @@ namespace MediaBrowser.ServerApplication
DeleteDeprecatedModules(); DeleteDeprecatedModules();
MigrateModularConfigurations(); MigrateModularConfigurations();
ApplyDefaultXbmcSettings(); ApplyDefaultMetadataSettings();
} }
private void MigrateModularConfigurations() private void MigrateModularConfigurations()
@ -316,7 +316,7 @@ namespace MediaBrowser.ServerApplication
} }
} }
private void ApplyDefaultXbmcSettings() private void ApplyDefaultMetadataSettings()
{ {
if (!ServerConfigurationManager.Configuration.DefaultMetadataSettingsApplied) if (!ServerConfigurationManager.Configuration.DefaultMetadataSettingsApplied)
{ {

View File

@ -36,22 +36,39 @@ namespace MediaBrowser.XbmcMetadata
void _libraryManager_ItemUpdated(object sender, ItemChangeEventArgs e) void _libraryManager_ItemUpdated(object sender, ItemChangeEventArgs e)
{ {
if (e.UpdateReason == ItemUpdateType.ImageUpdate && e.Item is Person) // TODO: Need a more accurate check here to see if xbmc metadata saving is enabled.
// This is probably good enough, but no guarantee
var userId = _config.GetNfoConfiguration().UserId;
if (string.IsNullOrWhiteSpace(userId))
{ {
var person = e.Item.Name; return;
}
var items = _libraryManager.RootFolder if (e.UpdateReason == ItemUpdateType.ImageUpdate)
.GetRecursiveChildren(i => !i.IsFolder && i.People.Any(p => string.Equals(p.Name, person, StringComparison.OrdinalIgnoreCase))); {
var person = e.Item as Person;
foreach (var item in items) if (person != null)
{ {
SaveMetadataForItem(item, ItemUpdateType.MetadataEdit); var items = _libraryManager.RootFolder.RecursiveChildren;
items = person.GetTaggedItems(items).ToList();
foreach (var item in items)
{
SaveMetadataForItem(item, ItemUpdateType.MetadataEdit);
}
} }
} }
} }
void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e) void _userDataManager_UserDataSaved(object sender, UserDataSaveEventArgs e)
{ {
var userId = _config.GetNfoConfiguration().UserId;
if (string.IsNullOrWhiteSpace(userId))
{
return;
}
if (e.SaveReason == UserDataSaveReason.PlaybackFinished || e.SaveReason == UserDataSaveReason.TogglePlayed) if (e.SaveReason == UserDataSaveReason.PlaybackFinished || e.SaveReason == UserDataSaveReason.TogglePlayed)
{ {
var item = e.Item as BaseItem; var item = e.Item as BaseItem;
@ -73,12 +90,6 @@ namespace MediaBrowser.XbmcMetadata
private async void SaveMetadataForItem(BaseItem item, ItemUpdateType updateReason) private async void SaveMetadataForItem(BaseItem item, ItemUpdateType updateReason)
{ {
var userId = _config.GetNfoConfiguration().UserId;
if (string.IsNullOrWhiteSpace(userId))
{
return;
}
var locationType = item.LocationType; var locationType = item.LocationType;
if (locationType == LocationType.Remote || if (locationType == LocationType.Remote ||
locationType == LocationType.Virtual) locationType == LocationType.Virtual)

View File

@ -95,20 +95,12 @@ namespace MediaBrowser.XbmcMetadata.Savers
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType) public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{ {
var locationType = item.LocationType; if (!item.SupportsLocalMetadata)
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
{ {
return false; return false;
} }
// If new metadata has been downloaded or metadata was manually edited, proceed return item is MusicAlbum && updateType >= ItemUpdateType.MetadataDownload;
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
{
return item is MusicAlbum;
}
return false;
} }
private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); private static readonly CultureInfo UsCulture = new CultureInfo("en-US");

View File

@ -85,20 +85,12 @@ namespace MediaBrowser.XbmcMetadata.Savers
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType) public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{ {
var locationType = item.LocationType; if (!item.SupportsLocalMetadata)
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
{ {
return false; return false;
} }
// If new metadata has been downloaded or metadata was manually edited, proceed return item is MusicArtist && updateType >= ItemUpdateType.MetadataDownload;
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
{
return item is MusicArtist;
}
return false;
} }
private void AddAlbums(IEnumerable<MusicAlbum> albums, StringBuilder builder) private void AddAlbums(IEnumerable<MusicAlbum> albums, StringBuilder builder)

View File

@ -130,20 +130,12 @@ namespace MediaBrowser.XbmcMetadata.Savers
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType) public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{ {
var locationType = item.LocationType; if (!item.SupportsLocalMetadata)
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
{ {
return false; return false;
} }
// If new metadata has been downloaded or metadata was manually edited, proceed return item is Episode && updateType >= ItemUpdateType.MetadataDownload;
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
{
return item is Episode;
}
return false;
} }
} }
} }

View File

@ -118,23 +118,17 @@ namespace MediaBrowser.XbmcMetadata.Savers
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType) public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{ {
var locationType = item.LocationType; if (!item.SupportsLocalMetadata)
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
{ {
return false; return false;
} }
// If new metadata has been downloaded or metadata was manually edited, proceed var video = item as Video;
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
{
var video = item as Video;
// Check parent for null to avoid running this against things like video backdrops // Check parent for null to avoid running this against things like video backdrops
if (video != null && !(item is Episode) && !video.IsOwnedItem) if (video != null && !(item is Episode) && !video.IsOwnedItem)
{ {
return true; return updateType >= ItemUpdateType.MetadataDownload;
}
} }
return false; return false;

View File

@ -71,20 +71,17 @@ namespace MediaBrowser.XbmcMetadata.Savers
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType) public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{ {
var locationType = item.LocationType; if (!item.SupportsLocalMetadata)
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
{ {
return false; return false;
} }
// If new metadata has been downloaded or metadata was manually edited, proceed if (!(item is Season))
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
{ {
return item is Season; return false;
} }
return false; return updateType >= ItemUpdateType.MetadataDownload || (updateType >= ItemUpdateType.MetadataImport && File.Exists(GetSavePath(item)));
} }
} }
} }

View File

@ -111,20 +111,12 @@ namespace MediaBrowser.XbmcMetadata.Savers
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType) public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
{ {
var locationType = item.LocationType; if (!item.SupportsLocalMetadata)
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
{ {
return false; return false;
} }
// If new metadata has been downloaded or metadata was manually edited, proceed return item is Series && updateType >= ItemUpdateType.MetadataDownload;
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
{
return item is Series;
}
return false;
} }
} }
} }