From a86b71899ec52c44ddc6c3018e8cc5e9d7ff4d62 Mon Sep 17 00:00:00 2001 From: Andrew Rabert Date: Thu, 27 Dec 2018 18:27:57 -0500 Subject: Add GPL modules --- .../Persistence/IDisplayPreferencesRepository.cs | 49 +++++++ .../Persistence/IItemRepository.cs | 159 +++++++++++++++++++++ MediaBrowser.Controller/Persistence/IRepository.cs | 16 +++ .../Persistence/IUserDataRepository.cs | 50 +++++++ .../Persistence/IUserRepository.cs | 29 ++++ .../Persistence/MediaStreamQuery.cs | 26 ++++ 6 files changed, 329 insertions(+) create mode 100644 MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IItemRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IUserDataRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/IUserRepository.cs create mode 100644 MediaBrowser.Controller/Persistence/MediaStreamQuery.cs (limited to 'MediaBrowser.Controller/Persistence') diff --git a/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs new file mode 100644 index 0000000000..25aba6bd9e --- /dev/null +++ b/MediaBrowser.Controller/Persistence/IDisplayPreferencesRepository.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using MediaBrowser.Model.Entities; +using System; +using System.Threading; + +namespace MediaBrowser.Controller.Persistence +{ + /// + /// Interface IDisplayPreferencesRepository + /// + public interface IDisplayPreferencesRepository : IRepository + { + /// + /// Saves display preferences for an item + /// + /// The display preferences. + /// The user id. + /// The client. + /// The cancellation token. + /// Task. + void SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, + CancellationToken cancellationToken); + + /// + /// Saves all display preferences for a user + /// + /// The display preferences. + /// The user id. + /// The cancellation token. + /// Task. + void SaveAllDisplayPreferences(IEnumerable displayPreferences, Guid userId, + CancellationToken cancellationToken); + /// + /// Gets the display preferences. + /// + /// The display preferences id. + /// The user id. + /// The client. + /// Task{DisplayPreferences}. + DisplayPreferences GetDisplayPreferences(string displayPreferencesId, string userId, string client); + + /// + /// Gets all display preferences for the given user. + /// + /// The user id. + /// Task{DisplayPreferences}. + IEnumerable GetAllDisplayPreferences(Guid userId); + } +} diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs new file mode 100644 index 0000000000..7905ea1aaf --- /dev/null +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -0,0 +1,159 @@ +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; +using System.Threading; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Querying; + +namespace MediaBrowser.Controller.Persistence +{ + /// + /// Provides an interface to implement an Item repository + /// + public interface IItemRepository : IRepository + { + /// + /// Saves an item + /// + /// The item. + /// The cancellation token. + void SaveItem(BaseItem item, CancellationToken cancellationToken); + + /// + /// Deletes the item. + /// + /// The identifier. + /// The cancellation token. + void DeleteItem(Guid id, CancellationToken cancellationToken); + + /// + /// Saves the items. + /// + /// The items. + /// The cancellation token. + void SaveItems(List items, CancellationToken cancellationToken); + + void SaveImages(BaseItem item); + + /// + /// Retrieves the item. + /// + /// The id. + /// BaseItem. + BaseItem RetrieveItem(Guid id); + + /// + /// Gets chapters for an item + /// + /// + /// + List GetChapters(BaseItem id); + + /// + /// Gets a single chapter for an item + /// + /// + /// + /// + ChapterInfo GetChapter(BaseItem id, int index); + + /// + /// Saves the chapters. + /// + void SaveChapters(Guid id, List chapters); + + /// + /// Gets the media streams. + /// + /// The query. + /// IEnumerable{MediaStream}. + List GetMediaStreams(MediaStreamQuery query); + + /// + /// Saves the media streams. + /// + /// The identifier. + /// The streams. + /// The cancellation token. + void SaveMediaStreams(Guid id, List streams, CancellationToken cancellationToken); + + /// + /// Gets the item ids. + /// + /// The query. + /// IEnumerable<Guid>. + QueryResult GetItemIds(InternalItemsQuery query); + /// + /// Gets the items. + /// + /// The query. + /// QueryResult<BaseItem>. + QueryResult GetItems(InternalItemsQuery query); + + /// + /// Gets the item ids list. + /// + /// The query. + /// List<Guid>. + List GetItemIdsList(InternalItemsQuery query); + + /// + /// Gets the people. + /// + /// The query. + /// List<PersonInfo>. + List GetPeople(InternalPeopleQuery query); + + /// + /// Updates the people. + /// + /// The item identifier. + /// The people. + void UpdatePeople(Guid itemId, List people); + + /// + /// Gets the people names. + /// + /// The query. + /// List<System.String>. + List GetPeopleNames(InternalPeopleQuery query); + + /// + /// Gets the item ids with path. + /// + /// The query. + /// QueryResult<Tuple<Guid, System.String>>. + List> GetItemIdsWithPath(InternalItemsQuery query); + + /// + /// Gets the item list. + /// + /// The query. + /// List<BaseItem>. + List GetItemList(InternalItemsQuery query); + + /// + /// Updates the inherited values. + /// + /// The cancellation token. + void UpdateInheritedValues(CancellationToken cancellationToken); + + int GetCount(InternalItemsQuery query); + + QueryResult> GetGenres(InternalItemsQuery query); + QueryResult> GetMusicGenres(InternalItemsQuery query); + QueryResult> GetGameGenres(InternalItemsQuery query); + QueryResult> GetStudios(InternalItemsQuery query); + QueryResult> GetArtists(InternalItemsQuery query); + QueryResult> GetAlbumArtists(InternalItemsQuery query); + QueryResult> GetAllArtists(InternalItemsQuery query); + + List GetGameGenreNames(); + List GetMusicGenreNames(); + List GetStudioNames(); + List GetGenreNames(); + List GetAllArtistNames(); + } +} + diff --git a/MediaBrowser.Controller/Persistence/IRepository.cs b/MediaBrowser.Controller/Persistence/IRepository.cs new file mode 100644 index 0000000000..2340ca6465 --- /dev/null +++ b/MediaBrowser.Controller/Persistence/IRepository.cs @@ -0,0 +1,16 @@ +using System; + +namespace MediaBrowser.Controller.Persistence +{ + /// + /// Provides a base interface for all the repository interfaces + /// + public interface IRepository : IDisposable + { + /// + /// Gets the name of the repository + /// + /// The name. + string Name { get; } + } +} diff --git a/MediaBrowser.Controller/Persistence/IUserDataRepository.cs b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs new file mode 100644 index 0000000000..5ab3f0943c --- /dev/null +++ b/MediaBrowser.Controller/Persistence/IUserDataRepository.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using MediaBrowser.Controller.Entities; +using System; +using System.Threading; + +namespace MediaBrowser.Controller.Persistence +{ + /// + /// Provides an interface to implement a UserData repository + /// + public interface IUserDataRepository : IRepository + { + /// + /// Saves the user data. + /// + /// The user id. + /// The key. + /// The user data. + /// The cancellation token. + /// Task. + void SaveUserData(long userId, string key, UserItemData userData, CancellationToken cancellationToken); + + /// + /// Gets the user data. + /// + /// The user id. + /// The key. + /// Task{UserItemData}. + UserItemData GetUserData(long userId, string key); + + UserItemData GetUserData(long userId, List keys); + + /// + /// Return all user data associated with the given user + /// + /// + /// + List GetAllUserData(long userId); + + /// + /// Save all user data associated with the given user + /// + /// + /// + /// + /// + void SaveAllUserData(long userId, UserItemData[] userData, CancellationToken cancellationToken); + + } +} diff --git a/MediaBrowser.Controller/Persistence/IUserRepository.cs b/MediaBrowser.Controller/Persistence/IUserRepository.cs new file mode 100644 index 0000000000..2817c4255a --- /dev/null +++ b/MediaBrowser.Controller/Persistence/IUserRepository.cs @@ -0,0 +1,29 @@ +using MediaBrowser.Controller.Entities; +using System.Collections.Generic; +using System.Threading; + +namespace MediaBrowser.Controller.Persistence +{ + /// + /// Provides an interface to implement a User repository + /// + public interface IUserRepository : IRepository + { + /// + /// Deletes the user. + /// + /// The user. + /// The cancellation token. + /// Task. + void DeleteUser(User user); + + /// + /// Retrieves all users. + /// + /// IEnumerable{User}. + List RetrieveAllUsers(); + + void CreateUser(User user); + void UpdateUser(User user); + } +} diff --git a/MediaBrowser.Controller/Persistence/MediaStreamQuery.cs b/MediaBrowser.Controller/Persistence/MediaStreamQuery.cs new file mode 100644 index 0000000000..10985f57db --- /dev/null +++ b/MediaBrowser.Controller/Persistence/MediaStreamQuery.cs @@ -0,0 +1,26 @@ +using MediaBrowser.Model.Entities; +using System; + +namespace MediaBrowser.Controller.Persistence +{ + public class MediaStreamQuery + { + /// + /// Gets or sets the type. + /// + /// The type. + public MediaStreamType? Type { get; set; } + + /// + /// Gets or sets the index. + /// + /// The index. + public int? Index { get; set; } + + /// + /// Gets or sets the item identifier. + /// + /// The item identifier. + public Guid ItemId { get; set; } + } +} -- cgit v1.2.3