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