diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-03 10:38:56 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-03 10:38:56 -0400 |
| commit | c411fdc93a2811af4fba11319e6642211465f568 (patch) | |
| tree | 83e3db65d22c40e1dc018e519cb36ec099918b28 /MediaBrowser.Api/BaseApiService.cs | |
| parent | e9722763b4291af21839b4bb071e919533a50d95 (diff) | |
added methods to edit ibn images
Diffstat (limited to 'MediaBrowser.Api/BaseApiService.cs')
| -rw-r--r-- | MediaBrowser.Api/BaseApiService.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index ddc099a92..f4b14d5a8 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -238,6 +238,54 @@ namespace MediaBrowser.Api }) ?? name; } + + /// <summary> + /// Gets the name of the item by. + /// </summary> + /// <param name="name">The name.</param> + /// <param name="type">The type.</param> + /// <param name="libraryManager">The library manager.</param> + /// <returns>Task{BaseItem}.</returns> + /// <exception cref="System.ArgumentException"></exception> + protected async Task<BaseItem> GetItemByName(string name, string type, ILibraryManager libraryManager) + { + BaseItem item; + + if (type.IndexOf("Person", StringComparison.OrdinalIgnoreCase) == 0) + { + item = await GetPerson(name, libraryManager).ConfigureAwait(false); + } + else if (type.IndexOf("Artist", StringComparison.OrdinalIgnoreCase) == 0) + { + item = await GetArtist(name, libraryManager).ConfigureAwait(false); + } + else if (type.IndexOf("Genre", StringComparison.OrdinalIgnoreCase) == 0) + { + item = await GetGenre(name, libraryManager).ConfigureAwait(false); + } + else if (type.IndexOf("MusicGenre", StringComparison.OrdinalIgnoreCase) == 0) + { + item = await GetMusicGenre(name, libraryManager).ConfigureAwait(false); + } + else if (type.IndexOf("GameGenre", StringComparison.OrdinalIgnoreCase) == 0) + { + item = await GetGameGenre(name, libraryManager).ConfigureAwait(false); + } + else if (type.IndexOf("Studio", StringComparison.OrdinalIgnoreCase) == 0) + { + item = await GetStudio(name, libraryManager).ConfigureAwait(false); + } + else if (type.IndexOf("Year", StringComparison.OrdinalIgnoreCase) == 0) + { + item = await libraryManager.GetYear(int.Parse(name)).ConfigureAwait(false); + } + else + { + throw new ArgumentException(); + } + + return item; + } } /// <summary> |
