mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-03 07:16:31 +01:00
add new sync methods
This commit is contained in:
@@ -1380,11 +1380,11 @@ namespace MediaBrowser.Model.ApiClient
|
||||
Task UpdateItem(BaseItemDto item);
|
||||
|
||||
/// <summary>
|
||||
/// Requests the synchronize.
|
||||
/// Creates the synchronize job.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>Task<SyncJob>.</returns>
|
||||
Task<SyncJob> RequestSync(SyncJobRequest request);
|
||||
Task<SyncJob> CreateSyncJob(SyncJobRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the web socket.
|
||||
|
||||
@@ -887,7 +887,7 @@ namespace MediaBrowser.Model.Dto
|
||||
[IgnoreDataMember]
|
||||
public bool IsVideo
|
||||
{
|
||||
get { return StringHelper.EqualsIgnoreCase(MediaType, MediaBrowser.Model.Entities.MediaType.Video); }
|
||||
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Video); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -897,7 +897,7 @@ namespace MediaBrowser.Model.Dto
|
||||
[IgnoreDataMember]
|
||||
public bool IsAudio
|
||||
{
|
||||
get { return StringHelper.EqualsIgnoreCase(MediaType, MediaBrowser.Model.Entities.MediaType.Audio); }
|
||||
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Audio); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -907,7 +907,7 @@ namespace MediaBrowser.Model.Dto
|
||||
[IgnoreDataMember]
|
||||
public bool IsGame
|
||||
{
|
||||
get { return StringHelper.EqualsIgnoreCase(MediaType, MediaBrowser.Model.Entities.MediaType.Game); }
|
||||
get { return StringHelper.EqualsIgnoreCase(MediaType, Entities.MediaType.Game); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -951,7 +951,13 @@ namespace MediaBrowser.Model.Dto
|
||||
[IgnoreDataMember]
|
||||
public bool IsArtist
|
||||
{
|
||||
get { return StringHelper.EqualsIgnoreCase(Type, "Artist"); }
|
||||
get { return StringHelper.EqualsIgnoreCase(Type, "MusicArtist"); }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsAlbum
|
||||
{
|
||||
get { return StringHelper.EqualsIgnoreCase(Type, "MusicAlbum"); }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
||||
@@ -362,6 +362,7 @@
|
||||
<Compile Include="Session\TranscodingInfo.cs" />
|
||||
<Compile Include="Session\UserDataChangeInfo.cs" />
|
||||
<Compile Include="Devices\ContentUploadHistory.cs" />
|
||||
<Compile Include="Sync\SyncHelper.cs" />
|
||||
<Compile Include="Sync\SyncJob.cs" />
|
||||
<Compile Include="Sync\SyncJobCreationResult.cs" />
|
||||
<Compile Include="Sync\SyncJobItem.cs" />
|
||||
@@ -370,6 +371,7 @@
|
||||
<Compile Include="Sync\SyncJobQuery.cs" />
|
||||
<Compile Include="Sync\SyncJobRequest.cs" />
|
||||
<Compile Include="Sync\SyncJobStatus.cs" />
|
||||
<Compile Include="Sync\SyncOptions.cs" />
|
||||
<Compile Include="Sync\SyncQuality.cs" />
|
||||
<Compile Include="Sync\SyncTarget.cs" />
|
||||
<Compile Include="System\LogFile.cs" />
|
||||
|
||||
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