mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
Update to 3.5.2 and .net core 2.1
This commit is contained in:
@@ -28,70 +28,70 @@ namespace Emby.Server.Implementations.UserViews
|
||||
{
|
||||
}
|
||||
|
||||
protected override List<BaseItem> GetItemsWithImages(IHasMetadata item)
|
||||
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
|
||||
{
|
||||
var view = (CollectionFolder)item;
|
||||
var viewType = view.CollectionType;
|
||||
|
||||
var recursive = !new[] { CollectionType.Playlists, CollectionType.Channels }.Contains(view.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
string[] includeItemTypes;
|
||||
|
||||
var result = view.GetItemList(new InternalItemsQuery
|
||||
if (string.Equals(viewType, CollectionType.Movies))
|
||||
{
|
||||
includeItemTypes = new string[] { "Movie" };
|
||||
}
|
||||
else if (string.Equals(viewType, CollectionType.TvShows))
|
||||
{
|
||||
includeItemTypes = new string[] { "Series" };
|
||||
}
|
||||
else if (string.Equals(viewType, CollectionType.Music))
|
||||
{
|
||||
includeItemTypes = new string[] { "MusicAlbum" };
|
||||
}
|
||||
else if (string.Equals(viewType, CollectionType.Books))
|
||||
{
|
||||
includeItemTypes = new string[] { "Book", "AudioBook" };
|
||||
}
|
||||
else if (string.Equals(viewType, CollectionType.Games))
|
||||
{
|
||||
includeItemTypes = new string[] { "Game" };
|
||||
}
|
||||
else if (string.Equals(viewType, CollectionType.BoxSets))
|
||||
{
|
||||
includeItemTypes = new string[] { "BoxSet" };
|
||||
}
|
||||
else if (string.Equals(viewType, CollectionType.HomeVideos) || string.Equals(viewType, CollectionType.Photos))
|
||||
{
|
||||
includeItemTypes = new string[] { "Video", "Photo" };
|
||||
}
|
||||
else
|
||||
{
|
||||
includeItemTypes = new string[] { "Video", "Audio", "Photo", "Movie", "Series" };
|
||||
}
|
||||
|
||||
var recursive = !new[] { CollectionType.Playlists }.Contains(view.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
return view.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
CollapseBoxSetItems = false,
|
||||
Recursive = recursive,
|
||||
ExcludeItemTypes = new[] { "UserView", "CollectionFolder", "Playlist" },
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
});
|
||||
|
||||
var items = result.Select(i =>
|
||||
{
|
||||
var episode = i as Episode;
|
||||
if (episode != null)
|
||||
DtoOptions = new DtoOptions(false),
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
Limit = 8,
|
||||
OrderBy = new ValueTuple<string, SortOrder>[]
|
||||
{
|
||||
var series = episode.Series;
|
||||
if (series != null)
|
||||
{
|
||||
return series;
|
||||
}
|
||||
new ValueTuple<string, SortOrder>(ItemSortBy.Random, SortOrder.Ascending)
|
||||
},
|
||||
IncludeItemTypes = includeItemTypes
|
||||
|
||||
return episode;
|
||||
}
|
||||
|
||||
var season = i as Season;
|
||||
if (season != null)
|
||||
{
|
||||
var series = season.Series;
|
||||
if (series != null)
|
||||
{
|
||||
return series;
|
||||
}
|
||||
|
||||
return season;
|
||||
}
|
||||
|
||||
var audio = i as Audio;
|
||||
if (audio != null)
|
||||
{
|
||||
var album = audio.AlbumEntity;
|
||||
if (album != null && album.HasImage(ImageType.Primary))
|
||||
{
|
||||
return album;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
|
||||
}).DistinctBy(i => i.Id);
|
||||
|
||||
return GetFinalItems(items.Where(i => i.HasImage(ImageType.Primary) || i.HasImage(ImageType.Thumb)), 8);
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
protected override bool Supports(IHasMetadata item)
|
||||
protected override bool Supports(BaseItem item)
|
||||
{
|
||||
return item is CollectionFolder;
|
||||
}
|
||||
|
||||
protected override string CreateImage(IHasMetadata item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||
protected override string CreateImage(BaseItem item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||
{
|
||||
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ".png");
|
||||
|
||||
@@ -108,55 +108,4 @@ namespace Emby.Server.Implementations.UserViews
|
||||
return base.CreateImage(item, itemsWithImages, outputPath, imageType, imageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public class ManualCollectionFolderImageProvider : BaseDynamicImageProvider<ManualCollectionsFolder>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public ManualCollectionFolderImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
protected override List<BaseItem> GetItemsWithImages(IHasMetadata item)
|
||||
{
|
||||
var view = (ManualCollectionsFolder)item;
|
||||
|
||||
var recursive = !new[] { CollectionType.Playlists, CollectionType.Channels }.Contains(view.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var items = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
Recursive = recursive,
|
||||
IncludeItemTypes = new[] { typeof(BoxSet).Name },
|
||||
Limit = 20,
|
||||
OrderBy = new [] { new Tuple<string, SortOrder>(ItemSortBy.Random, SortOrder.Ascending) },
|
||||
DtoOptions = new DtoOptions(false)
|
||||
});
|
||||
|
||||
return GetFinalItems(items.Where(i => i.HasImage(ImageType.Primary) || i.HasImage(ImageType.Thumb)), 8);
|
||||
}
|
||||
|
||||
protected override bool Supports(IHasMetadata item)
|
||||
{
|
||||
return item is ManualCollectionsFolder;
|
||||
}
|
||||
|
||||
protected override string CreateImage(IHasMetadata item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||
{
|
||||
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ".png");
|
||||
|
||||
if (imageType == ImageType.Primary)
|
||||
{
|
||||
if (itemsWithImages.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return CreateThumbCollage(item, itemsWithImages, outputPath, 960, 540);
|
||||
}
|
||||
|
||||
return base.CreateImage(item, itemsWithImages, outputPath, imageType, imageIndex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,39 +31,12 @@ namespace Emby.Server.Implementations.UserViews
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
protected override List<BaseItem> GetItemsWithImages(IHasMetadata item)
|
||||
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
|
||||
{
|
||||
var view = (UserView)item;
|
||||
|
||||
if (string.Equals(view.ViewType, CollectionType.LiveTv, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var programs = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
|
||||
ImageTypes = new[] { ImageType.Primary },
|
||||
Limit = 30,
|
||||
IsMovie = true,
|
||||
DtoOptions = new DtoOptions(false)
|
||||
|
||||
});
|
||||
|
||||
return GetFinalItems(programs);
|
||||
}
|
||||
|
||||
if (string.Equals(view.ViewType, SpecialFolder.MovieGenre, StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(view.ViewType, SpecialFolder.TvGenre, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var userItemsResult = view.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
CollapseBoxSetItems = false,
|
||||
DtoOptions = new DtoOptions(false)
|
||||
});
|
||||
|
||||
return userItemsResult.ToList();
|
||||
}
|
||||
|
||||
var isUsingCollectionStrip = IsUsingCollectionStrip(view);
|
||||
var recursive = isUsingCollectionStrip && !new[] { CollectionType.Channels, CollectionType.BoxSets, CollectionType.Playlists }.Contains(view.ViewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
var recursive = isUsingCollectionStrip && !new[] { CollectionType.BoxSets, CollectionType.Playlists }.Contains(view.ViewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var result = view.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
@@ -116,13 +89,19 @@ namespace Emby.Server.Implementations.UserViews
|
||||
|
||||
if (isUsingCollectionStrip)
|
||||
{
|
||||
return GetFinalItems(items.Where(i => i.HasImage(ImageType.Primary) || i.HasImage(ImageType.Thumb)), 8);
|
||||
return items
|
||||
.Where(i => i.HasImage(ImageType.Primary) || i.HasImage(ImageType.Thumb))
|
||||
.OrderBy(i => Guid.NewGuid())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return GetFinalItems(items.Where(i => i.HasImage(ImageType.Primary)));
|
||||
return items
|
||||
.Where(i => i.HasImage(ImageType.Primary))
|
||||
.OrderBy(i => Guid.NewGuid())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
protected override bool Supports(IHasMetadata item)
|
||||
protected override bool Supports(BaseItem item)
|
||||
{
|
||||
var view = item as UserView;
|
||||
if (view != null)
|
||||
@@ -139,14 +118,13 @@ namespace Emby.Server.Implementations.UserViews
|
||||
{
|
||||
CollectionType.Movies,
|
||||
CollectionType.TvShows,
|
||||
CollectionType.Playlists,
|
||||
CollectionType.Photos
|
||||
CollectionType.Playlists
|
||||
};
|
||||
|
||||
return collectionStripViewTypes.Contains(view.ViewType ?? string.Empty);
|
||||
}
|
||||
|
||||
protected override string CreateImage(IHasMetadata item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||
protected override string CreateImage(BaseItem item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||
{
|
||||
if (itemsWithImages.Count == 0)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ using MediaBrowser.Controller.Dto;
|
||||
namespace Emby.Server.Implementations.Photos
|
||||
{
|
||||
public abstract class BaseFolderImageProvider<T> : BaseDynamicImageProvider<T>
|
||||
where T : Folder, new ()
|
||||
where T : Folder, new()
|
||||
{
|
||||
protected ILibraryManager _libraryManager;
|
||||
|
||||
@@ -27,43 +27,33 @@ namespace Emby.Server.Implementations.Photos
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
protected override List<BaseItem> GetItemsWithImages(IHasMetadata item)
|
||||
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
|
||||
{
|
||||
return _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
Parent = item as BaseItem,
|
||||
GroupByPresentationUniqueKey = false,
|
||||
Parent = item,
|
||||
DtoOptions = new DtoOptions(true),
|
||||
ImageTypes = new ImageType[] { ImageType.Primary }
|
||||
ImageTypes = new ImageType[] { ImageType.Primary },
|
||||
OrderBy = new System.ValueTuple<string, SortOrder>[]
|
||||
{
|
||||
new System.ValueTuple<string, SortOrder>(ItemSortBy.IsFolder, SortOrder.Ascending),
|
||||
new System.ValueTuple<string, SortOrder>(ItemSortBy.SortName, SortOrder.Ascending)
|
||||
},
|
||||
Limit = 1
|
||||
});
|
||||
}
|
||||
|
||||
protected override string CreateImage(IHasMetadata item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||
protected override string CreateImage(BaseItem item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
||||
{
|
||||
return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
|
||||
}
|
||||
|
||||
protected override bool Supports(IHasMetadata item)
|
||||
protected override bool Supports(BaseItem item)
|
||||
{
|
||||
if (item is PhotoAlbum || item is MusicAlbum)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.GetType() == typeof(Folder))
|
||||
{
|
||||
var folder = item as Folder;
|
||||
if (folder.IsTopParent)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return item is T;
|
||||
}
|
||||
|
||||
protected override bool HasChangedByDate(IHasMetadata item, ItemImageInfo image)
|
||||
protected override bool HasChangedByDate(BaseItem item, ItemImageInfo image)
|
||||
{
|
||||
if (item is MusicAlbum)
|
||||
{
|
||||
@@ -80,6 +70,25 @@ namespace Emby.Server.Implementations.Photos
|
||||
: base(fileSystem, providerManager, applicationPaths, imageProcessor, libraryManager)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool Supports(BaseItem item)
|
||||
{
|
||||
if (item is PhotoAlbum || item is MusicAlbum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var folder = item as Folder;
|
||||
if (folder != null)
|
||||
{
|
||||
if (folder.IsTopParent)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
//return item.SourceType == SourceType.Library;
|
||||
}
|
||||
}
|
||||
|
||||
public class MusicAlbumImageProvider : BaseFolderImageProvider<MusicAlbum>
|
||||
|
||||
Reference in New Issue
Block a user