mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
made xml saver methods a little cleaner
This commit is contained in:
parent
1e49857765
commit
ac7d6256f4
8 changed files with 33 additions and 20 deletions
|
@ -28,9 +28,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
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 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)
|
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
return item is MusicAlbum;
|
return item is MusicAlbum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
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 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)
|
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
return item is BoxSet;
|
return item is BoxSet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
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 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)
|
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
return item is Episode;
|
return item is Episode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
return false;
|
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 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)
|
if ((_config.Configuration.SaveLocalMeta && wasMetadataDownloaded) || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
if (!(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum) &&
|
if (!(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum) &&
|
||||||
!(item is Season))
|
!(item is Season))
|
||||||
|
@ -45,8 +47,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
}
|
}
|
||||||
|
|
||||||
// If new metadata has been downloaded or metadata was manually edited, proceed
|
// If new metadata has been downloaded or metadata was manually edited, proceed
|
||||||
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|
if (wasMetadataDownloaded || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
if (item is AggregateFolder || item is UserRootFolder || item is CollectionFolder)
|
if (item is AggregateFolder || item is UserRootFolder || item is CollectionFolder)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,9 +31,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
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 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)
|
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
var trailer = item as Trailer;
|
var trailer = item as Trailer;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Providers.Movies;
|
using MediaBrowser.Providers.Movies;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
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>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
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 new metadata has been downloaded or metadata was manually edited, proceed
|
||||||
if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload
|
if ((wasMetadataEdited || wasMetadataDownloaded))
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
return item is Person;
|
return item is Person;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
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>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
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 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)
|
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
return item is Season;
|
return item is Season;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,11 @@ namespace MediaBrowser.Providers.Savers
|
||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
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 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)
|
if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited)
|
||||||
|| (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit)
|
|
||||||
{
|
{
|
||||||
return item is Series;
|
return item is Series;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue