mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 14:58:36 +01:00
finish removing ChannelFolderItem
This commit is contained in:
@@ -170,7 +170,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
public bool IsOffline { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public SourceType SourceType { get; set; }
|
||||
public virtual SourceType SourceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the folder containing the item.
|
||||
@@ -258,6 +258,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var locationType = LocationType;
|
||||
|
||||
return locationType != LocationType.Remote && locationType != LocationType.Virtual;
|
||||
@@ -304,6 +309,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public virtual bool CanDelete()
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var locationType = LocationType;
|
||||
return locationType != LocationType.Remote &&
|
||||
locationType != LocationType.Virtual;
|
||||
@@ -463,6 +473,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
protected virtual string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
|
||||
}
|
||||
|
||||
var idString = Id.ToString("N");
|
||||
|
||||
basePath = System.IO.Path.Combine(basePath, "library");
|
||||
@@ -1035,6 +1050,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
protected virtual string CreateUserDataKey()
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(ExternalId))
|
||||
{
|
||||
return ExternalId;
|
||||
}
|
||||
}
|
||||
return Id.ToString();
|
||||
}
|
||||
|
||||
@@ -1113,6 +1135,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public virtual bool IsSaveLocalMetadataEnabled()
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ConfigurationManager.Configuration.SaveLocalMeta;
|
||||
}
|
||||
|
||||
@@ -1228,6 +1255,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public virtual UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
return UnratedItem.ChannelContent;
|
||||
}
|
||||
|
||||
return UnratedItem.Other;
|
||||
}
|
||||
|
||||
@@ -1271,6 +1303,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public virtual bool IsVisibleStandalone(User user)
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
|
||||
}
|
||||
|
||||
return IsVisibleStandaloneInternal(user, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CommonIO;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Model.Channels;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -794,8 +795,35 @@ namespace MediaBrowser.Controller.Entities
|
||||
return item;
|
||||
}
|
||||
|
||||
public virtual Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
|
||||
public virtual async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
|
||||
{
|
||||
if (SourceType == SourceType.Channel)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Don't blow up here because it could cause parent screens with other content to fail
|
||||
return await ChannelManager.GetChannelItemsInternal(new ChannelItemQuery
|
||||
{
|
||||
ChannelId = ChannelId,
|
||||
FolderId = Id.ToString("N"),
|
||||
Limit = query.Limit,
|
||||
StartIndex = query.StartIndex,
|
||||
UserId = query.User.Id.ToString("N"),
|
||||
SortBy = query.SortBy,
|
||||
SortOrder = query.SortOrder
|
||||
|
||||
}, new Progress<double>(), CancellationToken.None);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Already logged at lower levels
|
||||
return new QueryResult<BaseItem>
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var user = query.User;
|
||||
|
||||
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
|
||||
@@ -817,7 +845,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var result = PostFilterAndSort(items, query);
|
||||
|
||||
return Task.FromResult(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query)
|
||||
|
||||
@@ -115,6 +115,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public LocationType[] ExcludeLocationTypes { get; set; }
|
||||
public string[] PresetViews { get; set; }
|
||||
public SourceType[] SourceTypes { get; set; }
|
||||
|
||||
public InternalItemsQuery()
|
||||
{
|
||||
@@ -141,6 +142,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
ExcludeTags = new string[] { };
|
||||
ExcludeLocationTypes = new LocationType[] { };
|
||||
PresetViews = new string[] { };
|
||||
SourceTypes = new SourceType[] { };
|
||||
}
|
||||
|
||||
public InternalItemsQuery(User user)
|
||||
|
||||
Reference in New Issue
Block a user