mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-25 19:46:34 +00:00
add new sync methods
This commit is contained in:
51
MediaBrowser.Model/Sync/SyncHelper.cs
Normal file
51
MediaBrowser.Model/Sync/SyncHelper.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using MediaBrowser.Model.Dto;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.Sync
|
||||
{
|
||||
public static class SyncHelper
|
||||
{
|
||||
public static List<SyncOptions> GetSyncOptions(List<BaseItemDto> items)
|
||||
{
|
||||
List<SyncOptions> options = new List<SyncOptions>();
|
||||
|
||||
if (items.Count > 1)
|
||||
{
|
||||
options.Add(SyncOptions.Name);
|
||||
}
|
||||
|
||||
foreach (BaseItemDto item in items)
|
||||
{
|
||||
if (item.SupportsSync ?? false)
|
||||
{
|
||||
if (item.IsVideo)
|
||||
{
|
||||
options.Add(SyncOptions.Quality);
|
||||
options.Add(SyncOptions.UnwatchedOnly);
|
||||
break;
|
||||
}
|
||||
if (item.IsFolder && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
|
||||
{
|
||||
options.Add(SyncOptions.Quality);
|
||||
options.Add(SyncOptions.UnwatchedOnly);
|
||||
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)
|
||||
{
|
||||
options.Add(SyncOptions.SyncNewContent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,11 +46,6 @@ namespace MediaBrowser.Model.Sync
|
||||
/// <value><c>true</c> if [unwatched only]; otherwise, <c>false</c>.</value>
|
||||
public bool UnwatchedOnly { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [remove when watched].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [remove when watched]; otherwise, <c>false</c>.</value>
|
||||
public bool RemoveWhenWatched { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [synchronize new content].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [synchronize new content]; otherwise, <c>false</c>.</value>
|
||||
|
||||
@@ -35,11 +35,6 @@ namespace MediaBrowser.Model.Sync
|
||||
/// <value><c>true</c> if [unwatched only]; otherwise, <c>false</c>.</value>
|
||||
public bool UnwatchedOnly { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [remove when watched].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [remove when watched]; otherwise, <c>false</c>.</value>
|
||||
public bool RemoveWhenWatched { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [synchronize new content].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [synchronize new content]; otherwise, <c>false</c>.</value>
|
||||
|
||||
11
MediaBrowser.Model/Sync/SyncOptions.cs
Normal file
11
MediaBrowser.Model/Sync/SyncOptions.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
namespace MediaBrowser.Model.Sync
|
||||
{
|
||||
public enum SyncOptions
|
||||
{
|
||||
Name = 0,
|
||||
Quality = 1,
|
||||
UnwatchedOnly = 2,
|
||||
SyncNewContent
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user