SyncHelper.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. options.Add(SyncOptions.UnwatchedOnly);
  22. break;
  23. }
  24. if (item.IsFolder && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
  25. {
  26. options.Add(SyncOptions.Quality);
  27. options.Add(SyncOptions.UnwatchedOnly);
  28. break;
  29. }
  30. }
  31. }
  32. foreach (BaseItemDto item in items)
  33. {
  34. if (item.SupportsSync ?? false)
  35. {
  36. if (item.IsFolder || item.IsGameGenre || item.IsMusicGenre || item.IsGenre || item.IsArtist || item.IsStudio || item.IsPerson)
  37. {
  38. options.Add(SyncOptions.SyncNewContent);
  39. options.Add(SyncOptions.ItemLimit);
  40. break;
  41. }
  42. }
  43. }
  44. return options;
  45. }
  46. public static List<SyncOptions> GetSyncOptions(SyncCategory category)
  47. {
  48. List<SyncOptions> options = new List<SyncOptions>();
  49. options.Add(SyncOptions.Quality);
  50. options.Add(SyncOptions.UnwatchedOnly);
  51. options.Add(SyncOptions.SyncNewContent);
  52. options.Add(SyncOptions.ItemLimit);
  53. return options;
  54. }
  55. }
  56. }