mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
search hints progress
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,19 @@ 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 DisplayMediaType
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Album";
|
||||
}
|
||||
set
|
||||
{
|
||||
base.DisplayMediaType = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
22
MediaBrowser.Controller/Library/SearchHintInfo.cs
Normal file
22
MediaBrowser.Controller/Library/SearchHintInfo.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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" />
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user