diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-04-27 12:24:31 -0400 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-04-27 12:24:31 -0400 |
| commit | e0e2614543f87bd40a071d3e64cd1a7d61bc106b (patch) | |
| tree | 8e8b23a01e8ca29baaa82d25e72fa13eaa13b0d8 /MediaBrowser.Controller | |
| parent | 6e7684ae0167efed8d3f64a9a49e6d1cc27abee8 (diff) | |
| parent | 46cf7d93e9727f6cf9b1b1d229804a89fdb6b74c (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Controller')
8 files changed, 71 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs index 76a5f8517..93f5ba8cc 100644 --- a/MediaBrowser.Controller/Dto/DtoBuilder.cs +++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs @@ -431,7 +431,7 @@ namespace MediaBrowser.Controller.Dto if (album != null) { - var songs = album.Children.OfType<Audio>().ToList(); + var songs = album.RecursiveChildren.OfType<Audio>().ToList(); dto.AlbumArtist = songs.Select(i => i.AlbumArtist).FirstOrDefault(i => !string.IsNullOrEmpty(i)); diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index adaec9fdc..cbf35f870 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -96,5 +96,17 @@ namespace MediaBrowser.Controller.Entities.Audio { return string.Equals(Artist, name, StringComparison.OrdinalIgnoreCase) || string.Equals(AlbumArtist, name, StringComparison.OrdinalIgnoreCase); } + + public override string DisplayMediaType + { + get + { + return "Song"; + } + set + { + base.DisplayMediaType = value; + } + } } } diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 0366af8c7..95b047e7d 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -147,7 +147,33 @@ namespace MediaBrowser.Controller.Entities.Audio /// <returns><c>true</c> if the specified artist has artist; otherwise, <c>false</c>.</returns> public bool HasArtist(string artist) { - return Children.OfType<Audio>().Any(i => i.HasArtist(artist)); + return RecursiveChildren.OfType<Audio>().Any(i => i.HasArtist(artist)); + } + + public override string Name + { + get + { + var song = RecursiveChildren.OfType<Audio>().FirstOrDefault(i => !string.IsNullOrEmpty(i.Album)); + + return song == null ? base.Name : song.Album; + } + set + { + base.Name = value; + } + } + + public override string DisplayMediaType + { + get + { + return "Album"; + } + set + { + base.DisplayMediaType = value; + } } } } diff --git a/MediaBrowser.Controller/Library/ILibrarySearchEngine.cs b/MediaBrowser.Controller/Library/ILibrarySearchEngine.cs index 315e75208..ff4dcbe5b 100644 --- a/MediaBrowser.Controller/Library/ILibrarySearchEngine.cs +++ b/MediaBrowser.Controller/Library/ILibrarySearchEngine.cs @@ -23,7 +23,7 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="inputItems">The input items.</param> /// <param name="searchTerm">The search term.</param> - /// <returns>Task{IEnumerable{BaseItem}}.</returns> - Task<IEnumerable<BaseItem>> GetSearchHints(IEnumerable<BaseItem> inputItems, string searchTerm); + /// <returns>Task{IEnumerable{SearchHintInfo}}.</returns> + Task<IEnumerable<SearchHintInfo>> GetSearchHints(IEnumerable<BaseItem> inputItems, string searchTerm); } } diff --git a/MediaBrowser.Controller/Library/SearchHintInfo.cs b/MediaBrowser.Controller/Library/SearchHintInfo.cs new file mode 100644 index 000000000..f832811c2 --- /dev/null +++ b/MediaBrowser.Controller/Library/SearchHintInfo.cs @@ -0,0 +1,22 @@ +using MediaBrowser.Controller.Entities; + +namespace MediaBrowser.Controller.Library +{ + /// <summary> + /// Class SearchHintInfo + /// </summary> + public class SearchHintInfo + { + /// <summary> + /// Gets or sets the item. + /// </summary> + /// <value>The item.</value> + public BaseItem Item { get; set; } + + /// <summary> + /// Gets or sets the matched term. + /// </summary> + /// <value>The matched term.</value> + public string MatchedTerm { get; set; } + } +} diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 4c6d81dcf..5c894c8b3 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -112,6 +112,7 @@ <Compile Include="IServerApplicationPaths.cs" /> <Compile Include="Library\ChildrenChangedEventArgs.cs" /> <Compile Include="Dto\DtoBuilder.cs" /> + <Compile Include="Library\SearchHintInfo.cs" /> <Compile Include="Providers\IProviderManager.cs" /> <Compile Include="Providers\MediaInfo\MediaEncoderHelpers.cs" /> <Compile Include="Providers\MetadataProviderPriority.cs" /> diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs index 983286502..da4250d79 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs @@ -167,7 +167,11 @@ namespace MediaBrowser.Controller.Providers.MediaInfo if (!string.IsNullOrEmpty(val)) { - audio.AddStudios(val.Split(new[] { '/', '|' }, StringSplitOptions.RemoveEmptyEntries)); + var studios = + val.Split(new[] {'/', '|'}, StringSplitOptions.RemoveEmptyEntries) + .Where(i => !string.Equals(i, audio.Artist, StringComparison.OrdinalIgnoreCase) && !string.Equals(i, audio.AlbumArtist, StringComparison.OrdinalIgnoreCase)); + + audio.AddStudios(studios); } } diff --git a/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs index b48999176..df490f5b6 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmAlbumProvider.cs @@ -65,7 +65,7 @@ namespace MediaBrowser.Controller.Providers.Music var folder = (Folder)item; // Get each song, distinct by the combination of AlbumArtist and Album - var songs = folder.Children.OfType<Audio>().DistinctBy(i => (i.AlbumArtist ?? string.Empty) + (i.Album ?? string.Empty), StringComparer.OrdinalIgnoreCase).ToList(); + var songs = folder.RecursiveChildren.OfType<Audio>().DistinctBy(i => (i.AlbumArtist ?? string.Empty) + (i.Album ?? string.Empty), StringComparer.OrdinalIgnoreCase).ToList(); foreach (var song in songs.Where(song => !string.IsNullOrEmpty(song.Album) && !string.IsNullOrEmpty(song.AlbumArtist))) { |
