add live tv collage
@@ -1673,7 +1673,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
throw new ArgumentNullException("viewType");
|
||||
}
|
||||
|
||||
var id = GetNewItemId("23_namedview_" + name + user.Id.ToString("N") + (parentId ?? string.Empty), typeof(UserView));
|
||||
var id = GetNewItemId("27_namedview_" + name + user.Id.ToString("N") + (parentId ?? string.Empty), typeof(UserView));
|
||||
|
||||
var path = Path.Combine(ConfigurationManager.ApplicationPaths.InternalMetadataPath, "views", id.ToString("N"));
|
||||
|
||||
|
||||
@@ -130,7 +130,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (_liveTvManager.GetEnabledUsers().Select(i => i.Id.ToString("N")).Contains(query.UserId))
|
||||
{
|
||||
list.Add(await _liveTvManager.GetInternalLiveTvFolder(query.UserId, cancellationToken).ConfigureAwait(false));
|
||||
//list.Add(await _liveTvManager.GetInternalLiveTvFolder(query.UserId, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(CollectionType.LiveTv, string.Empty, user, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
<Compile Include="Localization\LocalizationManager.cs" />
|
||||
<Compile Include="Logging\PatternsLogger.cs" />
|
||||
<Compile Include="MediaEncoder\EncodingManager.cs" />
|
||||
<Compile Include="Photos\DynamicImageProvider.cs" />
|
||||
<Compile Include="UserViews\DynamicImageProvider.cs" />
|
||||
<Compile Include="News\NewsEntryPoint.cs" />
|
||||
<Compile Include="News\NewsService.cs" />
|
||||
<Compile Include="Notifications\CoreNotificationTypes.cs" />
|
||||
@@ -248,7 +248,7 @@
|
||||
<Compile Include="Persistence\TypeMapper.cs" />
|
||||
<Compile Include="Photos\BaseDynamicImageProvider.cs" />
|
||||
<Compile Include="Photos\DynamicImageHelpers.cs" />
|
||||
<Compile Include="Photos\StripCollageBuilder.cs" />
|
||||
<Compile Include="UserViews\StripCollageBuilder.cs" />
|
||||
<Compile Include="Playlists\ManualPlaylistsFolder.cs" />
|
||||
<Compile Include="Photos\PhotoAlbumImageProvider.cs" />
|
||||
<Compile Include="Playlists\PlaylistImageProvider.cs" />
|
||||
@@ -514,6 +514,14 @@
|
||||
<Link>swagger-ui\swagger-ui.min.js</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<EmbeddedResource Include="UserViews\livetv\1.jpg" />
|
||||
<EmbeddedResource Include="UserViews\livetv\2.jpg" />
|
||||
<EmbeddedResource Include="UserViews\livetv\3.jpg" />
|
||||
<EmbeddedResource Include="UserViews\livetv\4.jpg" />
|
||||
<EmbeddedResource Include="UserViews\livetv\5.jpg" />
|
||||
<EmbeddedResource Include="UserViews\livetv\6.jpg" />
|
||||
<EmbeddedResource Include="UserViews\livetv\7.jpg" />
|
||||
<EmbeddedResource Include="UserViews\livetv\8.jpg" />
|
||||
<EmbeddedResource Include="Localization\iso6392.txt" />
|
||||
<EmbeddedResource Include="Localization\Ratings\be.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
@@ -6,6 +7,7 @@ using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Server.Implementations.Photos;
|
||||
using MoreLinq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -13,7 +15,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Photos
|
||||
namespace MediaBrowser.Server.Implementations.UserViews
|
||||
{
|
||||
public class DynamicImageProvider : BaseDynamicImageProvider<UserView>
|
||||
{
|
||||
@@ -54,6 +56,11 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||
return new List<BaseItem>();
|
||||
}
|
||||
|
||||
if (string.Equals(view.ViewType, CollectionType.LiveTv, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new List<BaseItem>();
|
||||
}
|
||||
|
||||
if (string.Equals(view.ViewType, SpecialFolder.GameGenre, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var list = new List<BaseItem>();
|
||||
@@ -93,14 +100,14 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||
}
|
||||
|
||||
var isUsingCollectionStrip = IsUsingCollectionStrip(view);
|
||||
var recursive = isUsingCollectionStrip && !new[] {CollectionType.Playlists, CollectionType.Channels}.Contains(view.ViewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
var recursive = isUsingCollectionStrip && !new[] { CollectionType.Playlists, CollectionType.Channels }.Contains(view.ViewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var result = await view.GetItems(new InternalItemsQuery
|
||||
{
|
||||
User = _userManager.GetUserById(view.UserId.Value),
|
||||
CollapseBoxSetItems = false,
|
||||
Recursive = recursive,
|
||||
ExcludeItemTypes = new[] { "UserView", "CollectionFolder"}
|
||||
ExcludeItemTypes = new[] { "UserView", "CollectionFolder" }
|
||||
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
@@ -219,7 +226,8 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||
CollectionType.Music,
|
||||
CollectionType.BoxSets,
|
||||
CollectionType.Playlists,
|
||||
CollectionType.Channels
|
||||
CollectionType.Channels,
|
||||
CollectionType.LiveTv
|
||||
};
|
||||
|
||||
return collectionStripViewTypes.Contains(view.ViewType ?? string.Empty);
|
||||
@@ -230,18 +238,45 @@ namespace MediaBrowser.Server.Implementations.Photos
|
||||
var view = (UserView)item;
|
||||
if (imageType == ImageType.Primary && IsUsingCollectionStrip(view))
|
||||
{
|
||||
var stream = new StripCollageBuilder(ApplicationPaths).BuildThumbCollage(GetStripCollageImagePaths(itemsWithImages), item.Name, 960, 540);
|
||||
var stream = new StripCollageBuilder(ApplicationPaths).BuildThumbCollage(GetStripCollageImagePaths(itemsWithImages, view.ViewType), item.Name, 960, 540);
|
||||
return Task.FromResult(stream);
|
||||
}
|
||||
|
||||
return base.CreateImageAsync(item, itemsWithImages, imageType, imageIndex);
|
||||
}
|
||||
|
||||
private IEnumerable<String> GetStripCollageImagePaths(IEnumerable<BaseItem> items)
|
||||
private IEnumerable<String> GetStripCollageImagePaths(IEnumerable<BaseItem> items, string viewType)
|
||||
{
|
||||
if (string.Equals(viewType, CollectionType.LiveTv, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var list = new List<string>();
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
list.Add(ExtractLiveTvResource(i.ToString(CultureInfo.InvariantCulture), ApplicationPaths));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
return items
|
||||
.Select(i => i.GetImagePath(ImageType.Primary) ?? i.GetImagePath(ImageType.Thumb))
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i));
|
||||
}
|
||||
|
||||
private string ExtractLiveTvResource(string name, IApplicationPaths paths)
|
||||
{
|
||||
var namespacePath = GetType().Namespace + ".livetv." + name + ".jpg";
|
||||
var tempPath = Path.Combine(paths.TempDirectory, Guid.NewGuid().ToString("N") + ".jpg");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(tempPath));
|
||||
|
||||
using (var stream = GetType().Assembly.GetManifestResourceStream(namespacePath))
|
||||
{
|
||||
using (var fileStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
stream.CopyTo(fileStream);
|
||||
}
|
||||
}
|
||||
|
||||
return tempPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
using ImageMagickSharp;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Server.Implementations.Drawing;
|
||||
using MediaBrowser.Server.Implementations.Photos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Photos
|
||||
namespace MediaBrowser.Server.Implementations.UserViews
|
||||
{
|
||||
public class StripCollageBuilder
|
||||
{
|
||||
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/1.jpg
Normal file
|
After Width: | Height: | Size: 61 KiB |
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/2.jpg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/3.jpg
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/4.jpg
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/5.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/6.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/7.jpg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
MediaBrowser.Server.Implementations/UserViews/livetv/8.jpg
Normal file
|
After Width: | Height: | Size: 66 KiB |