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;
|
|
|
|
|
}
|
2016-08-17 19:28:43 +00:00
|
|
|
|
if (item.IsFolderItem && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
|
2014-12-15 05:16:23 +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);
|
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)
|
|
|
|
|
{
|
2016-08-17 19:28:43 +00:00
|
|
|
|
if (item.IsFolderItem || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
|
2014-12-15 05:16:23 +00:00
|
|
|
|
{
|
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
|
|
|
|
}
|
|
|
|
|
}
|