diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-18 17:05:47 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-18 17:05:47 -0400 |
| commit | 47fc7c6aeeb6d4304a03d1ec83489f9702feea51 (patch) | |
| tree | a132c28dc295eaa4bc11a60b6845a39ed5d6a85f /Emby.Server.Implementations/Library/LibraryManager.cs | |
| parent | 72f120d8549ca02e7fd77591ea1c90379e2d1976 (diff) | |
add GenreItems property
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 3c94f9784..c8151ec86 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -895,6 +895,26 @@ namespace Emby.Server.Implementations.Library return CreateItemByName<Studio>(Studio.GetPath, name); } + public Guid GetStudioId(string name) + { + return GetItemByNameId<Studio>(Studio.GetPath, name); + } + + public Guid GetGenreId(string name) + { + return GetItemByNameId<Genre>(Genre.GetPath, name); + } + + public Guid GetMusicGenreId(string name) + { + return GetItemByNameId<MusicGenre>(MusicGenre.GetPath, name); + } + + public Guid GetGameGenreId(string name) + { + return GetItemByNameId<GameGenre>(GameGenre.GetPath, name); + } + /// <summary> /// Gets a Genre /// </summary> @@ -974,14 +994,13 @@ namespace Emby.Server.Implementations.Library } } - var path = getPathFn(name); - var forceCaseInsensitiveId = ConfigurationManager.Configuration.EnableNormalizedItemByNameIds; - var id = GetNewItemIdInternal(path, typeof(T), forceCaseInsensitiveId); + var id = GetItemByNameId<T>(getPathFn, name); var item = GetItemById(id) as T; if (item == null) { + var path = getPathFn(name); item = new T { Name = name, @@ -998,6 +1017,14 @@ namespace Emby.Server.Implementations.Library return item; } + private Guid GetItemByNameId<T>(Func<string, string> getPathFn, string name) + where T : BaseItem, new() + { + var path = getPathFn(name); + var forceCaseInsensitiveId = ConfigurationManager.Configuration.EnableNormalizedItemByNameIds; + return GetNewItemIdInternal(path, typeof(T), forceCaseInsensitiveId); + } + public IEnumerable<MusicArtist> GetAlbumArtists(IEnumerable<IHasAlbumArtist> items) { var names = items |
