You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Api/Sync/SyncHelper.cs

76 lines
2.5 KiB

using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Sync;
using System.Collections.Generic;
namespace MediaBrowser.Api.Sync
{
public static class SyncHelper
{
10 years ago
public static List<SyncJobOption> GetSyncOptions(List<BaseItemDto> items)
{
10 years ago
List<SyncJobOption> options = new List<SyncJobOption>();
if (items.Count > 1)
{
10 years ago
options.Add(SyncJobOption.Name);
}
foreach (BaseItemDto item in items)
{
if (item.SupportsSync ?? false)
{
if (item.IsVideo)
{
10 years ago
options.Add(SyncJobOption.Quality);
10 years ago
if (items.Count > 1)
{
10 years ago
options.Add(SyncJobOption.UnwatchedOnly);
10 years ago
}
break;
}
if (item.IsFolder && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
{
10 years ago
options.Add(SyncJobOption.Quality);
options.Add(SyncJobOption.UnwatchedOnly);
break;
10 years ago
}
if (item.IsGenre)
{
10 years ago
options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit);
10 years ago
break;
}
}
}
foreach (BaseItemDto item in items)
{
if (item.SupportsSync ?? false)
{
if (item.IsFolder || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
{
10 years ago
options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit);
break;
}
}
}
return options;
}
10 years ago
10 years ago
public static List<SyncJobOption> GetSyncOptions(SyncCategory category)
10 years ago
{
10 years ago
List<SyncJobOption> options = new List<SyncJobOption>();
10 years ago
10 years ago
options.Add(SyncJobOption.Name);
options.Add(SyncJobOption.Quality);
options.Add(SyncJobOption.UnwatchedOnly);
options.Add(SyncJobOption.SyncNewContent);
options.Add(SyncJobOption.ItemLimit);
10 years ago
return options;
}
}
}