Clean up dead code, consolidate duplication, fix redundancies
Remove 9 dead methods, 6 unused constants, and redundant ReaderWriterLockSlim from MetadataCache. Consolidate repeated patterns into HasChapters, IsPlayable, and ToLowerString helpers. Extract shared API methods in SRFApiClient. Move variant manifest rewriting from controller to StreamProxyService. Make Auto quality distinct from HD. Update README architecture section.
This commit is contained in:
@@ -74,7 +74,9 @@ public class Chapter
|
||||
/// Gets or sets the list of available resources (streams).
|
||||
/// </summary>
|
||||
[JsonPropertyName("resourceList")]
|
||||
public IReadOnlyList<Resource> ResourceList { get; set; } = new List<Resource>();
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1002:Do not expose generic lists", Justification = "Required for JSON deserialization")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA2227:Collection properties should be read only", Justification = "Required for JSON deserialization")]
|
||||
public List<Resource> ResourceList { get; set; } = new List<Resource>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode number.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Jellyfin.Plugin.SRFPlay.Api.Models;
|
||||
@@ -15,6 +14,12 @@ public class MediaComposition
|
||||
[JsonPropertyName("chapterList")]
|
||||
public IReadOnlyList<Chapter> ChapterList { get; set; } = new List<Chapter>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this composition has any chapters.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool HasChapters => ChapterList != null && ChapterList.Count > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the episode information.
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,9 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Jellyfin.Plugin.SRFPlay.Api.Models;
|
||||
|
||||
// NOTE: DrmList is typed as object? because the SRF API returns either null or a JSON array.
|
||||
// IsPlayable checks for both null and empty array ("[]") to determine if content is DRM-free.
|
||||
|
||||
/// <summary>
|
||||
/// Represents a streaming resource (URL) in the SRF API response.
|
||||
/// </summary>
|
||||
@@ -48,4 +51,10 @@ public class Resource
|
||||
/// </summary>
|
||||
[JsonPropertyName("drmList")]
|
||||
public object? DrmList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this resource is playable (not DRM-protected).
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public bool IsPlayable => DrmList == null || DrmList.ToString() == "[]";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user