mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 22:38:30 +01:00
audio podcast
This commit is contained in:
102
MediaBrowser.Controller/Channels/ChannelAudioItem.cs
Normal file
102
MediaBrowser.Controller/Channels/ChannelAudioItem.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
public class ChannelAudioItem : Audio
|
||||
{
|
||||
public ChannelMediaContentType ContentType { get; set; }
|
||||
|
||||
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
return UnratedItem.ChannelContent;
|
||||
}
|
||||
|
||||
protected override string CreateUserDataKey()
|
||||
{
|
||||
return ExternalId;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsSaveLocalMetadataEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ChannelAudioItem()
|
||||
{
|
||||
ChannelMediaSources = new List<ChannelMediaInfo>();
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override LocationType LocationType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(Path))
|
||||
{
|
||||
return LocationType.Remote;
|
||||
}
|
||||
|
||||
return base.LocationType;
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
|
||||
}
|
||||
|
||||
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
|
||||
{
|
||||
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
|
||||
.Result.ToList();
|
||||
|
||||
if (sources.Count > 0)
|
||||
{
|
||||
return sources;
|
||||
}
|
||||
|
||||
var list = base.GetMediaSources(enablePathSubstitution).ToList();
|
||||
|
||||
foreach (var mediaSource in list)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(mediaSource.Path))
|
||||
{
|
||||
mediaSource.Type = MediaSourceType.Placeholder;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsVisibleStandalone(User user)
|
||||
{
|
||||
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
90
MediaBrowser.Controller/Channels/ChannelFolderItem.cs
Normal file
90
MediaBrowser.Controller/Channels/ChannelFolderItem.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
public class ChannelFolderItem : Folder
|
||||
{
|
||||
public ChannelFolderType ChannelFolderType { get; set; }
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
{
|
||||
// Don't block.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
return UnratedItem.ChannelContent;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsSaveLocalMetadataEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override string CreateUserDataKey()
|
||||
{
|
||||
return ExternalId;
|
||||
}
|
||||
|
||||
public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
|
||||
{
|
||||
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>
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsVisibleStandalone(User user)
|
||||
{
|
||||
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
128
MediaBrowser.Controller/Channels/ChannelVideoItem.cs
Normal file
128
MediaBrowser.Controller/Channels/ChannelVideoItem.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Channels
|
||||
{
|
||||
public class ChannelVideoItem : Video
|
||||
{
|
||||
public ChannelMediaContentType ContentType { get; set; }
|
||||
|
||||
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||
|
||||
protected override string CreateUserDataKey()
|
||||
{
|
||||
if (ContentType == ChannelMediaContentType.MovieExtra)
|
||||
{
|
||||
var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(key))
|
||||
{
|
||||
key = key + "-" + ExtraType.ToString().ToLower();
|
||||
|
||||
// Make sure different trailers have their own data.
|
||||
if (RunTimeTicks.HasValue)
|
||||
{
|
||||
key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
return ExternalId;
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
return UnratedItem.ChannelContent;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsSaveLocalMetadataEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public ChannelVideoItem()
|
||||
{
|
||||
ChannelMediaSources = new List<ChannelMediaInfo>();
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override LocationType LocationType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(Path))
|
||||
{
|
||||
return LocationType.Remote;
|
||||
}
|
||||
|
||||
return base.LocationType;
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution)
|
||||
{
|
||||
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
|
||||
.Result.ToList();
|
||||
|
||||
if (sources.Count > 0)
|
||||
{
|
||||
return sources;
|
||||
}
|
||||
|
||||
var list = base.GetMediaSources(enablePathSubstitution).ToList();
|
||||
|
||||
foreach (var mediaSource in list)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(mediaSource.Path))
|
||||
{
|
||||
mediaSource.Type = MediaSourceType.Placeholder;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override string GetInternalMetadataPath(string basePath)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "channels", ChannelId, Id.ToString("N"));
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsVisibleStandalone(User user)
|
||||
{
|
||||
return IsVisibleStandaloneInternal(user, false) && IsChannelVisible(this, user);
|
||||
}
|
||||
|
||||
internal static bool IsChannelVisible(BaseItem item, User user)
|
||||
{
|
||||
var channel = ChannelManager.GetChannel(item.ChannelId);
|
||||
|
||||
return channel.IsVisible(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs
Normal file
12
MediaBrowser.Controller/Entities/Audio/AudioPodcast.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
public class AudioPodcast : Audio
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
public string[] PresetViews { get; set; }
|
||||
public SourceType[] SourceTypes { get; set; }
|
||||
public SourceType[] ExcludeSourceTypes { get; set; }
|
||||
public TrailerType[] TrailerTypes { get; set; }
|
||||
public TrailerType[] ExcludeTrailerTypes { get; set; }
|
||||
|
||||
public InternalItemsQuery()
|
||||
{
|
||||
@@ -145,6 +147,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
PresetViews = new string[] { };
|
||||
SourceTypes = new SourceType[] { };
|
||||
ExcludeSourceTypes = new SourceType[] { };
|
||||
TrailerTypes = new TrailerType[] { };
|
||||
ExcludeTrailerTypes = new TrailerType[] { };
|
||||
}
|
||||
|
||||
public InternalItemsQuery(User user)
|
||||
|
||||
@@ -3,8 +3,8 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public enum SourceType
|
||||
{
|
||||
Library = 0,
|
||||
Channel = 1,
|
||||
LiveTV = 2
|
||||
Library = 1,
|
||||
Channel = 2,
|
||||
LiveTV = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
Taglines = new List<string>();
|
||||
Keywords = new List<string>();
|
||||
ProductionLocations = new List<string>();
|
||||
TrailerTypes = new List<TrailerType>();
|
||||
}
|
||||
|
||||
public List<TrailerType> TrailerTypes { get; set; }
|
||||
|
||||
public float? Metascore { get; set; }
|
||||
|
||||
public List<MediaUrl> RemoteTrailers { get; set; }
|
||||
@@ -62,20 +65,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The critic rating summary.</value>
|
||||
public string CriticRatingSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is local trailer.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is local trailer; otherwise, <c>false</c>.</value>
|
||||
[IgnoreDataMember]
|
||||
public bool IsLocalTrailer
|
||||
{
|
||||
get
|
||||
{
|
||||
// Local trailers are not part of children
|
||||
return GetParent() == null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override string CreateUserDataKey()
|
||||
{
|
||||
var key = Movie.GetMovieUserDataKey(this);
|
||||
@@ -105,7 +94,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var info = GetItemLookupInfo<TrailerInfo>();
|
||||
|
||||
info.IsLocalTrailer = IsLocalTrailer;
|
||||
info.IsLocalTrailer = TrailerTypes.Contains(TrailerType.LocalTrailer);
|
||||
|
||||
if (!IsInMixedFolder)
|
||||
{
|
||||
|
||||
@@ -75,12 +75,15 @@
|
||||
</Compile>
|
||||
<Compile Include="Activity\IActivityManager.cs" />
|
||||
<Compile Include="Activity\IActivityRepository.cs" />
|
||||
<Compile Include="Channels\ChannelAudioItem.cs" />
|
||||
<Compile Include="Channels\ChannelFolderItem.cs" />
|
||||
<Compile Include="Channels\ChannelItemInfo.cs" />
|
||||
<Compile Include="Channels\ChannelItemResult.cs" />
|
||||
<Compile Include="Channels\ChannelItemType.cs" />
|
||||
<Compile Include="Channels\ChannelMediaInfo.cs" />
|
||||
<Compile Include="Channels\ChannelParentalRating.cs" />
|
||||
<Compile Include="Channels\ChannelSearchInfo.cs" />
|
||||
<Compile Include="Channels\ChannelVideoItem.cs" />
|
||||
<Compile Include="Channels\IChannel.cs" />
|
||||
<Compile Include="Channels\IChannelManager.cs" />
|
||||
<Compile Include="Channels\Channel.cs" />
|
||||
@@ -123,6 +126,7 @@
|
||||
<Compile Include="Drawing\ImageStream.cs" />
|
||||
<Compile Include="Dto\DtoOptions.cs" />
|
||||
<Compile Include="Dto\IDtoService.cs" />
|
||||
<Compile Include="Entities\Audio\AudioPodcast.cs" />
|
||||
<Compile Include="Entities\Audio\IHasAlbumArtist.cs" />
|
||||
<Compile Include="Entities\Audio\IHasMusicGenres.cs" />
|
||||
<Compile Include="Entities\Book.cs" />
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public class TrailerInfo : ItemLookupInfo
|
||||
|
||||
Reference in New Issue
Block a user