translate music view text

pull/702/head
Luke Pulverenti 10 years ago
parent 2070f1c54d
commit 8edeeb0ecc

@ -192,6 +192,18 @@ namespace MediaBrowser.Controller.Entities
case CollectionType.TvFavoriteSeries:
return GetFavoriteSeries(parent, user, query);
case CollectionType.MusicFavorites:
return await GetMusicFavorites(parent, user, query).ConfigureAwait(false);
case CollectionType.MusicFavoriteAlbums:
return GetFavoriteAlbums(parent, user, query);
case CollectionType.MusicFavoriteArtists:
return GetFavoriteArtists(parent, user, query);
case CollectionType.MusicFavoriteSongs:
return GetFavoriteSongs(parent, user, query);
default:
return GetResult(GetMediaFolders(user).SelectMany(i => i.GetChildren(user, true)), query);
}
@ -219,6 +231,20 @@ namespace MediaBrowser.Controller.Entities
list.Add(await GetUserView(category, CollectionType.MusicSongs, user, "3", parent).ConfigureAwait(false));
//list.Add(await GetUserView(CollectionType.MusicArtists, user, "3", parent).ConfigureAwait(false));
//list.Add(await GetUserView(CollectionType.MusicGenres, user, "5", parent).ConfigureAwait(false));
list.Add(await GetUserView(category, CollectionType.MusicFavorites, user, "6", parent).ConfigureAwait(false));
return GetResult(list, query);
}
private async Task<QueryResult<BaseItem>> GetMusicFavorites(Folder parent, User user, UserItemsQuery query)
{
var list = new List<BaseItem>();
var category = "music";
list.Add(await GetUserView(category, CollectionType.MusicFavoriteAlbums, user, "0", parent).ConfigureAwait(false));
list.Add(await GetUserView(category, CollectionType.MusicFavoriteArtists, user, "1", parent).ConfigureAwait(false));
list.Add(await GetUserView(category, CollectionType.MusicFavoriteSongs, user, "2", parent).ConfigureAwait(false));
return GetResult(list, query);
}
@ -271,6 +297,30 @@ namespace MediaBrowser.Controller.Entities
return GetResult(artists, query);
}
private QueryResult<BaseItem> GetFavoriteArtists(Folder parent, User user, UserItemsQuery query)
{
var artists = GetRecursiveChildren(parent, user, new[] { CollectionType.Music })
.Where(i => !i.IsFolder)
.OfType<IHasAlbumArtist>()
.SelectMany(i => i.AlbumArtists)
.Distinct(StringComparer.OrdinalIgnoreCase)
.Select(i =>
{
try
{
return _libraryManager.GetArtist(i);
}
catch
{
// Already logged at lower levels
return null;
}
})
.Where(i => i != null && _userDataManager.GetUserData(user.Id, i.GetUserDataKey()).IsFavorite);
return GetResult(artists, query);
}
private QueryResult<BaseItem> GetMusicAlbums(Folder parent, User user, UserItemsQuery query)
{
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Music }).Where(i => i is MusicAlbum), query);
@ -331,6 +381,20 @@ namespace MediaBrowser.Controller.Entities
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.TvShows, string.Empty }).Where(i => i is Episode), query);
}
private QueryResult<BaseItem> GetFavoriteSongs(Folder parent, User user, UserItemsQuery query)
{
query.IsFavorite = true;
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Music }).Where(i => i is Audio.Audio), query);
}
private QueryResult<BaseItem> GetFavoriteAlbums(Folder parent, User user, UserItemsQuery query)
{
query.IsFavorite = true;
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Music }).Where(i => i is MusicAlbum), query);
}
private QueryResult<BaseItem> GetMovieMovies(Folder parent, User user, UserItemsQuery query)
{
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }).Where(i => i is Movie), query);

@ -57,5 +57,9 @@
public const string MusicGenres = "MusicGenres";
public const string MusicLatest = "MusicLatest";
public const string MusicSongs = "MusicSongs";
public const string MusicFavorites = "MusicFavorites";
public const string MusicFavoriteArtists = "MusicFavoriteArtists";
public const string MusicFavoriteAlbums = "MusicFavoriteAlbums";
public const string MusicFavoriteSongs = "MusicFavoriteSongs";
}
}

@ -865,6 +865,10 @@
"ViewTypeMusicAlbumArtists": "Album Artists",
"HeaderOtherDisplaySettings": "Display Settings",
"ViewTypeMusicSongs": "Songs",
"ViewTypeMusicFavorites": "Favorites",
"ViewTypeMusicFavoriteAlbums": "Favorite Albums",
"ViewTypeMusicFavoriteArtists": "Favorite Artists",
"ViewTypeMusicFavoriteSongs": "Favorite Songs",
"HeaderMyViews": "My Views",
"LabelSelectFolderGroups": "Automatically group content from the following folders into views such as Movies, Music and TV:",
"LabelSelectFolderGroupsHelp": "Folders that are unchecked will be displayed by themselves in their own view.",

Loading…
Cancel
Save