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:
@@ -53,7 +53,7 @@ public class StreamUrlResolver : IStreamUrlResolver
|
||||
|
||||
// Filter out DRM-protected content
|
||||
var nonDrmResources = chapter.ResourceList
|
||||
.Where(r => r.DrmList == null || r.DrmList.ToString() == "[]")
|
||||
.Where(r => r.IsPlayable)
|
||||
.ToList();
|
||||
|
||||
_logger.LogInformation(
|
||||
@@ -136,8 +136,8 @@ public class StreamUrlResolver : IStreamUrlResolver
|
||||
{
|
||||
QualityPreference.HD => SelectHDResource(hlsResources) ?? SelectBestAvailableResource(hlsResources),
|
||||
QualityPreference.SD => SelectSDResource(hlsResources) ?? SelectBestAvailableResource(hlsResources),
|
||||
QualityPreference.Auto => SelectBestAvailableResource(hlsResources),
|
||||
_ => SelectBestAvailableResource(hlsResources)
|
||||
QualityPreference.Auto => hlsResources.FirstOrDefault(),
|
||||
_ => hlsResources.FirstOrDefault()
|
||||
};
|
||||
|
||||
if (selectedResource != null)
|
||||
@@ -164,10 +164,33 @@ public class StreamUrlResolver : IStreamUrlResolver
|
||||
{
|
||||
if (chapter?.ResourceList == null || chapter.ResourceList.Count == 0)
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Chapter {ChapterId}: ResourceList is null or empty. ResourceList count: {Count}, ResourceList type: {Type}",
|
||||
chapter?.Id ?? "null",
|
||||
chapter?.ResourceList?.Count ?? -1,
|
||||
chapter?.ResourceList?.GetType().Name ?? "null");
|
||||
return false;
|
||||
}
|
||||
|
||||
return chapter.ResourceList.Any(r => r.DrmList == null || r.DrmList.ToString() == "[]");
|
||||
_logger.LogInformation(
|
||||
"Chapter {ChapterId}: Found {ResourceCount} resources",
|
||||
chapter.Id,
|
||||
chapter.ResourceList.Count);
|
||||
|
||||
foreach (var resource in chapter.ResourceList)
|
||||
{
|
||||
var urlPreview = resource.Url == null ? "null" : resource.Url.AsSpan(0, Math.Min(60, resource.Url.Length)).ToString() + "...";
|
||||
_logger.LogDebug(
|
||||
"Resource - URL: {Url}, Quality: {Quality}, DrmList: {DrmList}, DrmList type: {DrmListType}",
|
||||
urlPreview,
|
||||
resource.Quality,
|
||||
resource.DrmList?.ToString() ?? "null",
|
||||
resource.DrmList?.GetType().Name ?? "null");
|
||||
}
|
||||
|
||||
var hasPlayable = chapter.ResourceList.Any(r => r.IsPlayable);
|
||||
_logger.LogInformation("Chapter {ChapterId}: Has playable content: {HasPlayable}", chapter.Id, hasPlayable);
|
||||
return hasPlayable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user