SyncHelper.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using MediaBrowser.Model.Dto;
  2. using System.Collections.Generic;
  3. namespace MediaBrowser.Model.Sync
  4. {
  5. public static class SyncHelper
  6. {
  7. public static List<SyncOptions> GetSyncOptions(List<BaseItemDto> items)
  8. {
  9. List<SyncOptions> options = new List<SyncOptions>();
  10. if (items.Count > 1)
  11. {
  12. options.Add(SyncOptions.Name);
  13. }
  14. foreach (BaseItemDto item in items)
  15. {
  16. if (item.SupportsSync ?? false)
  17. {
  18. if (item.IsVideo)
  19. {
  20. options.Add(SyncOptions.Quality);
  21. if (items.Count > 1)
  22. {
  23. options.Add(SyncOptions.UnwatchedOnly);
  24. }
  25. break;
  26. }
  27. if (item.IsFolder && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
  28. {
  29. options.Add(SyncOptions.Quality);
  30. options.Add(SyncOptions.UnwatchedOnly);
  31. break;
  32. }
  33. if (item.IsGenre)
  34. {
  35. options.Add(SyncOptions.SyncNewContent);
  36. options.Add(SyncOptions.ItemLimit);
  37. break;
  38. }
  39. }
  40. }
  41. foreach (BaseItemDto item in items)
  42. {
  43. if (item.SupportsSync ?? false)
  44. {
  45. if (item.IsFolder || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
  46. {
  47. options.Add(SyncOptions.SyncNewContent);
  48. options.Add(SyncOptions.ItemLimit);
  49. break;
  50. }
  51. }
  52. }
  53. return options;
  54. }
  55. public static List<SyncOptions> GetSyncOptions(SyncCategory category)
  56. {
  57. List<SyncOptions> options = new List<SyncOptions>();
  58. options.Add(SyncOptions.Name);
  59. options.Add(SyncOptions.Quality);
  60. options.Add(SyncOptions.UnwatchedOnly);
  61. options.Add(SyncOptions.SyncNewContent);
  62. options.Add(SyncOptions.ItemLimit);
  63. return options;
  64. }
  65. }
  66. }