mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 20:54:20 +01:00
rework active recordings
This commit is contained in:
@@ -4,7 +4,7 @@ using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public interface IHasMediaSources : IHasUserData
|
||||
public interface IHasMediaSources : IHasMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the media sources.
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
public string[] GetPlayableStreamFileNames()
|
||||
{
|
||||
return GetPlayableStreamFiles().Select(System.IO.Path.GetFileName).ToArray();
|
||||
return GetPlayableStreamFiles().Select(System.IO.Path.GetFileName).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -234,6 +234,35 @@ namespace MediaBrowser.Controller.Entities
|
||||
return LocalAlternateVersions.Select(i => LibraryManager.GetNewItemId(i, typeof(Video)));
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override SourceType SourceType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IsActiveRecording())
|
||||
{
|
||||
return SourceType.LiveTV;
|
||||
}
|
||||
|
||||
return base.SourceType;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool IsActiveRecording()
|
||||
{
|
||||
return LiveTvManager.GetActiveRecordingInfo(Path) != null;
|
||||
}
|
||||
|
||||
public override bool CanDelete()
|
||||
{
|
||||
if (IsActiveRecording())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CanDelete();
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
protected virtual bool EnableDefaultVideoUserDataKeys
|
||||
{
|
||||
@@ -616,6 +645,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
var list = GetAllVideosForMediaSources();
|
||||
var result = list.Select(i => GetVersionInfo(enablePathSubstitution, i.Item1, i.Item2)).ToList();
|
||||
|
||||
if (IsActiveRecording())
|
||||
{
|
||||
foreach (var mediaSource in result)
|
||||
{
|
||||
mediaSource.Type = MediaSourceType.Placeholder;
|
||||
}
|
||||
}
|
||||
|
||||
return result.OrderBy(i =>
|
||||
{
|
||||
if (i.VideoType == VideoType.VideoFile)
|
||||
|
||||
@@ -384,5 +384,9 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
string GetEmbyTvActiveRecordingPath(string id);
|
||||
Task<LiveStream> GetEmbyTvLiveStream(string id);
|
||||
|
||||
ActiveRecordingInfo GetActiveRecordingInfo(string path);
|
||||
|
||||
void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, ActiveRecordingInfo activeRecordingInfo, User user = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,4 +36,13 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
DateTime? EndDate { get; set; }
|
||||
DateTime DateCreated { get; set; }
|
||||
}
|
||||
|
||||
public class ActiveRecordingInfo
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Path { get; set; }
|
||||
public TimerInfo Timer { get; set; }
|
||||
public ProgramInfo Program { get; set; }
|
||||
public CancellationTokenSource CancellationTokenSource { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,9 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
public bool IsKids { get; set; }
|
||||
public bool IsSports { get; set; }
|
||||
public bool IsNews { get; set; }
|
||||
public bool IsSeries { get; set; }
|
||||
public bool IsLive { get; set; }
|
||||
public bool IsPremiere { get; set; }
|
||||
public int? ProductionYear { get; set; }
|
||||
public string EpisodeTitle { get; set; }
|
||||
public DateTime? OriginalAirDate { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user