made xml saver methods a little cleaner

This commit is contained in:
Luke Pulverenti 2013-06-28 10:11:09 -04:00
parent 1e49857765
commit ac7d6256f4
8 changed files with 33 additions and 20 deletions

View File

@ -28,9 +28,11 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload)
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
{
return item is MusicAlbum;
}

View File

@ -26,9 +26,11 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload)
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
{
return item is BoxSet;
}

View File

@ -24,9 +24,11 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload)
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
{
return item is Episode;
}

View File

@ -33,9 +33,11 @@ namespace MediaBrowser.Providers.Savers
return false;
}
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload)
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((_config.Configuration.SaveLocalMeta && wasMetadataDownloaded) || wasMetadataEdited)
{
if (!(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum) &&
!(item is Season))
@ -45,8 +47,7 @@ namespace MediaBrowser.Providers.Savers
}
// If new metadata has been downloaded or metadata was manually edited, proceed
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if (wasMetadataDownloaded || wasMetadataEdited)
{
if (item is AggregateFolder || item is UserRootFolder || item is CollectionFolder)
{

View File

@ -31,9 +31,11 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload)
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
{
var trailer = item as Trailer;

View File

@ -1,6 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using MediaBrowser.Providers.Movies;
using System;
using System.IO;
@ -22,9 +21,11 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded or metadata was manually edited, proceed
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((wasMetadataEdited || wasMetadataDownloaded))
{
return item is Person;
}

View File

@ -2,7 +2,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Entities;
using System.IO;
using System.Text;
using System.Threading;
@ -26,9 +25,11 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload)
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
{
return item is Season;
}

View File

@ -29,9 +29,11 @@ namespace MediaBrowser.Providers.Savers
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
{
var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit;
var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload;
// If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed
if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload)
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
{
return item is Series;
}