jellyfin-server/MediaBrowser.Api/Sync/SyncHelper.cs

73 lines
2.5 KiB
C#
Raw Normal View History

2014-12-15 05:16:23 +00:00
using MediaBrowser.Model.Dto;
2015-03-15 17:50:47 +00:00
using MediaBrowser.Model.Sync;
2014-12-15 05:16:23 +00:00
using System.Collections.Generic;
2015-03-15 17:50:47 +00:00
namespace MediaBrowser.Api.Sync
2014-12-15 05:16:23 +00:00
{
public static class SyncHelper
{
2015-01-17 04:29:53 +00:00
public static List<SyncJobOption> GetSyncOptions(List<BaseItemDto> items)
2014-12-15 05:16:23 +00:00
{
2015-01-17 04:29:53 +00:00
List<SyncJobOption> options = new List<SyncJobOption>();
2014-12-15 05:16:23 +00:00
foreach (BaseItemDto item in items)
{
if (item.SupportsSync ?? false)
{
if (item.IsVideo)
{
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.Quality);
2015-03-17 03:48:05 +00:00
options.Add(SyncJobOption.Profile);
2014-12-17 05:30:31 +00:00
if (items.Count > 1)
{
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.UnwatchedOnly);
2014-12-17 05:30:31 +00:00
}
2014-12-15 05:16:23 +00:00
break;
}
if (item.IsFolder && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
{
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.Quality);
2015-03-17 03:48:05 +00:00
options.Add(SyncJobOption.Profile);
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.UnwatchedOnly);
2014-12-15 05:16:23 +00:00
break;
2014-12-17 05:30:31 +00:00
}
if (item.IsGenre)
{
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit);
2014-12-17 05:30:31 +00:00
break;
2014-12-15 05:16:23 +00:00
}
}
}
foreach (BaseItemDto item in items)
{
if (item.SupportsSync ?? false)
{
if (item.IsFolder || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
{
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit);
2014-12-15 05:16:23 +00:00
break;
}
}
}
return options;
}
2014-12-16 05:01:57 +00:00
2015-01-17 04:29:53 +00:00
public static List<SyncJobOption> GetSyncOptions(SyncCategory category)
2014-12-16 05:01:57 +00:00
{
2015-01-17 04:29:53 +00:00
List<SyncJobOption> options = new List<SyncJobOption>();
2014-12-16 05:01:57 +00:00
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.Quality);
2015-03-17 03:48:05 +00:00
options.Add(SyncJobOption.Profile);
2015-01-17 04:29:53 +00:00
options.Add(SyncJobOption.UnwatchedOnly);
options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit);
2014-12-16 05:01:57 +00:00
return options;
}
2014-12-15 05:16:23 +00:00
}
}